vue起步之二methods

给html加入方法/函数

我们需要在new Vue 实例化对象中添加methods方法:methods:用于存储各种方法。

greet方法名随意取,time是参数。通过this.name,获取实例化对象内部的属性name

通过h3调用greet方法

运行结果:

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

猜你喜欢

转载自blog.csdn.net/qq_35723619/article/details/83692387