Vue起步

mkdir vue
cd vue
wget https://vuejs.org/js/vue.js
touch index.html

1. hello world 项目

<html>
    <head>
        <script src="vue.js"></script>
    </head>
    <body>
        <div id="app">
            {{ message }}
        </div>
    </body>
    <script>
        var app = new Vue({
        el: '#app',
        data: {
            message: 'Hello Vue!'
        }
        })  
    </script>
</html>

打开chrome devtools 感受双向绑定

> app.$data.message
"Hello Vue!"
> app.$data.message="hehe" #浏览器中的值被刷新
"hehe"
> app.$data.message
"hehe"
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容