1. 两个版本
Vue有两个版本,完整版(vue.js)和非完整版(vue.runtime.js)。
完整版有compiler(编译器),非完整版没有compiler。
因为compiler占非完整版约40%的体积,太大。
完整版的视图可以直接写在HTML里或者写在template选项。
但是非完整版需要写在render函数里 用h来创建标签 h相当于createElement。
不然html渲染不到页面上。
即:体积大的功能多,体积小的功能少。
2. template 和 render
对于非完整版
可以创建一个vue单文件组件
在里边写入template标签
可以通过render转换成节点替换原来html的节点
<template>
<div id="app">
{{n}}
<button @click="add">+1</button>
</div>
</template>
render(h){
return h('div', [this.n,h('{on:{click:this.add}’,'+1'])
}
3. 用 codesandbox.io 写 Vue 代码
codesandbox上可以直接使用vue 不需要一系列配置。
不注册可以无限用 注册了似乎只能创建50个项目。
点开网页--start coding--创建Vue--操作--导出