vue钩子函数 -凯发k8官方网
<!doctype html>
<html lang="en">
<head><meta charset="utf-8"><title>跟着学亮学vue</title>
</head>
<body><div id="app"><button @click="num ">1</button><button @click="func1">调用func1</button><p>{{name}}</p>{{num}}</div>
</body>
<script src="node_modules/vue/dist/vue.js"></script>
<script>let app = new vue({el:"#app",data:{name:"张学亮1111",num:1},methods:{func1(){console.log("我是方法func1")}},created() {this.name="created钩子函数改变了name的值"}})</script>
</html>
与50位技术专家面对面20年技术见证,附赠技术全景图
总结
- 上一篇:
- 下一篇: vue定义一个变量并显示