Open wang-zhixin opened 1 year ago
我的需求是在css中伪类的 content: attr(data-xxx) 使用在模板中动态 data-xxx 设置的值
官网示例配置:
const config = { plugins: [ ['@tarojs/plugin-inject', { components: { View: { 'data-index': "'dataIndex'" }, ScrollView: { 'data-observe': "'dataObserve'", } } }] ] }
编译后:
<View data-index='dataIndex'></View>
这样设置后,每个View上的data-index都是预设的 ‘dataIndex’,但我希望这个dataIndex是代码中动态设置的,请问我该如何做?
您好,请问解决了吗?有同样的问题
官网示例配置:
const config = { plugins: [ ['@tarojs/plugin-inject', { components: { View: { 'data-index': "'dataIndex'" }, ScrollView: { 'data-observe': "'dataObserve'", } } }] ] }
编译后: `
`
这样设置后,每个View上的data-index都是预设的 ‘dataIndex’,但我希望这个dataIndex是代码中动态设置的,请问我该如何做?