Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

怎么在tpl字段上使用preset里配置的属性 #29

Closed
xiusin opened this issue Oct 19, 2020 · 1 comment
Closed

怎么在tpl字段上使用preset里配置的属性 #29

xiusin opened this issue Oct 19, 2020 · 1 comment

Comments

@xiusin
Copy link

xiusin commented Oct 19, 2020

类似需求如下:

Button {
   tpl:"<%= $preset.xxxx.xxx%>"
}
@jinmingpang
Copy link
Member

TPL 是摸板字符串,只是注入了 data 数据域。正常情况下,应该遇不到这样的需求。如果真的有 字符串拼接变量的需求。可以直接将变量定义在,JS中,用 ES6 模版字符串处理。

例如:

const textStr= 'xxxx';

export schema = {
     type: 'tpl',
     tpl: `${textStr} <div>其他数据: <%= data.xxx %> </div>`
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants