上一页 1 2 3 4 5 6 7 8 ··· 15 下一页
摘要: Unknown custom element: <blog-post> - did you register the component correctly? For recursive components, make sure to provide the "name" option. VUE小 阅读全文
posted @ 2020-08-26 22:25 金鑫金 阅读(1240) 评论(0) 推荐(0) 编辑
摘要: 表单输入绑定 基础用法 用 v-model 指令在表单 <input>、<textarea> 及 <select> 元素上创建双向数据绑定。它会根据控件类型自动选取正确的方法来更新元素。尽管有些神奇,但 v-model 本质上不过是语法糖。它负责监听用户的输入事件以更新数据,并对一些极端场景进行一些 阅读全文
posted @ 2020-08-24 17:51 金鑫金 阅读(114) 评论(0) 推荐(0) 编辑
摘要: 列表渲染 用 v-for 把一个数组对应为一组元素 用 v-for 指令基于一个数组来渲染一个列表。v-for 指令需要使用 item in items 形式的特殊语法,其中 items 是源数据数组,而 item 则是被迭代的数组元素的别名。 <div> <ul id="example-3"> < 阅读全文
posted @ 2020-08-23 22:17 金鑫金 阅读(151) 评论(0) 推荐(0) 编辑
摘要: Class 与 Style 绑定 1.绑定HTML Class #对象语法 传给 v-bind:class 一个对象,以动态地切换 class: <div v-bind:class="{ active: isActive }"></div> 上面的语法表示 active 这个 class 存在与否将 阅读全文
posted @ 2020-08-23 18:47 金鑫金 阅读(111) 评论(0) 推荐(0) 编辑
摘要: 计算属性和侦听器 1.计算属性 模板内的表达式非常便利,但是设计它们的初衷是用于简单运算的。在模板中放入太多的逻辑会让模板过重且难以维护。例如: <div id="example-1"> {{ message.split('').reverse().join('') }} </div> var vm 阅读全文
posted @ 2020-08-23 17:40 金鑫金 阅读(141) 评论(0) 推荐(0) 编辑
摘要: 模板语法 Vue.js 使用了基于 HTML 的模板语法,允许开发者声明式地将 DOM 绑定至底层 Vue 实例的数据。所有 Vue.js 的模板都是合法的 HTML,所以能被遵循规范的浏览器和 HTML 解析器解析。 在底层的实现上,Vue 将模板编译成虚拟 DOM 渲染函数。结合响应系统,Vue 阅读全文
posted @ 2020-08-20 22:29 金鑫金 阅读(158) 评论(0) 推荐(0) 编辑
摘要: Vue实例 当创建一个 Vue 实例时,你可以传入一个选项对象。 一个 Vue 应用由一个通过 new Vue 创建的根 Vue 实例,以及可选的嵌套的、可复用的组件树组成。举个例子,一个 todo 应用的组件树可以是这样的: 根实例 └─ TodoList ├─ TodoItem │ ├─ Del 阅读全文
posted @ 2020-08-20 00:16 金鑫金 阅读(99) 评论(0) 推荐(0) 编辑
摘要: 组件化应用结构 在 Vue 里,一个组件本质上是一个拥有预定义选项的一个 Vue 实例。 <div id="app-7"> <ol> <!-- 创建一个 todo-item 组件的实例 --> <todo-item>11</todo-item> </ol> </div> Vue.component( 阅读全文
posted @ 2020-08-19 09:02 金鑫金 阅读(112) 评论(0) 推荐(0) 编辑
摘要: 条件与循环 v-if判断使用 :控制元素是否显示 <div id="app-3"> <p v-if="seen">vue是否显示</p> </div> var app3 = new Vue({ el: '#app-3', data: { seen: true } }) v-for循环使用: <div 阅读全文
posted @ 2020-08-18 22:40 金鑫金 阅读(78) 评论(0) 推荐(0) 编辑
摘要: 传统的DOM编程方式 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>数据绑定演示</title> </head> <body> <div id="app"> <input type="text" id="name" place 阅读全文
posted @ 2020-08-17 23:57 金鑫金 阅读(100) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 ··· 15 下一页