- 博客(6)
- 收藏
- 关注
原创 vue自定义指令v-* 实现数量递进效果
使用方法:<span v-endNum="users">0</span> 无需使用任何插件,轻松get ~
2022-05-09 17:19:47
296
原创 扁平化数组、数组转化、数组去重、数组取最大值
扁平化n维数组 [1,[2,3]].flat(2) //[1,2,3] [1,[2,3,[4,5]].flat(3) //[1,2,3,4,5] [1[2,3,[4,5[...]].flat(Infinity) //[1,2,3,4...n] 数组去重 Array.from(new Set([1,2,3,3,4,4])) //[1,2,3,4] [...new Set([1,2,3,3,4,4])] //[1,2,3,4] set是ES6新出来的一种一种定义不重复数组的数据类型。 Array
2022-05-09 17:11:55
192
原创 vue 中 连续点击按钮防止多次提交
//防抖,重复提交 debounceFn(fn, t) { let delay = t || 1000 // let timer return () => { let args = arguments; if (this.timer) { clearTimeout(this.timer) } let callNow = !this.timer this.timer = se...
2022-05-09 16:49:24
464
原创 vue的状态管理vuex 刷新之后为什么重置状态,如何保存刷新后状态
可以把组件的共享状态抽取出来,以一个全局单例模式管理 因为store里的数据是保存在运行内存中的,当页面刷新时,页面会重新加载vue实例,store里面的数据就会被重新赋值。 export default { name: 'App', created () { //在页面加载时读取sessionStorage里的状态信息 if (sessionStorage.getItem("store") ) { this.$store.replaceState(Object.assign({}, this
2022-05-09 16:25:39
551
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅
1