1. 程式人生 > >vue起步之二methods

vue起步之二methods

給html加入方法/函式

我們需要在new Vue 例項化物件中新增methods方法:methods:用於儲存各種方法。

greet方法名隨意取,time是引數。通過this.name,獲取例項化物件內部的屬性name

通過h3呼叫greet方法

執行結果:

https://blog.csdn.net/qq_35723619/article/details/83692449