Vue中created和mounted的区别是什么

时间:2024-11-01 15:22:54

1、打开一个html文件,在里面导入vue.js文件。

Vue中created和mounted的区别是什么

2、在script标签中,使用created为组件初始化属性值。

Vue中created和mounted的区别是什么

3、运行网页,可以看到属性值正常显示。

Vue中created和mounted的区别是什么

4、在script标签中,使用mounted操作属性值。

Vue中created和mounted的区别是什么

5、再次运行网页,可以看到name属性值由“小明”更改为“小红”。

Vue中created和mounted的区别是什么
© 手抄报圈