Directives allow us to apply DOM manipulations as side effects. We’ll show you how you can create your own Vue directive to change a component’s colors and type-safe it with TypeScript. We’ll additionally show how you can pass objects to your directi…
We’ve used @Watch, @Inject and more decorators from vue-property-decorator. In this lesson however we will guide you through creating your own decorators in order to add common functionality to your Vue components using TypeScript. Import: import {cr…
With properties we can follow a one-way parent→child flow communication between components. This lesson shows you how you can pass down properties to class based Vue components by using the @Prop decorator from vue-property-decorator. We’ll also see…
vue bug & data type bug [Vue warn]: Invalid prop: type check failed for prop "value". Expected String, Number, got Null https://github.com/xgqfrms/vue/issues/50 shit bug OK https://github.com/vuejs/vue/issues/5163 https://stackoverflow.com/q…
Tip: 为了避免浪费您的时间,本文符合满足以下条件的同学借鉴参考 1.本文模版不适用于小型项目,两三个页面的也没必要用vue2.对typescript.vue全家桶能够掌握和运用 此次项目模版主要涉及的技术框架: vue2.5 vuex3.0 vue-router3.0 axios typescript3.2 Tip: 由于vue-cli3.0帮我们简化了webpack的配置,我们只需要在根目录下的vue.config.js文件的chainWebpack进行配置即可. 接下来进入正题(前提是你…
vue-router introduces new hooks into the component. In this lesson we’ll show you how to use these new hooks in your class based Vue components in TypeScript. We’ll also go over how we can create and use routes in Vue. Default component: <template>…
1.使用官方脚手架构建 新的 VueCLI工具允许开发者 使用 TypeScript 集成环境 创建新项目. 只需运行 vue createmy-app. 然后,命令行会要求选择预设.使用箭头键选择 Manuallyselectfeatures. 接下来,只需确保选择了 TypeScript和 Babel选项,如下图: 完成此操作后,它会询问你是否要使用 class-style component syntax. 然后配置其余设置,使其看起来如下图所示. Vue CLI工具现在将安装所有依赖项并…
vue.esm.js?efeb:628 [Vue warn]: Invalid prop: type check failed for prop "defaultActive". Expected String with value "0", got Number with value 0. 问题解决:active:"0", 0加上双引号即可.  <el-menu :default-active="navBar.active&qu…
Vue源码学习二 是对Vue的原型对象的包装,最后从Vue的出生文件导出了 Vue这个构造函数 来到 src/core/index.js 代码是: import Vue from './instance/index' import { initGlobalAPI } from './global-api/index' import { isServerRendering } from 'core/shared/env' import { FunctionalRenderContext } fro…
目录 前言 1. 初始化流程概述图.代码流程图 1.1 初始化流程概述 1.2 初始化代码执行流程图 2. 初始化相关代码分析 2.1 initGlobalAPI(Vue) 初始化Vue的全局静态API 2.2 定义Vue构造函数.实例方法 2.3 new Vue(options) 2.4 执行 $mount 进行挂载 2.5 执行 _render 生成 vnode 2.5 执行update将vnode转化为真实DOM 3. 代码调试 demo示例 debug:找到断点入口 debug:添加实例…