可以用
<script>
new Vue({
el: '#app',
data: function () {
return {
message: 'Hello World',
tip: 'tips'
}
}
});
</script>
{
{
message }}
<div id="app"> <!--HTML Part Dealed by Vue-->
<div>
Text: <span v-text="message" /> //以text渲染
</div>
<div>
HTML: <span v-html="message" /> //以html渲染
</div>
<div>
<input type="text" v-model="message"/> //双向绑定同时影响建相同的数据
</div>
</div>
v-bind:style 缩写为:style //设置属性
v-on:click=’“countUp” 缩写为 @click=“countUp” //设置事件
条件渲染
v-if 会创造销毁对象
v-show 会显示隐藏对象
vue中方法
method: 主动调⽤或通过事件触发的⽅法
computed: 基于值计算出的值
watch: 当值改变后触发⽅法调⽤
使用eslint方法
在vue终端项目中vscode中先运行npm install eslint,再运行.\node_modules.bin\eslint即可