vue02

作者: 暴打小乳猪 | 来源:发表于2018-09-13 19:40 被阅读0次

v-if

<div class="he">

<p v-if="num==0">0</p>

<p v-else-if="num==1">1</p>

<p v-else-if="num==2">2</p>

<p v-else-if="num==3">3</p>

<p v-else-if="num==4">4</p>

<p v-else="num==5">5</p>

</div>

new Vue({

el:".he",

data:{

num:Math.floor(Math.random()*(5-0+1)+0)

}

})

v-html

<div class="ta">

<input type="text" v-model="msg">

<p v-html="msg">{{msg}}</p>

<p v-text="msg">{{msg}}</p>

<p v-once="msg">{{msg}}</p>

<p v-pre="msg">{{msg}}</p>

</div>

new Vue({

el:".ta",

data:{

msg:"ni hao"

}

})

v-cloak

<style>

[v-cloak]{

display:none;

}

</style>

<div class="men">

<p v-cloak>{{msg}}</p>

</div>

new Vue({

el:".men",

data:{

msg:"hellow vue"

},

beforeMount:function(){

alert(111)

}

})

filter

<div class="le">

<p>{{12|addZero}}</p>

</div>

//全局过滤器

Vue.filter("addZero",function(data){

if(data<10){

return '0'+data;

}else{

return data;

}

})

new Vue({

el:".le"

})

相关文章

  • vue02

    vue02 vue生命周期 1.0钩子函数: created -> 实例已经创建 √ beforeComp...

  • VUE02

    v-cloak ref monted Vue.directive()自定义指令 }) Vue.filter过滤器 ...

  • Vue02

    一、文档类指令操作 代码示例: v-text:文本变量 v-once:一次性文本赋值 v-html:html文本变...

  • vue02

    v-if 0 1 2 3 4 5 new Vue({ el:".he", data:{ num:Math.floo...

  • vue02

    spa框架:单页应用 (1个页面)组件:component 把一个复杂的页面拆分成若干个组件,最后再拼成一个完整的...

  • VUE02

    Vue案例: localStorage: localStorage生命周期是永久,这意味着除非用户显示在浏览器提供...

  • vue02

    列表展示: j计数器: vue的MVVM vue的生命周期 mustache v-once v-html v-te...

  • VUE02:Vue组件

      前后端分离使得前端可以想开发后台一样开发,这种思想指导下的Vue是比较常用框架,这个框架的最大特色是页面组件化...

网友评论

      本文标题:vue02

      本文链接:https://www.haomeiwen.com/subject/kmsggftx.html