javascript - What are the differences between vuejs runtime build and independent build? What business scenarios are they suitable for?
大家讲道理
大家讲道理 2017-05-19 10:41:36
0
2
674

The official website introduces independent construction and runtime construction, but it is vague and confusing. I don’t know how to use it in actual work?

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(2)
PHPzhong

You can use the template option for independent construction.
Building during runtime is not possible. You can only compile it through the template and convert it into a render function.

伊谢尔伦

1. The independent build includes the template compiler, and the runtime build does not include the template compiler.
2. The function of the template compiler is to compile the template options into the render function. The render function is the key to rendering.
3. In view of the above two points, when using the runtime build, the template option cannot appear because there is no template compiler at this time. But there is one exception: in the case of webpack+vue-loader, it is OK to have template appear in a single-file component.
4. When using vue-cli to generate a project, you will be reminded which build method to use. The npm package exports runtime builds by default. If you need to use independent builds, you need to configure alias in webpack. 5. The two currently discovered The differences in application scenarios are:

  • You need to pay attention to the way Vue is instantiated. When instantiating Vue in runtime build mode, the template attribute should not appear

  • Do not include template or route-view rendered through vue-router

The above differences are discussed in scenarios where webpack+vue-loader single file component is used. Other differences have not been discovered yet.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template