
Vue
Jane_96
谁说妹子不可以写代码的
展开
-
Vue源码解读2——Vue实例挂载实现
以src/platform/web/entry-runtime-with-compiler.js中的$mount为例 // 缓存了原型上的 $mount 方法,再重新定义该方法 const mount = Vue.prototype.$mount Vue.prototype.$mount = function ( el?: string | Element, hydrating?: boolean ): Component { el = el && query(el) ..原创 2020-10-18 11:06:12 · 423 阅读 · 0 评论 -
Vue源码解读1—— 定义
Vue 定义 entry-runtime-with-compiler.js文件为入口 runtime/index:在 Vue 原型上挂载了__patch__、$mount方法 core/index:注册全局 api,Vue.prototype 添加$isServer,$ssrContext,FunctionalRenderContext属性 instance/index:定义 Vue function initMixin方法定义Vue.prototype._init Vue.prototype._ini原创 2020-10-12 16:23:43 · 259 阅读 · 0 评论 -
vue refs 报错 Property 'getSectionIds' does not exist on type 'Vue | Element | Vue[] | Element[]'.
在父组件中用refs去获取子组件内部的方法或者属性,以下面的demo为例,直接写this.$refs.childRef.getValue() 会报错,报错内容说’Vue | Element | Vue[] | Element[]'a这些类型中,没有我们调用的属性。但是我们很清楚,这个childRef的类型是ChildComponent,这个类型中是含有我们所需要的变量或者方法,因此给this.$r...原创 2019-12-06 16:24:35 · 1885 阅读 · 0 评论 -
解决vue-router 中,重复点击同一个路由,控制台报错:"Navigating to current location (XXX) is not allowed"
解决方式: 在push语句中添加catch捕捉错误 router.push('your-path').catch(err => {}) 详细信息: https://github.com/vuejs/vue-router/issues/2872原创 2019-12-06 11:05:32 · 1048 阅读 · 1 评论