Vue-learning

vue.js学习路径

Vue的API地图

点击查看vue的API地图

视图层

点击可直接到达详情页面

指令

样式

特殊特性

过渡动画

模板形式

逻辑层

通用配置选项option

生命周期钩子函数

组件 Component

  1. 组件的概念

  2. 组件的构建和注册

    • 构建:com = Vue.extend(option)
    • 注册:Vue.component('my-com', com) / vm.components: {'my-com': com}
    • 语法糖: Vue.component('my-com',option) vm.components('my-com': option)
    • 组件命名规范
  3. 组件三大API: prop / event / slot

    prop

    • 字符串数组形式: props: ['prop1', 'prop2', ...]
    • 对象形式: type / required / defalut / validator
    • prop的命名规范
    • 动态prop(除字符串外,其它类型传入都需要使用动态prop,即v-bind绑定)
    • 单向数据流
    • 非prop特性: inheritAttr: false; / $attrs

    event

    • v-on / $on 监听事件
    • $once 一次性事件
    • $emit 触发事件
    • $off 卸载事件监听
    • $listeners v-on绑定监听器集合(除原生监听事件)
    • .native 原生事件修饰符
    • .sync 双向绑定修饰符
    • model 属性

    slot

    • 普通插槽
      <slot></slot>
    • 插槽提供默认值
      <slot>default content</slot>
    • 具名插槽
      <slot name="someName"></slot>
      <!-- 组件调用 -->
      <my-com>
      <template v-slot:somName></template>
      <my-com>
    • 作用域插槽
      <slot :prop="value"></slot>
      <!--组件调用 -->
      <my-com>
      <template v-slot='childValue'>{{ cilidValue.value}}</template>
      </my-com>
    • 独占默认插槽的写法
      <some-component v-slot="childValue"> {{ childValue.value }}</some-component>
      <some-component v-slot:default="childValue"> {{ childValue.value }}</some-component>
    • 解构插槽prop
      <my-com v-slot="{value}">{{ value }}</my-com>
      <!-- 重命名 -->
      <my-com v-slot="{value: otherName}">{{ otherName }}</my-com>
      <!-- 重命名并提供默认值 -->
      <my-com v-slot="{value: {otherName: defaultValue}}">{{ otherName }}</my-com>
    • 动态插槽名
      <my-com>
      <template v-slot:[dynamicSlotName]></template>
      </my-com>
    • v-slot 的简写 #
      <my-com>
      <template #:somName></template>
      <my-com>
    • 模板编译作用域 和 插槽作用域
  4. 组件实例的调用

    • ref
    • $root
    • $parent
    • $children
  5. 组件间的通信

    • 父子组件通信 prop / $emit
    • 三层嵌套组件 $attrs / $liteners
    • 后代组件通信 provide / inject
    • 组件实例引用 $root / $parent / $children / $refs
    • 事件总线 const Bus = new Vue()
    • 状态管理器 Vuex
  6. 动态组件is

  7. 异步组件工厂函数

  8. 函数式组件functional

  9. 内置组件transiton / keep-alive

  10. 其它

    • 组件的递归调用
    • 组件的循环引用
    • v-once创建静态组件

