vue完整版与非完整版的区别

370 阅读1分钟

两个版本的区别

1、vue完整版本:vue.js;非完整版:vue.runtime.js(文件名不同,生成环境后缀为.min.js) 2、完整版里有compiler;非完整版无(compiler占40%体积) 3、完整版视图写在HTML里或template选项里;非完整版写在render函数里,使用h来创建标签(h是创始人写好传给render的) 4、完整版中webpack引入和@vue/cli引入都是需要额外配置的;非完整版不需要

template 和 render 怎么用

// 需要编译器 new Vue({ template: '<div>{{ hi }}</div>' })

// 不需要编译器 new Vue({ render (h) { return h('div', this.hi) } })

如何用 codesandbox.io 写 Vue 代码

image.png

image.png

image.png 按照图片相应步骤就可以写vue代码了。