1. 两个版本(完整版和非完整版)区别
- 完整版:vue.js,同时包含编编译器(compiler) 和 运行时(runtime)的版本
- 非完整版:vue.runtime.js,只包含运行时的版本
2. template 和render怎么用
template,主要写视图内容,完整版可以直接将视图写在HTML或者template中。
new Vue({
template:'<div>
{{n}}
</div>'
})
- render,运行时版本需要在render函数中使用h来进行创建标签,Vue 选项中的 render 函数若存在,则 Vue 构造函数不会从 template 选项或通过 el 选项指定的挂载元素中提取出的 HTML 模板编译渲染函数。
new Vue({
render(h){
return h('div', this.hi)
}
})
3. 如何用 codesandbox.io 写 Vue 代码
- 登录codesandbox.io——选择Create Sandbox——选择Vue
- 下载 File——Export to ZIP