定 价:¥69.00
作 者: | (英)卡勒姆·麦克雷 |
出版社: | 电子工业出版社 |
丛编项: | |
标 签: | 暂缺 |
ISBN: | 9787121352997 | 出版时间: | 2018-11-01 | 包装: | 平装 |
开本: | 16开 | 页数: | 196 | 字数: |
前言 .............................................................................................xi
第 1 章 Vue.js 基础 .......................................................................1
为什么选择 Vue.js ..................................................................................................1
安装和设置 ............................................................................................................4
vue-loader 和 webpack .....................................................................................4
模板(Template)、数据(Data)和指令(Directive)...........................................6
v-if vs v-show .......................................................................................................10
模板中的循环 ......................................................................................................11
属性绑定 ..............................................................................................................13
响应式 ..................................................................................................................15
响应式如何实现 ............................................................................................16
注意事项 .......................................................................................................17
双向数据绑定 ......................................................................................................19
动态设置 HTML ..................................................................................................21
方法 .....................................................................................................................22
this.................................................................................................................23
计算属性 ..............................................................................................................24
侦听器 ..................................................................................................................27
监听 data 对象中某个对象的属性 .................................................................29
获取旧值 .......................................................................................................29
深度监听 .......................................................................................................30
过滤器 ..................................................................................................................30
使用 ref 直接访问元素 .........................................................................................33
输入和事件 ..........................................................................................................33
v-on 简写 .......................................................................................................34
事件修饰符 ...................................................................................................34
生命周期钩子 ......................................................................................................37
自定义指令 ..........................................................................................................38
钩子函数参数 ................................................................................................40
过渡和动画 ..........................................................................................................41
CSS 过渡 .......................................................................................................41
JavaScript 动画 ..............................................................................................44
总结 .....................................................................................................................46
第 2 章 Vue.js 组件 .....................................................................47
组件基础 ..............................................................................................................47
数据、方法和计算属性 ........................................................................................48
传递数据 ..............................................................................................................49
Prop 验证 .......................................................................................................50
Prop 的大小写 ...............................................................................................51
响应式 ...........................................................................................................52
数据流和 .sync 修饰符 ..................................................................................53
自定义输入组件与 v-model ...........................................................................56
使用插槽(slot)将内容传递给组件 ...................................................................57
默认内容 .......................................................................................................58
具名插槽 .......................................................................................................59
作用域插槽 ...................................................................................................60
自定义事件 ..........................................................................................................62
混入 .....................................................................................................................65
混入对象和组件的合并 .................................................................................67
vue-loader 和 .vue 文件 ........................................................................................68
非 Prop 属性 ........................................................................................................70
组件和 v-for 指令 ................................................................................................71
总结 .....................................................................................................................74
第 3 章 使用 Vue 添加样式 ..........................................................77
Class 绑定 ............................................................................................................77
内联样式绑定 ......................................................................................................79
数组语法 .......................................................................................................80
多重值 ...........................................................................................................80
用 vue-loader 实现 Scoped CSS ...........................................................................81
用 vue-loader 实现 CSS Modules .........................................................................82
预处理器 ..............................................................................................................83
总结 .....................................................................................................................83
第 4 章 render 函数和 JSX ..........................................................85
标签名称 ..............................................................................................................86
数据对象 ..............................................................................................................86
子节点 ..................................................................................................................88
JSX ......................................................................................................................89
总结 .....................................................................................................................91
第 5 章 使用 vue-router 实现客户端路由 ......................................93
安装 .....................................................................................................................93
基本用法 ..............................................................................................................94
HTML5 History 模式 ...........................................................................................96
动态路由 ..............................................................................................................97
响应路由变化 ................................................................................................98
路由参数作为组件属性传入 .......................................................................100
嵌套路由 ............................................................................................................101
重定向和别名 ....................................................................................................103
链接导航 ............................................................................................................104
tag 属性 .......................................................................................................105
active-class 属性 ..........................................................................................106
原生事件 .....................................................................................................107
编程式导航 .................................................................................................107
导航守卫 ............................................................................................................108
路由独享守卫 ..............................................................................................110
组件内部守卫 .............................................................................................. 111
路由顺序 ............................................................................................................112
404 页面 ......................................................................................................113
路由命名 ............................................................................................................114
总结 ...................................................................................................................115
第 6 章 使用 vuex 实现状态管理 ................................................117
安装 ...................................................................................................................118
概念 ...................................................................................................................119
State 及其辅助函数 ............................................................................................121
State 辅助函数.............................................................................................122
Getter .................................................................................................................124
Getter 辅助函数 ...........................................................................................126
Mutation .............................................................................................................126
Mutation 辅助函数 ......................................................................................128
Mutation 必须是同步函数 ...........................................................................128
Action ................................................................................................................129
Action 辅助函数 ..........................................................................................130
参数解构 .....................................................................................................131
Promise 与 Action ..............................................................................................131
Module ...............................................................................................................132
文件结构 .....................................................................................................134
带命名空间的模块 ......................................................................................135
总结 ...................................................................................................................137
第 7 章 对 Vue 组件进行测试 .....................................................139
测试单个组件 ....................................................................................................139
介绍 vue-test-utils ..............................................................................................141
查询 DOM ..........................................................................................................142
挂载选项 ............................................................................................................143
模拟和存根数据 .................................................................................................145
测试事件 ............................................................................................................146
总结 ...................................................................................................................148
附录 A 搭建 Vue 开发环境 .........................................................149
附录 B Vue 与 React ................................................................153
索引 ..........................................................................................171