摘要:
ref是vue中提供的直接操作dom的方法 <div v-for = 'item in list'>{{item}}</div> <input type="text" value="请输入内容" ref = 'inp' @focus='clear'> <button @click= 'click() 阅读全文
posted @ 2020-06-30 23:04
好啊好呀
阅读(491)
评论(0)
推荐(0)
摘要:
第一步,创建pormise实例 let p = new Promise() 第二步,填写逻辑 let p = new Promise((res,rej)=>{ setTimeout(()=>{ var flag = false ; if(flag){ res('hello') }else{ rej( 阅读全文
posted @ 2020-06-30 22:03
好啊好呀
阅读(238)
评论(0)
推荐(0)
摘要:
使用一个新的vue实例hub作为事件中心 使用$emit发送事件,hub.$on()接受发送出来的事件 //提供事件中心 var hub = new Vue() let app = new Vue({ el : '#app', data:{ masssage:0 }, components:{ 'c 阅读全文
posted @ 2020-06-30 20:33
好啊好呀
阅读(135)
评论(0)
推荐(0)
摘要:
computed:{ sum : function(){ return this.list.length }, suma:function(){ let a = 0; this.list.forEach(function(x,index){ a = a + x.price }) return a } 阅读全文
posted @ 2020-06-30 16:09
好啊好呀
阅读(177)
评论(0)
推荐(0)
浙公网安备 33010602011771号