Skip to content

Commit

Permalink
feat: add component uni-data-select
Browse files Browse the repository at this point in the history
  • Loading branch information
Fasttian committed Apr 22, 2022
1 parent 43eb9d5 commit f9a9c49
Show file tree
Hide file tree
Showing 5 changed files with 619 additions and 0 deletions.
54 changes: 54 additions & 0 deletions pages/vue/data-select/data-select.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<template>
<view>
<uni-card is-full>
<text class="uni-h6">通过数据驱动的单选框和复选框,可直接通过连接 uniCloud 获取数据,同时可以配合表单组件 uni-forms 使用</text>
</uni-card>
<uni-section title="本地数据" type="line">
<uni-data-select v-model="value" :localdata="range" @change="change"></uni-data-select>
</uni-section>
<uni-section title="云端数据" subTitle="连接云服务空间, 且存在相关的数据表才能生效(此处演示, 未连接云服务空间, 故不生效)" type="line">
<uni-data-select collection="opendb-app-list" field="appid as value, name as text" v-mode="appid" />
</uni-section>
<uni-section title="是否可清除已选项" type="line">
<uni-data-select v-model="value" :localdata="range" @change="change" :clear="false"></uni-data-select>
</uni-section>
<uni-section title="配置左侧标题" type="line">
<uni-data-select v-model="value" :localdata="range" @change="change" label="应用选择"></uni-data-select>
</uni-section>
</view>
</template>

<script>
export default {
data() {
return {
value: 0,
range: [{"value": 0,"text": "篮球"},
{"value": 1,"text": "足球"},
{"value": 2,"text": "游泳"}]
}
},
methods: {
change(e){
console.log('e:',e);
}
}
}
</script>

<style lang="scss">
.text {
font-size: 12px;
color: #666;
margin-top: 5px;
}
.uni-px-5 {
padding-left: 10px;
padding-right: 10px;
}
.uni-pb-5 {
padding-bottom: 10px;
}
</style>
2 changes: 2 additions & 0 deletions uni_modules/uni-data-select/changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
## 0.1.0(2022-04-22)
- 初始化
Loading

0 comments on commit f9a9c49

Please sign in to comment.