Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k views
in Technique[技术] by (71.8m points)

关于vue template预编译的问题

了解到vue的template是在运行时转换为render函数的,有没有办法在打包阶段预编译成render函数?

如果可以的话,就可以去掉vue源码中的compile部分,进一步减小体积.

谢谢!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

vue默认使用的是vue.runtime.js,单文件模板中的template会在打包编译阶段编译成render函数.
如果想要在组件中动态调用template选项的话需要vue的完整构建


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...