1. Two versions of Vue

  • Vue Full version (vue.js)

    • Features: Compiler is available, but is 30-40% of the volume
    • View: Write in HTML or template option
    • CDN import: Vue. js file names are different, and the generation environment suffix is.min.js
    • Webpack introduction: Alias needs to be configured
    • @vue/ CLI Import: Additional configuration is required
    • Vue Non-complete version (vue.runtime.js)
  • Vue Non-complete version (vue.runtime.js) :

    • Features: No compiler, overall size 30-40% less than the full version.
    • View: write it in the render function, using h to create the tag (h is pre-written to render by Yuxi)
    • CDN introduction: vue.runtime.js
    • Webpack introduction: This version is used by default
    • @vue/ CLI Import: This version is used by default

Summary: Use the incomplete version, with vue-loader and vue files, to ensure customer experience.

2. How to use template and render

Template is simple and straightforward, render is suitable for complex logic. Template:

<template>
  <div id="app">
    {{n}}
  </div>
</template>

<script>
import HelloWorld from "./components/HelloWorld.vue";

export default {
  name: "App".data() {
    return {
      n: 0}; }};</script>

Copy the code

render:

render(h){ 
     return h('div'[thisN, h ('{on:{click:this.add}'.'+ 1'])}Copy the code

The consumer template is easy to understand, but it is inflexible, has a compilation process, and has low performance. Render, but higher requirements for users.

Render with the render function there is no compilation process, render performance is higher. , which is equivalent to the user giving code directly to the program. Therefore, it is highly demanding and error-prone to use.

The Render function takes precedence over template.

3. How to write vUE online more conveniently?

Use codesandbox.io, no login required.

1.Create Sandbox

2.Create the Sandbox, select the corresponding framework, and then write the code directly

3. After compiling the project, you can export the ZIP file to a local PC.