随笔分类 - vue
摘要:1、Vue的双向数据绑定原理是什么? 答 : vue是采用数据劫持,并且使用发布-订阅者的开发模式。原理是观察者observer通过Object.defineProperty()来劫持到各个属性的getter setter,在数据变动的时候,会被observer观察到,会通过Dep通知数据的订阅者w
阅读全文
摘要:安装vue-cli:1.npm install vue-cli -g2.vue install webpack 项目名3.cd 项目名4.npm install5.npm i webpack-dev-server css-loader style-loader less less-loader --
阅读全文
摘要:本文主要介绍vue-router传参数的两种方式: 1、get方式 页面跳转 this.$router.push({path:'/xxx',query:{id:1}});//类似get传参,通过URL传递参数 新页面接收参数 this.$route.query.id 2、post方式 页面跳转 //
阅读全文
摘要:<div id="app"> <p>{{count}}</p> <p> <button @click="addclick">+</button> <button @click="reduceclick">-</button> </p> </div> let store = new Vuex.Store({ state:{ count:0 }, mutations:{ add:state => st
阅读全文
摘要:触发的自定义事件要放到注册的组件上 1通过点击: <div id="app"> <div v-text="money" @click="reduce"></div> <child :m="money" @zdyclick="add"></child> </div> <template id="tem
阅读全文
摘要:文章转自:https://segmentfault.com/a/1190000019722221?utm_source=tag-newest 因为是第一次在segmentfault上面写文章,所以有很多格式调不对,导致这篇文章看着很乱,很多序号也是不对的如果喜欢这篇文章的话大家可以看我在CDSN上的
阅读全文
摘要:[v-cloak]{display: none;} .mask{ width: 100%; height: 100%; position: fixed; top: 0; left: 0; background-color: rgba(0,0,0,.25); } .dialog{ width: 400px; height: 200px...
阅读全文
摘要:<div id="app">{{a}}</div> <script> //生命周期: //beforeCreate created 出生之前,出生之后 //beforeMount mounted 挂载之前,挂载完成 //beforeUpdate updated 更新之前,更新之后 //beforeD
阅读全文

浙公网安备 33010602011771号