1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
import { createElement, createTextVnode } from "./vdom/index.js";
export function renderMixin(Vue){ Vue.prototype._c = function(...args){ return createElement(this,...args); } Vue.prototype._v = function(text){ return createTextVnode(this,text); } Vue.prototype._s = function(val){ return val == null ?'':(typeof val == 'object')? JSON.stringify(val): val; } Vue.prototype._render = function(){ const vm = this; let render = vm.$options.render;
let vnode = render.call(vm);
render vnode; } }
export function createElement(vm,tag,data= {},...children){ return vnode(vm,tag,data,data.key,children,undefined) }
export function createTextVnode(vm,text){ return vnode(vm,undefined,undefined,undefined,undefined,text) }
function vnode(vm,tag,data,key,children,text,componentOptions){ return { vm, tag, data, key, children, text, componentOptions } }
|