摘要: vue store存储commit和dispatch this.$store.commit('toShowLoginDialog', true); this.$store.dispatch('toShowLoginDialog',false) 主要区别是: dispatch:含有异步操作,例如向后台提交数据,写法: this.$store.dispatch('mutations方法名',值) commit:同步操作,写法:this.$store.commit('mutations方法名',值) 例如:登录成功后读取用户信息写到coikie里 阅读全文
posted @ 2019-02-01 14:38 大自然的流风 阅读(31324) 评论(0) 推荐(1) 编辑
摘要: 懒加载是如何实现的? 找到一个不需要知道图片宽高的懒加载方法了(经过实际测试,不加宽高仍然是无法正常加载的,设置height:auto,height:100%,仍然显示高度为0) dinbror/blazy: Hey, be lazy! bLazy.JS is a lightweight pure JavaScript script for lazy loading and multi-serving images. It's working in all modern browsers including IE7+. https://github.com/dinbror/blazy#demo 这个兼容性比较好 注:vuejs,react有对应的懒加载插件 阅读全文
posted @ 2019-02-01 11:32 大自然的流风 阅读(1408) 评论(0) 推荐(0) 编辑