摘要: vue总线机制(bus) vue中非父子组件之间通信除了使用vuex,也可以通过bus总线,两者适用场景不同。 bus适合小项目、数据被更少组件使用的项目,对于中大型项目 数据在很多组件之间使用的情况 bus就不太适用了。bus其实就是一个发布订阅模式,利用vue的自定义事件机制,在触发的地方通过$ 阅读全文
posted @ 2021-03-30 17:50 bugSource 阅读(502) 评论(0) 推荐(0) 编辑
摘要: ###官网:http://www.sortablejs.com/index.html Sortable.js是一款轻量级的拖放排序列表的js插件。支持ie9及以上版本ie浏览器和现代浏览器,也可以运行在移动触摸设备中。不依赖jQuery。支持 Meteor、AngularJS、React、Vue、K 阅读全文
posted @ 2021-03-30 15:15 bugSource 阅读(330) 评论(0) 推荐(0) 编辑
摘要: 记录el-upload实现上传图片的过程 GitHub项目Demo地址:https://github.com/Beingyo/vue-test-template/tree/main/src/page/imgElUpload 示例: 代码: <template> <div> <el-upload cl 阅读全文
posted @ 2021-03-30 13:48 bugSource 阅读(210) 评论(0) 推荐(0) 编辑
摘要: 记录一个刷新后仍然有效的倒计时demo GitHub项目Demo地址:https://github.com/Beingyo/vue-test-template/tree/main/src/page/countDown 示例: 代码: <template> <div style="width: 100 阅读全文
posted @ 2021-03-29 15:01 bugSource 阅读(27) 评论(0) 推荐(0) 编辑
摘要: 获取本地时间 输出格式为:2021-03-29 00:00:00 代码如下 var date = new Date() var YY = date.getFullYear() + '-' var MM = (date.getMonth() + 1 < 10 ? '0' + (date.getMont 阅读全文
posted @ 2021-03-29 14:43 bugSource 阅读(263) 评论(0) 推荐(0) 编辑
摘要: 前言 整理几种props的使用方式 第一种 传递一个数组 props:["cont"] 第二种 传递一个对象 props:{ uploadOption:{ type:Object, //参数类型必须是一个对象 required: true //这一种说明这个参数是必须的哈 } } 第三种 整理各类型 阅读全文
posted @ 2021-03-29 14:20 bugSource 阅读(684) 评论(0) 推荐(0) 编辑
摘要: GitHub项目Demo地址:https://github.com/Beingyo/vue-test-template/tree/main/src/page/clickChangeStyle 示例: 思路:通过点击事件把对应的index赋值给nowIndex,通过:class把nowIndex = 阅读全文
posted @ 2021-03-29 14:09 bugSource 阅读(1007) 评论(0) 推荐(0) 编辑
摘要: 调用搜狐接口获取用户ip地址 ####GitHub项目Demo地址:https://github.com/Beingyo/vue-test-template/tree/main/src/page/getUserIP ####示例: 代码: <template> <div style="width: 阅读全文
posted @ 2021-03-29 13:58 bugSource 阅读(148) 评论(0) 推荐(0) 编辑
摘要: ###获取近一周时间 var end = new Date(); var year = end.getFullYear(); var month = end.getMonth() + 1;//0-11表示1-12月 var day = end.getDate(); var dateObj = {}; 阅读全文
posted @ 2021-03-29 13:40 bugSource 阅读(2880) 评论(0) 推荐(0) 编辑
摘要: 记录三种类型数据去重的处理方法 ###1、单个数组内部 // 去重,对{}无效 var string= [1,1,'true','true',true,true,15,15,false,false, undefined,undefined, null,null, NaN, NaN,'NaN', 0, 阅读全文
posted @ 2021-03-29 11:51 bugSource 阅读(150) 评论(0) 推荐(0) 编辑