前端小白学习日记(第 1 天)
昨天看了一天的V01课程,备受打击,很多基础知识都不会,看着大段大段的代码,有心学习,无力理解。。因此还是决定从基础学起,从文档看起。。记录自己学习经历,避免日后遗忘。如能有前辈指点一二,不胜感激。。
Documentations (2.x)
基础
安装
- 安装 Vue Devtools
- 由于V01中讲解了NPM和命令行工具 (CLI),所以就不再引入vue文件了,比手动方便太多。
介绍
Vue 实例
- MVVM 模型
- 通读全文
模板语法
- 通读全文
计算属性和侦听器
- Lodash--A modern JavaScript utility library delivering modularity, performance & extras.
- axios--Promise based HTTP client for the browser and node.js
- 通读全文(里面有个异步请求的例子比较有代表性,研究了一会儿 :smile:)
Q&A
Uncaught ReferenceError: vm is not defined..
You need to define vm globally to access it from the console.
Something like this should work.
var vm = new Vue({
el: '#app',
data: {
a: 1
},
router,
template: '<App/>',
components: {
App
}
});
global.vm = vm; //Define you app variable globally
Now you can use vm.$data.PROPERTY or vm.PROPERTY.
Undigested
模板语法--特性
特性
Mustache 语法不能作用在 HTML 特性上,遇到这种情况应该使用 v-bind 指令:
<div v-bind:id="dynamicId"></div>
在布尔特性的情况下,它们的存在即暗示为 true
,v-bind
工作起来略有不同,在这个例子中:
<button v-bind:disabled="isButtonDisabled">Button</button>
如果 isButtonDisabled
的值是 null
、undefined
或 false
,则 disabled
特性甚至不会被包含在渲染出来的 <button>
元素中。
Plan to learn
BootstrapVue implements Bootstrap 4 components and grid system for Vue.js
9 interactive screencasts to take you from beginner to advanced
本作品采用《CC 协议》,转载必须注明作者和本文链接
推荐文章: