美文网首页
浅析Vue的两个版本

浅析Vue的两个版本

作者: shangjingfan | 来源:发表于2021-02-20 14:44 被阅读0次

    一、 Vue分为两个版本

    1. 完整版,包含compiler编译器(编译器可以将template字符串编译成JS渲染函数的代码),在通过cdn引用的时候,以vue.js结尾,
    2. 非完整版,不包含compiler编译器,通过cdn引用的时候,以vue.runtime.js结尾
      image.png

    二、template 和 render 的用法

    // template的使用
    new Vue({
      template: "<div>{{n}}</div>"
    })
    // render的使用
    new Vue({
      render(h){
       return h("div",this.n)
     }
    })
    

    三、如何用 codesandbox.io 写 Vue 代码

    步骤:打开https://codesandbox.io/ ;点击create sandbox;选择Vue;接下来就可以正常写Vue代码了,写完之后,可以点击左上角File--Export to ZIP导出写好的Vue项目

    image.png
    image.png
    image.png

    相关文章

      网友评论

          本文标题:浅析Vue的两个版本

          本文链接:https://www.haomeiwen.com/subject/uontfltx.html