Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
forked fromvuejs/vue

Commit4b51ad0

Browse files
committed
rename _h -> _c so that vue-template-es2015-compiler can use the new internal createElement without breaking backwards compatibility
1 parent207c18c commit4b51ad0

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

‎flow/component.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ declare interface Component {
8181
_render:()=>VNode;
8282
__patch__:(a:Element|VNode|void,b:VNode)=>any;
8383
// createElement
84-
_h:(vnode?:VNode,data?:VNodeData,children?:VNodeChildren)=>VNode|void;
84+
_c:(vnode?:VNode,data?:VNodeData,children?:VNodeChildren)=>VNode|void;
8585
// renderStatic
8686
_m:(index:number,isInFor?:boolean)=>VNode|VNodeChildren;
8787
// markOnce

‎src/compiler/codegen/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export function generate (
3131
transforms=pluckModuleFunction(options.modules,'transformCode')
3232
dataGenFns=pluckModuleFunction(options.modules,'genData')
3333
platformDirectives=options.directives||{}
34-
constcode=ast ?genElement(ast) :'_h("div")'
34+
constcode=ast ?genElement(ast) :'_c("div")'
3535
staticRenderFns=prevStaticRenderFns
3636
onceCount=prevOnceCount
3737
return{
@@ -62,7 +62,7 @@ function genElement (el: ASTElement): string {
6262
constdata=el.plain ?undefined :genData(el)
6363

6464
constchildren=el.inlineTemplate ?null :genChildren(el,true)
65-
code=`_h('${el.tag}'${
65+
code=`_c('${el.tag}'${
6666
data ?`,${data}` :''// data
6767
}${
6868
children ?`,${children}` :''// children
@@ -336,7 +336,7 @@ function genSlot (el: ASTElement): string {
336336
// componentName is el.component, take it as argument to shun flow's pessimistic refinement
337337
function genComponent (componentName, el): string {
338338
const children = el.inlineTemplate ? null : genChildren(el, true)
339-
return `_h(${componentName},${genData(el)}${
339+
return `_c(${componentName},${genData(el)}${
340340
children ?`,${children}` :''
341341
})`
342342
}

‎src/core/instance/render.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,11 @@ export function initRender (vm: Component) {
3232
vm.$scopedSlots={}
3333
// bind the createElement fn to this instance
3434
// so that we get proper render context inside it.
35-
// args order: tag, data, children, needNormalization
36-
// the needNormalization flag is disabled for the public version.
37-
vm._h=(a,b,c,d)=>createElement(vm,a,b,c,d,false)
35+
// args order: tag, data, children, needNormalization, alwaysNormalize
36+
// internal version is used by render functions compiled from templates
37+
vm._c=(a,b,c,d)=>createElement(vm,a,b,c,d,false)
38+
// normalization is always applied for the public version, used in
39+
// user-written render functions.
3840
vm.$createElement=(a,b,c,d)=>createElement(vm,a,b,c,d,true)
3941
if(vm.$options.el){
4042
vm.$mount(vm.$options.el)

‎test/unit/modules/compiler/compiler-options.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ describe('compile options', () => {
5151
result[validator.name]=null
5252
})
5353
// generate code
54-
return`_h('validate',{props:{
54+
return`_c('validate',{props:{
5555
field:${JSON.stringify(el.validate.field)},
5656
groups:${JSON.stringify(el.validate.groups)},
5757
validators:${JSON.stringify(el.validators)},

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp