v-else-if="type === 'B'"
[2.1.0 新增]
v-for="value in object"
v-for="(value, key) in object"
span v-once这个将不会改变: {{ msg }} span
v-on:click="函数"
v-on:click.native="原生函数"
v-on:keyup.enter="函数"
v-on:keyup.13="函数"
@click="函数" [简写]
@click="add($event)" 原生DOM
input type="text" v-model="message"
input type="text" v-model.lazy="message" change改变执行[失去焦点]
input type="text" v-model.number="message" 只能为数字
input type="text" v-model.trim="message" 去掉首尾空格
v-bind:href="url"
:href="url"[简写]
div v-pre {{message}} div
与css配合
[v-cloak] {
display: none;
}
// 注册一个全局自定义指令 `v-focus`
Vue.directive('focus', {
// 当被绑定的元素插入到 DOM 中时……
inserted: function (el) {
// 聚焦元素
el.focus()
}
})
Vue.set(outData,'count',4);
var app=new Vue({
el:'#app',
data:{
message:'hello Vue!'
},
template:'#demo3'
})
Vue.component('lxy-body',{
template:` div style="color:red;" 全局化注册的lxy-body标签 div `
})
components:{
"panda":{
template:`div style="color:red;" 局部注册的panda标签 div`
}
}
type: String, 类型
required: true 必转
default: 100 默认
validator:() => {} 验证
computed:{
newPrice:function(){
return this.price='¥' + this.price + '元';
}
}
new header_a({propsData:{a:1}}).$mount('header');
需要在props里面接收这个参数
methods:{
add:function(){}
}
watch:{
a:function(){} //监控a数据
}
mixins: [mixin] 混入mixin实例
混入对象的钩子将在组件自身钩子之前调用
var CompB = {
extends: CompA, 扩展CompA实例
...
}
delimiters:['${','}']
app.$once('lxy',() => {})
app.$off('lxy')