suchen

Heim  >  Fragen und Antworten  >  Hauptteil

mvc – vue.js Code-Verbesserung?

Gibt es eine Verbesserung im obigen Code?

世界只因有你世界只因有你2827 Tage vor569

Antworte allen(1)Ich werde antworten

  • PHP中文网

    PHP中文网2017-05-16 17:07:33

    代码写的真丑陋,难道就不会用个filter或者函数?

    var wordMap = ['待发车', ...]
    
    // vue 里面
    filters: {
        words: function (status) {
            return wordMap[status]
        }
    }
    // template 里面
    <span>{{ item.status | words }}</span>

    Antwort
    0
  • StornierenAntwort