HackPlan / UUI

Universal Utility-first UI Library

Home Page:https://doc.uui.cool

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

支持 data-* 属性

shincurry opened this issue · comments

在一些使用场景中,使用 UUI 组件的开发者可能需要对某些 elements 添加额外的 data 属性,
用于开发更多的功能或者做前端测试的时候找到 element。

JSX

<UUIComponent
  customize={{
    Root: {
      dataAttributes: {                       // <------
        id: 'saogfyaudsf',                    // <------
        message: 'testing data attributes'    // <------
      }
    }
  }}
/>

Output

<div
  class="UUI-Component-Root"
  data-id="saogfyaudsf"                       // <------
  data-message="testing data attributes">     // <------
</div>