uniapp-vue3-彈出選擇組件wo-pop-selector使用示例
wo-pop-selector彈出選擇組件采用uniapp-vue3實(shí)現(xiàn), 支持H5、微信小程序(其他小程序未測(cè)試過,可自行嘗試)
可到插件市場(chǎng)下載嘗試: https://ext.dcloud.net.cn/plugin?id=14879
使用示例
<template> <view> <view class="name">彈出選擇器: pop-selector</view> <view class="card"> <view class="header">屬性-基本用法(disabled禁用):</view> <view class="content"> <pop-selector :select-options="state.options" :default-value="state.value" @changeSelect="onChangeSelect"> <view class="button"> 狀態(tài)選擇:{{ state.options[state.value]?.label }} </view> </pop-selector> </view> </view> <view class="card"> <view class="header">屬性-自定義激活顏色:</view> <view class="content"> <pop-selector :active-color="'#0086D1'" :select-options="state.options" :default-value="state.value" @changeSelect="onChangeSelect"> <view class="button"> 狀態(tài)選擇:{{ state.options[state.value]?.label }} </view> </pop-selector> </view> </view> <view class="card"> <view class="header">屬性-自定義彈窗高度:</view> <view class="content"> <pop-selector :max-height="'200rpx'" :select-options="state.options" :default-value="state.value" @changeSelect="onChangeSelect"> <view class="button"> 狀態(tài)選擇:{{ state.options[state.value]?.label }} </view> </pop-selector> </view> </view> <view class="card"> <view class="header">屬性-自定義彈窗樣式:</view> <view class="content"> <pop-selector :card-style="state.darkStyle" :select-options="state.options" :default-value="state.value" @changeSelect="onChangeSelect"> <view class="button"> 狀態(tài)選擇:{{ state.options[state.value]?.label }} </view> </pop-selector> </view> </view> <view class="card"> <view class="header">插槽-自定義彈窗頭部:</view> <view class="content"> <pop-selector :active-color="'#0086D1'" :select-options="state.options" :default-value="state.value" @changeSelect="onChangeSelect"> <view class="button"> 狀態(tài)選擇:{{ state.options[state.value]?.label }} </view> <template v-slot:header> <view style="padding: 12rpx 20rpx; color: grey;">請(qǐng)選擇訂單狀態(tài)</view> </template> </pop-selector> </view> </view> <view class="card"> <view class="header">插槽-自定義右邊圖標(biāo):</view> <view class="content"> <pop-selector :select-options="state.options" :default-value="state.value" @changeSelect="onChangeSelect"> <view class="button"> 狀態(tài)選擇:{{ state.options[state.value]?.label }} </view> <template v-slot:right> <view>?</view> </template> </pop-selector> </view> </view> </view> </template> <script setup lang="ts"> import popSelector from './popSelector.vue' import { reactive } from 'vue'; const state = reactive({ options: [ { label: '全部', value: 0, }, { label: '成功', value: 1, }, { label: '失敗', value: 2, }, { label: '禁用', disabled: true, value: 3, }, ], value: 0, darkStyle: { color: '#fff', background: '#000', border: '1px solid #ebeef5', borderRadius: '6px', boxShadow: '0 2px 12px 0 rgba(0, 0, 0, 0.1)', padding: '4px 0', fontSize: '26rpx' } }); const onChangeSelect = (e: any) => { console.log(e); state.value = e.value; }; </script> <style scoped> .flex-center { display: flex; justify-content: center; align-items: center; } .name { font-weight: bold; padding: 40rpx 0 10rpx 20rpx; } .card { display: flex; justify-content: space-between; background: #f1f1f1; margin: 40rpx 10rpx; padding: 30rpx; border-radius: 12rpx; } .header { display: flex; align-items: center; } .button { background: #fff; padding: 16rpx 30rpx; border-radius: 10rpx; } </style>
到此這篇關(guān)于uniapp-vue3-彈出選擇組件wo-pop-selector的文章就介紹到這了,更多相關(guān)uniapp-vue3彈出選擇組件內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
VUE引入DataV報(bào)錯(cuò)解決實(shí)戰(zhàn)記錄
在使用vue開發(fā)大屏?xí)r,發(fā)現(xiàn)了一個(gè)很好用的可視化組件庫(kù)DataV,下面這篇文章主要給大家介紹了關(guān)于VUE引入DataV報(bào)錯(cuò)解決的實(shí)戰(zhàn)記錄,文中通過代碼介紹的非常詳細(xì),需要的朋友可以參考下2024-04-04Vue中使用event的坑及解決event is not defined
這篇文章主要介紹了Vue中使用event的坑及解決event is not defined,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2024-03-03Vue實(shí)現(xiàn)點(diǎn)擊導(dǎo)航欄當(dāng)前標(biāo)簽后變色功能
這篇文章主要為大家詳細(xì)介紹了Vue實(shí)現(xiàn)點(diǎn)擊導(dǎo)航欄當(dāng)前標(biāo)簽后變色功能,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2020-08-08vue使用webSocket更新實(shí)時(shí)天氣的方法
本文將結(jié)合實(shí)例代碼,介紹vue使用webSocket更新實(shí)時(shí)天氣的方法,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2021-06-06Vue實(shí)現(xiàn)動(dòng)態(tài)表單的示例詳解
在前端開發(fā)中,我們經(jīng)常遇到根據(jù)用戶輸入動(dòng)態(tài)生成不同表單項(xiàng)的需求,本文將詳細(xì)講解如何使用?Vue?3?的響應(yīng)式特性,逐步構(gòu)建一個(gè)遞歸動(dòng)態(tài)表單,感興趣的可以了解下2024-12-12