<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <div id="app"> <div v-for="addr in addrs"> {{addr}} <br> </div> <hr> <div v-for="(addr,i) in addrs"> {{i}}--{{addr}} <br> </div> </div> <script src="js/vue.js"></script> <script> //1. 创建Vue核心对象 new Vue({ el:"#app", data(){ return{ username:"", url:"http://www.baidu.com", count:3, addrs:["北京","上海","西安"] } }, methods:{ show(){ alert("我被点了。。。。") } }, /*mounted:function () { }*/ mounted(){ alert("加载完成。。") } }); </script> </body> </html>
标签:function,生命周期,addr,alert,Vue,mounted From: https://www.cnblogs.com/Karl-hut/p/17524043.html