mand-mobile icon indicating copy to clipboard operation
mand-mobile copied to clipboard

[feature-request] 希望 picker 多级选择器数据源能自定义键值

Open mice33 opened this issue 5 years ago • 3 comments

What problem does this feature solve?

数据源里面 text label 或者 value 可以自定义为别的变量名

What does the proposed API look like?

类似 https://element.eleme.io/#/zh-CN/component/cascader 里的 Props

mice33 avatar Feb 24 '20 07:02 mice33

是什么样的使用场景?

xxyan0205 avatar Feb 24 '20 07:02 xxyan0205

数据源格式与 picker 要求数据源格式不一致的时候。

[
  [
    {
      // 选项展示文案
      "text": "",
      // 以下自定义字段
      "value": ""
    },
    // ...
  ],
  // ...
]

而实际用的数据源格式为

[
  [
    {
      // 选项展示文案
      "listtext": "",
      // 以下自定义字段
      "listvalue": ""
    },
    // ...
  ],
  // ...
]

Element cascader 组件就可以指定选项的值为选项对象的某个属性值

label: 'listtext',
value: 'listvalue'

mice33 avatar Feb 24 '20 09:02 mice33

数据手动格式化一下就好了,这需求似乎不是很有必要。

chunghaochow avatar Apr 17 '20 06:04 chunghaochow