Skip to content

请问我想在模板想定义一些动态的自定义属性,我该如何做? #14

Open
@wang-zhixin

Description

@wang-zhixin

官网示例配置:

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是代码中动态设置的,请问我该如何做?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions