search

Home  >  Q&A  >  body text

javascript - What are the differences between vuejs runtime build and independent build? What business scenarios are they suitable for?

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?

大家讲道理大家讲道理2782 days ago677

reply all(2)I'll reply

  • PHPz

    PHPz2017-05-19 10:43:36

    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.

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-05-19 10:43:36

    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.

    reply
    0
  • Cancelreply