Closed donghualei closed 2 years ago
我没搞懂你这么搞的原因,method call 是支持多级的。
var MyApp = san.defineComponent({
template: `<div>
{{fs[method](text)}}
</div>`,
fs: {
up(text) {return text.toUpperCase()},
lower(text){return text.toLowerCase()}
}
})
var myApp = new MyApp({
data: {
method: 'up',
text: 'Hello'
}
});
myApp.attach(document.body)
代码如下:
渲染后的结果为:
<div>function writeB(text) {return text + 'world';}</div>
是否有必要支持这种模式呢?