随笔分类 -  vue

摘要:Objects 和 maps 的比较: Object的键只能是字符串或者 Symbols,但 Map 的键可以是任意值,包括函数、对象、基本类 型。 Map 中的键值是有序的,而添加到 Object 对象中的键则不是。因此,当对它进行遍历时,Map 对象是按插入的顺序返回键值。 可以通过 size  阅读全文
posted @ 2021-04-26 08:59 浅笑19 阅读(9089) 评论(0) 推荐(0) 编辑
摘要:简单的定义 const numArr:number[]=[1,2,3] const strArr:string[]=['a','b','c'] const undeArr:undefined[]=[undefined,undefined] 数组中有字符串又有数组的类型 const arr:(numb 阅读全文
posted @ 2021-04-26 08:56 浅笑19 阅读(208) 评论(0) 推荐(0) 编辑
摘要:for..in loops iterate over the entire prototype chain, which is virtually never what you want. 意思是使用for..in会遍历整个原型链,这样不是很好的实现方法,推荐使用Object.keys formRu 阅读全文
posted @ 2021-04-26 08:54 浅笑19 阅读(520) 评论(0) 推荐(0) 编辑
摘要:ESLint模式下for in遍历对象会报错,可以这样解决: let val = { shu: [1, 2, 3] }; for (let item in val) { if (val.hasOwnProperty(item)) { console.log(item); } } 因为我们在遍历一个对 阅读全文
posted @ 2021-04-26 08:51 浅笑19 阅读(1943) 评论(0) 推荐(0) 编辑
摘要:import moment from 'moment'; moment.locale('zh-cn');或者moment.lang('zh-cn');即可显示中文 阅读全文
posted @ 2021-04-26 08:46 浅笑19 阅读(190) 评论(0) 推荐(0) 编辑
摘要:我们在开发前端时,经常用 npm 命令下载第三方 Node.js 包。 但是 npm 的镜像仓库在国外,在国内访问速度非常慢,有时候遇到大的包,可能下载半天都下载不完。 如果 npm 镜像服务器在中国就好了。 好巧,阿里团队就干了这事,把 npm 镜像直接克隆到国内服务器上,也就是 cnpm。 我们 阅读全文
posted @ 2021-04-01 09:24 浅笑19 阅读(953) 评论(0) 推荐(0) 编辑
摘要:(default) No default Boot2Docker ISO found locally, downloading the latest release...Error with pre-create check: "Get https://api.github.com/repos/bo 阅读全文
posted @ 2021-01-27 21:04 浅笑19 阅读(587) 评论(0) 推荐(0) 编辑
摘要:const Foo = { template: `...`, beforeRouteEnter (to, from, next) { // 在渲染该组件的对应路由被 confirm 前调用 // 不!能!获取组件实例 `this` // 因为当守卫执行前,组件实例还没被创建 }, beforeRou 阅读全文
posted @ 2021-01-08 18:56 浅笑19 阅读(674) 评论(0) 推荐(0) 编辑
摘要:1.切换进入当前路由之前的钩子函数 beforeRouteEnter <script> export default { beforeRouteEnter(to, form, next) { next() } } </script> 2.离开当前路由之前的钩子函数 beforeRouteLeave 阅读全文
posted @ 2021-01-08 18:51 浅笑19 阅读(4149) 评论(0) 推荐(0) 编辑
摘要:1:配置路径rutes export default new Router({ routes: [ { path: '/testVueRouter', name: 'TestVueRouter', component: TestVueRouter }, { path: '/testVueRouter 阅读全文
posted @ 2021-01-08 16:46 浅笑19 阅读(172) 评论(0) 推荐(0) 编辑
摘要:// 解决方法 computed: { heandletState: { get() { return this.$store.getters.heandletState; }, // 写出来不实现 set(val) { console.log("vid", val); } } }, 阅读全文
posted @ 2021-01-07 19:04 浅笑19 阅读(294) 评论(0) 推荐(0) 编辑
摘要:安装引入基础使用部分 请移步:https://juejin.cn/post/6844903989641740296 相关事件方法: // 加载视频 // this.$refs.videoPlayer.player.load(); // 播放视频 // this.$refs.videoPlayer.p 阅读全文
posted @ 2021-01-07 12:55 浅笑19 阅读(2377) 评论(0) 推荐(1) 编辑
摘要:// get~ 销毁组件 destroyElement() { this.$destroy(true); this.$el.parentNode.removeChild(this.$el); }, 阅读全文
posted @ 2021-01-06 21:06 浅笑19 阅读(1004) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示