vue模板解析成HTML,Vue - vue-template-compiler 解析 HTML 模板的边界问题 - 1024技术文档...

Version

15.7.0

Reproduction link

Steps to reproduce

视图会输出 render 属性值,打开开发者工具查看 console 面板也可以查看编译结果。

What is expected?

render 属性的值应该为:

"with(this){return _c('CustomerComp',{scopedSlots:_u([_l((['a']),function(name){return {key:name,fn:function(){return undefined},proxy:true}}),_l((['b']),function(name){return {key:name,fn:function(){return undefined},proxy:true}})],null,true)})}"

格式化后:

with (this) {

return _c('CustomerComp', {

scopedSlots: _u(

[

_l(['a'], function(name) {

return {

key: name,

fn: function() {

return undefined;

},

proxy: true,

};

}),

_l(['b'], function(name) {

return {

key: name,

fn: function() {

return undefined;

},

proxy: true,

};

}),

],

null,

true,

),

});

}

What is actually happening?

render 属性的值为:

"with(this){return _c('CustomerComp',{scopedSlots:_u([_l((['b']),function(name){return {key:name,fn:function(){return undefined},proxy:true}})],null,true)})}"

格式化后:

with (this) {

return _c('CustomerComp', {

scopedSlots: _u(

[

_l(['b'], function(name) {

return {

key: name,

fn: function() {

return undefined;

},

proxy: true,

};

}),

],

null,

true,

),

});

}

此处我认为应该针对 动态具名插槽名称 进行判断,如果相同,则向名称添加额外唯一标识,防止被后者替换前者的情况出现。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值