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

Selector 选择无法识别自定义json #2139

Closed
junzaivip opened this issue Oct 30, 2017 · 3 comments
Closed

Selector 选择无法识别自定义json #2139

junzaivip opened this issue Oct 30, 2017 · 3 comments

Comments

@junzaivip
Copy link

使用Selector组件的时候, 发现官方提供的Demo中的list使用的是key和value的json, 请问如果是后台返回的其他字符串, 如果自定义识别呢.

官方Demo代码:

 list: [{key: 'gd', value: '广东'}, {key: 'gx', value: '广西'}],

但是我需要解析自定义后台接口的代码, 如下:

list2: [
          {
            activityDefID: "name",
            activityInstDesc: "",
            activityInstID: 4410,
            activityInstName: "jingdong",
          },{
            activityDefID: "name2",
            activityInstDesc: "",
            activityInstID: 4420,
            activityInstName: "taobao",
          },{
            activityDefID: "name3",
            activityInstDesc: "",
            activityInstID: 4430,
            activityInstName: "alibaba",
          }
          ]

发现官方demo中, 必须在json中提供key:"", value:"" , 这样下拉框才能选择, 请问如果是上诉的list2应该如何识别呢.

<group title="with placeholder">
      <selector placeholder="请选择省份" v-model="demo01" title="省份" name="district" :options="list" @on-change="onChange"></selector>
    </group>
@airyland
Copy link
Owner

自行转换数据为组件需要的格式吧。

@johnscliang
Copy link

这个肯定是自已改数据了。

@Jiiiiiin
Copy link

Jiiiiiin commented Dec 6, 2017

@airyland 其他控件有考虑通知改一下不? 👍

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

No branches or pull requests

4 participants