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

feat(uni-date-select): uni-date-select增加多选框 #887

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
83 changes: 72 additions & 11 deletions pages/vue/data-select/data-select.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
<uni-card :is-shadow="false" is-full>
<text class="uni-h6">通过数据驱动的单选框和复选框,可直接通过连接 uniCloud 获取数据,同时可以配合表单组件 uni-forms 使用</text>
</uni-card>
<uni-section title="本地数据" type="line">
<view class="uni-px-5 uni-pb-5">
<uni-data-select v-model="value" :localdata="range" @change="change"></uni-data-select>
</view>
</uni-section>
<uni-section title="禁用状态" type="line">
<view class="uni-px-5 uni-pb-5">
<uni-data-select v-model="value" :disabled="true" :localdata="range"></uni-data-select>
</view>
<uni-section title="本地数据" type="line">
<view class="uni-px-5 uni-pb-5">
<uni-data-select v-model="value" :localdata="range" @change="change"></uni-data-select>
</view>
</uni-section>
<uni-section title="禁用状态" type="line">
<view class="uni-px-5 uni-pb-5">
<uni-data-select v-model="value" :disabled="true" :localdata="range"></uni-data-select>
</view>
</uni-section>
<!-- <uni-section title="云端数据" subTitle="连接云服务空间, 且存在相关的数据表才能生效(此处演示, 未连接云服务空间, 故不生效, 且有报错)" type="line">
<uni-data-select collection="opendb-app-list" field="appid as value, name as text" v-mode="value" />
Expand All @@ -31,6 +31,11 @@
<uni-data-select placement="top" v-model="value" :localdata="range" @change="change" label="应用选择"></uni-data-select>
</view>
</uni-section>
<uni-section title="多选" type="line">
<view class="uni-px-5 uni-pb-5">
<uni-data-select v-model="defaultValue" mode="multiple" :localdata="options" @change="change"></uni-data-select>
</view>
</uni-section>
</view>
</template>

Expand All @@ -52,12 +57,68 @@
"value": 2,
"text": "游泳"
}
]
],
defaultValue: [2, 3],
options: [{
"value": 0,
"text": "篮球",
"disable": true
},
{
"value": 1,
"text": "足球"
},
{
"value": 2,
"text": "游泳"
},
{
"value": 3,
"text": "网球"
},
{
"value": 4,
"text": "乒乓球"
},
{
"value": 5,
"text": "男子1000米跑步"
},
{
"value": 6,
"text": "女子1000米跑步"
},
{
"value": 7,
"text": "摔跤"
},
{
"value": 8,
"text": "拳击"
},
{
"value": 9,
"text": "健身"
},
{
"value": 10,
"text": "瑜伽"
},
{
"value": 11,
"text": "田径"
},
{
"value": 12,
"text": "高尔夫"
}
],
}
},
methods: {
change(e) {
console.log('e:', e);
console.log(this.defaultValue);
}
}
}
Expand All @@ -78,4 +139,4 @@
.uni-pb-5 {
padding-bottom: 10px;
}
</style>
</style>