Vue 两个版本的区别和使用方法:

227 阅读1分钟

一,Vue两个版本对应的文件名

完整版:vue.js

只包含运行时版:vue.runtime.js

二,template 和 render 怎么用

vue完整版 template的使用方法:直接写在页面上或者JS上

<template>
    <div id="app">      
        {{n}}
        <button @click="add">+1</button>   
    </div> 
</template>

vue非完整版 render的使用方法

render函数接收一个参数h,这个参数是vue传的;用这个参数去创建实例

render(h){ 
     return h('div', [this.n, h('{on: {click: this.add}’, '+1'})
 }

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

首先在codesandbox.io网站中点击 creat sandbox 创建一个vue沙盒进入app.vue编写如下vue代码就可以了