摘要: 1.官方路由 对于大多数单页面应用,都推荐使用官方支持的 vue-router 库。 1.1 入门 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <style> .router-link-active { color: red; } </s 阅读全文
posted @ 2021-01-22 17:27 gzhjj 阅读(120) 评论(0) 推荐(0) 编辑
摘要: 1.介绍 使用Vue.component定义全局组件,使用new Vue({ el: '#container '})为每个页面指定一个容器元素。 这种方式的缺点是: 每个组件的命名不得重复 字符串模板缺乏语法高亮,在HTML有多行的时候,需要用到丑陋的\ 当HTML和JavaScript组件化时,C 阅读全文
posted @ 2021-01-22 16:13 gzhjj 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 插件通常用来为 Vue 添加全局功能。 添加全局方法或者属性。 添加全局资源:指令/过滤器/过渡等。 通过全局混入来添加一些组件选项。 添加 Vue 实例方法,通过把它们添加到 Vue.prototype 上实现。 一个库,提供自己的 API,同时提供上面提到的一个或多个功能。如 vue-route 阅读全文
posted @ 2021-01-22 15:39 gzhjj 阅读(117) 评论(0) 推荐(0) 编辑
摘要: 1. 计算属性和侦听器 1.1 计算属性 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <script src="https://cdn.staticfile.org/vue/2.4.2/vue.min.js"></script> </he 阅读全文
posted @ 2021-01-22 15:19 gzhjj 阅读(101) 评论(0) 推荐(0) 编辑
摘要: 1.模板语法 1.1 双大括号 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <script src="https://cdn.staticfile.org/vue/2.4.2/vue.min.js"></script> </head> < 阅读全文
posted @ 2021-01-22 15:10 gzhjj 阅读(155) 评论(0) 推荐(0) 编辑
摘要: 1.自定义指令 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <style> </style> <script src="https://cdn.staticfile.org/vue/2.4.2/vue.min.js"></script> 阅读全文
posted @ 2021-01-22 11:51 gzhjj 阅读(145) 评论(0) 推荐(0) 编辑
摘要: 1.混入 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <style> </style> <script src="https://cdn.staticfile.org/vue/2.4.2/vue.min.js"></script> </h 阅读全文
posted @ 2021-01-22 11:33 gzhjj 阅读(143) 评论(0) 推荐(0) 编辑
摘要: 4.模板定义的替代品 4.1 内联模板 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <style> .baseCss { border: 5px solid red; padding: 2rem; } </style> <script s 阅读全文
posted @ 2021-01-22 11:27 gzhjj 阅读(118) 评论(0) 推荐(0) 编辑
摘要: 1.访问元素 & 组件 1.1 访问根实例 我们可以通过$root属性访问根实例。 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <style> </style> <script src="https://cdn.jsdelivr.net/ 阅读全文
posted @ 2021-01-22 11:24 gzhjj 阅读(207) 评论(0) 推荐(0) 编辑
摘要: 1.动态组件 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <style> #app { font-size: 0 } .dynamic-component-demo-tab-button { padding: 6px 10px; bord 阅读全文
posted @ 2021-01-22 10:50 gzhjj 阅读(763) 评论(0) 推荐(0) 编辑
摘要: 1.插槽 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <style> </style> <script src="https://cdn.staticfile.org/vue/2.4.2/vue.min.js"></script> </h 阅读全文
posted @ 2021-01-22 10:31 gzhjj 阅读(285) 评论(0) 推荐(0) 编辑