路由 Vue-router

  1. 前端路由历史

    1. 服务端渲染(SSR:server side render)
    2. 客户端路由(client side routing)
  2. 前端路由实现原理
    1. hash模式: location.hash 和 hashChange事件
    2. history模式: history 和 popstate事件
  3. vue-router
    1. const router = new VueRouter(option)中的选项对象option
    2. 路由器实例对象router
    3. 路由对象route
    4. router-link标签的特性
    5. router-view标签的特性
  4. 路由传参的5种方式

    1.路由动态参数: '/user/:userId'和params
    const route = {path: '/user/:userId'}
    this.$router.push({path:`/user/${userId}`})
    this.$route.params.userId

    2.命名路由传参,使用name和params

    const route = {name:'home',...}
    this.$router.push({name:'Login',params:{id:'leelei'}})
    this.$route.params.id

    3.查询参数传参,使用path和query

    this.$router.push({path:'/login',query:{id:'leelei'})
    this.$route.query.id

    4.prop形式:布尔/对象/函数

    const route = [{prop:true, ...}]
    const route = [{prop: {someProp:'someValue'}]
    const routes =[{props: (route) => ({ query: route.query.q }),...}]
    1. meta元信息定义数据
    // 定义路由时,定义元信息
    const routes = [
    {meta: {someData:'someData'},... },
    // 获取数据
    this.$route.meta.someData
  5. 从路由中获取组件实例
    const matchedComponents: Array<Component> = this.$router.getMatchedComponents(location?)

状态管理 Vuex

  1. 状态管理的概念
  2. vuex基本使用
  3. Vuex对象
  4. option选项
  5. store实例对象的属性: state, getters
  6. store实例对象的方法
    1. commit / dispatch
    2. 注册和卸载plugin的方法
    3. 注册和卸载Module的方法
    4. vuex的辅助函数: mapState / mapGetters / mapMutaions / mapActions
  7. vuex的项目结构组织

单元测试 vue-test-utils

项目构建vue-cli

进阶内容

  • 响应式原理
  • 虚拟DOM
  • 模板编译原理
  • Vue APIvm API

vue-learning:0 - 目录的更多相关文章

  1. Vue 2.0 + Vue Router + Vuex

    用 Vue.js 2.x 与相配套的 Vue Router.Vuex 搭建了一个最基本的后台管理系统的骨架. 当然先要安装 node.js(包括了 npm).vue-cli 项目结构如图所示: ass ...

  2. vue(2.0)+vue-router(2.0)+vuex(2.0)实战

    好久没更新自己的知识库,刚好借双十一的契机,用上了vue(2.0)+vue-router(2.0)+vuex(2.0)来开发公司的双十一电商活动. 项目目录结构: 运行: npm install np ...

  3. vue 3.0 体验,vue 3.0新特性

    前言 昨天不是尤雨溪 不是刚在B站 直播玩了,分享了vue-next v3.0.0-beta.1 版本 哈哈, 不要太刺激哦 6大亮点 Performance:性能更比Vue 2.0强. Tree s ...

  4. 重磅来袭 Vue 3.0 One Piece 正式发布

    代号为One Piece 的Vue3.0 在9月19日凌晨正式发布!! 此次vue3.0 为用户提供了全新的 composition-api 以及更小的包大小,和更好的 TypeScript 支持. ...

  5. 使用 Vue 2.0 实现服务端渲染的 HackerNews

    Vue 2.0 支持服务端渲染 (SSR),并且是流式的,可以做组件级的缓存,这使得极速渲染成为可能.同时, 和 2.0 也都能够配合 SSR 提供同构路由和客户端 state hydration.v ...

  6. 新手入门指导:Vue 2.0 的建议学习顺序

    起步 1. 扎实的 JavaScript / HTML / CSS 基本功.这是前置条件. 2. 通读官方教程 (guide) 的基础篇.不要用任何构建工具,就只用最简单的 <script> ...

  7. vue 2.0 无法编译ES6语法

    # vue2.0 webpack 无法编译 ES6 语法 之前在使用 vue 1.x 时用 vue-loader@8.0.0 版本可以正常打包vue的代码,包括ES6语法也能正常转为ES5语法,但是当 ...

  8. Vue 2.0初学后个人总结及分享

    摘要:最近在上海找工作,发现Vue前景还不错,于是就打算先学习一下(之前了解过,但是一直没提到日程上)这篇随笔当是为了自己学习之后,做一个小的阶段性总结.希望本文的内容对于刚开始接触vue的朋友们有点 ...

  9. Arcade初探[0] 目录与导航

    2017年6月,ESRI开发者页面出现了一个新玩意儿:Arcade. 连接:点我 这是什么东西呢?有什么用呢? 1. 是什么 Arcade一种表达语言,可以在ArcGIS平台上使用.不管是编写简单的脚 ...

  10. 《vue.js2.0从入门到放弃》学习之路

    原文地址: Vue.js2.0从入门到放弃---入门实例(一):http://blog.csdn.net/u013182762/article/details/53021374 Vue.js2.0从入 ...

随机推荐

  1. TZOJ4777: 方格取数

    4777: 方格取数  Time Limit(Common/Java):1000MS/3000MS     Memory Limit:65536KByteTotal Submit: 11       ...

  2. 2018-8-29-Roslyn-通过-Target-修改编译的文件

    title author date CreateTime categories Roslyn 通过 Target 修改编译的文件 lindexi 2018-08-29 09:10:46 +0800 2 ...

  3. 小爬爬1:开篇&&简单介绍启动

    1.第一阶段的内容 2.学习的方法? 思考,总结,重复 3.长大了意味着什么?家庭的责任,真的很重 4.数据分析&&数据清洗 numpy&&pandas&&am ...

  4. 2019-4-10-VisualStudio-2019-尝试使用-C#-8.0-新的方式

    title author date CreateTime categories VisualStudio 2019 尝试使用 C# 8.0 新的方式 lindexi 2019-04-10 10:41: ...

  5. python 局部变量

  6. UVA_10071:Back to High School Physics

    Language:C++ 4.8.2 #include<stdio.h> int main(void) { int v, t; while(scanf("%d%d", ...

  7. 洛谷2387 BZOJ3669魔法森林题解

    题目链接 BZ链接 这道题被很多人用spfa水了过去,表示很... 其实spfa很好卡,这组数据可以卡掉大多数spfa 链接:密码:rjvk 这里讲一下LCT的做法 我们按照a将边排序,然后依次添加 ...

  8. nginx设置301永久重定向

    https://blog.csdn.net/wzqzhq/article/details/53376501 比如说我的域名有多个,一个主域名www.zq110.com,多个次域名:www.aaa.co ...

  9. C++中用stringstream类进行数据类型的转换

    我们在进行C++编程过程中,经常需要进行数据类型的转换. stringstream 类的作用就是进行数据类型转换.要想在程序中使用 stringstream 类,我们需要在源程序文件中包含头文件inc ...

  10. Python collections的使用

    collections是Python内建的一个集合模块,提供了许多有用的集合类. 本文将介绍以下几种方法: namedtuple Counter() deque OrderedDict 一.named ...