老韩哥

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

2020年5月5日

摘要: 1、写一个模板 <template id="tmp"> <div> <p>博客地址:</p> <p>网名:</p> <p>技术类型:</p> </div> </template> 2、写一个组件 var author={ template:"#tmp" } components:{ "author" 阅读全文
posted @ 2020-05-05 17:39 老韩哥 阅读(149) 评论(0) 推荐(0)

摘要: //写入方法 app.$on('reduce',function(){ this.count-- }) // 调用 function reduce(){ app.$emit('reduce') } //写入方法 app.$once('reduceOnce',function(){ this.coun 阅读全文
posted @ 2020-05-05 16:53 老韩哥 阅读(600) 评论(0) 推荐(0)

摘要: 挂载方法 vm.$mount('xx') 卸载方法 vm.$destroy(); 更新方法 vm.$forceUpdate() 数据修改方法 function tick(){ vm.message="update message info "; vm.$nextTick(function(){ co 阅读全文
posted @ 2020-05-05 16:08 老韩哥 阅读(256) 评论(0) 推荐(0)

摘要: 如何调用 jQuery 1、引入jQuery 文件 2、在 mounted 或 updated 里调用 //在Vue中使用jQuery mounted:function(){ $('#app').html('我是jQuery!'); } 阅读全文
posted @ 2020-05-05 16:02 老韩哥 阅读(173) 评论(0) 推荐(0)

摘要: 通过外部增加对象的形式,对构造器进行扩展 var exUpdate={} 构造器里 extends:exUpdate 如果方法重名,则优先处理原生的方法。 delimiters delimiters:['${','}'] 作用是改变我们插值的符号。Vue默认的插值是双大括号{{}}。但有时我们会有需 阅读全文
posted @ 2020-05-05 09:44 老韩哥 阅读(280) 评论(0) 推荐(0)

摘要: 全局 Vue.mixin({ updated:function(){} }) 外部 var mxUpdate={ updated:function(){} } mixins:[mxUpdate] 原生 updated:function(){} 执行顺序:全局 - 外部 - 原生 从执行的先后顺序来说 阅读全文
posted @ 2020-05-05 09:00 老韩哥 阅读(156) 评论(0) 推荐(0)

2020年5月4日

摘要: data:{ weather:25, wear:'短袖' } 实例属性写watch监控 构造器外部写法 app.$watch('xxx',function(){}) 写在构造器里 watch:{ weather:function(nv,ov){ } } 用computed实现 就不灵活了。例 com 阅读全文
posted @ 2020-05-04 23:46 老韩哥 阅读(147) 评论(0) 推荐(0)

摘要: 1、传值 add(2) 2、event add(2,$event) 3、组件调用 click方法 @click.native="add()" 4、构造器外部click方法 app.add() methods:{ add:function(step,event){ if(!step==''){ thi 阅读全文
posted @ 2020-05-04 20:46 老韩哥 阅读(176) 评论(0) 推荐(0)

摘要: computed 的作用主要是对原数据进行改造输出 比如:拼接字符串 ¥100元 data:{ price:100, news:newList }, computed:{ newPrice:function(){ return this.price="¥"+this.price+“元” } } 比如 阅读全文
posted @ 2020-05-04 18:16 老韩哥 阅读(156) 评论(0) 推荐(0)

摘要: propsData 不是和属性有关,他用在全局扩展时进行传递数据。 先写一个全局扩展 var header_a = Vue.extend({ template:`{{message}} 传值 {{ a }}`, data:function(){ return { message:"内容" } }, 阅读全文
posted @ 2020-05-04 14:27 老韩哥 阅读(1395) 评论(0) 推荐(0)