打赏

2019年12月25日

摘要: 1. 入口文件index.js import Vuex from 'vuex' import Vue from 'vue' import modulesA from './modules/modulesA' // 注册vuex到vue中 Vue.use(Vuex) const state = { c 阅读全文
posted @ 2019-12-25 22:31 jlyuan 阅读(167) 评论(0) 推荐(0) 编辑

2019年12月18日

摘要: main.js 是 配置文件,data-main 是异步加载,如果在main.js未加载完成的时候,使用了require去加载文件,就会导致配置无效 main.js 阅读全文
posted @ 2019-12-18 22:46 jlyuan 阅读(614) 评论(0) 推荐(0) 编辑

2019年12月13日

摘要: 有时候页面会先出现源码,再显示解析的内容。可以通过v-cloak解决 v-cloak 这个指令会作为元素的一个属性一直保持到vue实例编译结束,即解析后移除此指令。 /* 含有v-cloak的html元素不显示 */ [v-cloak]{ display:none; } <!-- v-cloak指令 阅读全文
posted @ 2019-12-13 23:07 jlyuan 阅读(355) 评论(0) 推荐(0) 编辑

2019年12月12日

摘要: function getUrlArg(url,key){ var arr = url.split('?'); var argStr = arr.length >1 ? arr[1]:""; if(!argStr){ return ""; } var arr2 = argStr.split('&'). 阅读全文
posted @ 2019-12-12 21:35 jlyuan 阅读(1042) 评论(0) 推荐(0) 编辑

2019年12月2日

摘要: <template> <div class="com"> <el-drawer title="我是标题" :visible.sync="drawer_" :direction="direction"> <span>我来啦! {{task.name}}</span> </el-drawer> </di 阅读全文
posted @ 2019-12-02 23:02 jlyuan 阅读(6205) 评论(0) 推荐(0) 编辑

2019年11月26日

摘要: this 通常指向调用者,即谁调用指向谁。 场景1: var a = 2; function fn() { console.log(this.a); } var obj = { a:123, fn:fn } fn(); // 2 this指向window obj.fn(); // 123 this指 阅读全文
posted @ 2019-11-26 23:56 jlyuan 阅读(213) 评论(0) 推荐(0) 编辑

2019年11月25日

摘要: 个人理解 闭包:函数内部定义一个函数,内部函数可以访问外包函数定义的变量。 闭包的特点:变量长驻内存 demo实现一个类似函数调用计数器功能: function fn(){ var c = 0; function inner(){ c += 1; console.log(c) } return in 阅读全文
posted @ 2019-11-25 23:44 jlyuan 阅读(172) 评论(0) 推荐(0) 编辑

2019年11月20日

摘要: 简而言之,作用域插槽就是让插槽内容能够访问子组件中的数据。 案例如下:有CurUser组件 <template> <span> <!-- 在slot 元素上绑定user,让父组件插槽能够访问 --> <slot :user="user"></slot> </span> </template> <sc 阅读全文
posted @ 2019-11-20 23:27 jlyuan 阅读(337) 评论(0) 推荐(0) 编辑

2019年11月19日

摘要: 1.实现盒子的水平垂直居中 .parent{ width:200px; height:200px; display:flex; align-items: center; justify-content: center; border:1px solid black; } .child{width:1 阅读全文
posted @ 2019-11-19 23:48 jlyuan 阅读(244) 评论(0) 推荐(0) 编辑

2019年11月14日

摘要: 父组件通过 props 传值给子组件,子组件通过 $emit 来通知父组件修改相应的props值,子组件可以通过watch监听父组件值变化。案例如下: 1.子组件 <template> <div class="com"> <input type="text" @input="inputChange" 阅读全文
posted @ 2019-11-14 23:14 jlyuan 阅读(155) 评论(0) 推荐(0) 编辑

导航