uniapp 下拉框效果使用 uni-data-select标签
·
<uni-data-select
v-model="formData.femMerchantsClassificationId"
:localdata="range"
@change="change">
</uni-data-select>
:localdata 绑定下拉框内容
当下拉框内容调用后端接口时候,写法:
<uni-data-select
v-model="formData.femMerchantsClassificationId"
:localdata="range"
@change="change"></uni-data-select>
data() {
return {
range: [],
}
methods: {
category() {
uni.request({
url:“”,
method: 'GET',
header: {
'Authorization': 'Bearer ' + this.$TOKEN.TOKEN
},
success: (res) => {
const All = res.data
let myrange = []
All.forEach((val, index) => {
myrange.push({
value: val.femMerchantsClassificationId, // 选项id
text: val.femMerchantsClassificationName // 选项名称
})
})
this.range = myrange
}
})
}
更多推荐
已为社区贡献4条内容
所有评论(0)