Vue

Hello world

  1. import: <script src="https://unpkg.com/vue"></script>
  2. HTML ```html
3. javascript

```js
var app = new Vue({
  el: '#app',
  data: {
    message: 'hello, world'
  }

})

HTML 中用一个 mount point <div id="app">, 在 javascript 创建一个 Vue 示例。

HTML 渲染

  1. 文本插值:
  2. v-bind::title e.g. ` `
  3. v-on: @ 事件处理 ` `
  4. 条件: v-if
  5. 循环: v-for
  6. 用户输入: v-model ` `

component

// 定义名为 todo-item 的新组件
Vue.component('todo-item', {
  template: '<li>这是个待办项</li>'
})

##

Vue class / instance

var vm = new Vue({

})

Options/*

  1. el: 锚点
  2. data: 要绑定的数据
  3. computed: 复杂属性
  4. props: 对外的属性接口,类似 C# /Android 中 view 等属性。
  5. methods: 方法

API

global config

Global API

Options/data

Questions

  1. what is javascript prototype?

    fdf

  2. what is javascript context this?

    The answer is short and simple: Scope pertains to the visibility of variables, and context refers to the object within which a function is executed.

javascript context/ scope/ this

context means this keyword

Context is most often determined by how a function is invoked. When a function is called as a method of an object, this is set to the object the method is called on:

So for a global function, this refers to ‘window’ in browser