12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>Title</title>
- <script src="../vue.js"></script>
- </head>
- <body>
- <div id="app" >
- <p id="content">{{message}}</p>
- </div>
- </body>
- <script>
- var jsonParam = {
- el: "#app",
- data: {
- message:"hello world"
- },
- methods:{
- },
- watch:{
- },
- // 1.实例创建之前
- "beforeCreate":function(){
- console.log("beforeCreate:"+this.message);
- },
- // 2.实例创建完成
- "created":function(){
- console.log("created:"+this.message);
- },
- // 3.数据挂载前
- "beforeMount":function(){
- console.log("beforeMount:"+document.getElementById("content").innerText);
- },
- // 4.数据已经挂载
- "mounted":function(){
- console.log("mounted:"+document.getElementById("content").innerText);
- },
- }
- var vue = new Vue(jsonParam);
- //watch 监听属性 属性变化
- //computed 计算属性 计算 价格
- //method 方法 事件
- </script>
- </html>
|