uniapp-vue3-弹出选择组件wo-pop-selector使用示例

 更新时间:2023年10月10日 09:33:01   作者:狼性书生  
wo-pop-selector弹出选择组件采用uniapp-vue3实现, 支持H5、微信小程序,本文给大家介绍uniapp-vue3-弹出选择组件wo-pop-selector及使用示例,感兴趣的朋友一起看看吧

wo-pop-selector弹出选择组件采用uniapp-vue3实现, 支持H5、微信小程序(其他小程序未测试过,可自行尝试)

可到插件市场下载尝试: 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">
						状态选择:{{ 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">
						状态选择:{{ 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">
						状态选择:{{ 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">
						状态选择:{{ 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">
						状态选择:{{ state.options[state.value]?.label }}
					</view>
					<template v-slot:header>
						<view style="padding: 12rpx 20rpx; color: grey;">请选择订单状态</view>
					</template>
				</pop-selector>
			</view>
		</view>
		<view class="card">
			<view class="header">插槽-自定义右边图标:</view>
			<view class="content">
				<pop-selector :select-options="state.options" :default-value="state.value" @changeSelect="onChangeSelect">
					<view class="button">
						状态选择:{{ 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>

到此这篇关于uniapp-vue3-弹出选择组件wo-pop-selector的文章就介绍到这了,更多相关uniapp-vue3弹出选择组件内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!

相关文章

  • 使用Vant完成Dialog弹框案例

    使用Vant完成Dialog弹框案例

    这篇文章主要介绍了使用Vant完成Dialog弹框案例,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧
    2020-11-11
  • VUE引入DataV报错解决实战记录

    VUE引入DataV报错解决实战记录

    在使用vue开发大屏时,发现了一个很好用的可视化组件库DataV,下面这篇文章主要给大家介绍了关于VUE引入DataV报错解决的实战记录,文中通过代码介绍的非常详细,需要的朋友可以参考下
    2024-04-04
  • 解决Vue2.x父组件与子组件之间的双向绑定问题

    解决Vue2.x父组件与子组件之间的双向绑定问题

    这篇文章主要介绍了解决Vue2.x父组件与子组件之间的双向绑定问题,需要的朋友可以参考下
    2018-03-03
  • Vue中使用event的坑及解决event is not defined

    Vue中使用event的坑及解决event is not defined

    这篇文章主要介绍了Vue中使用event的坑及解决event is not defined,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教
    2024-03-03
  • Vue中render方法的使用详解

    Vue中render方法的使用详解

    这篇文章主要为大家详细介绍了Vue中render方法的使用,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
    2018-01-01
  • vue3+vite+ts父子组件之间的传值

    vue3+vite+ts父子组件之间的传值

    随着vue2的落幕,vue3越来成熟,有必要更新一下vue3的父子组件之间的传值方式,这里介绍下vue3+vite+ts父子组件之间的传值方式实例详解,感兴趣的朋友一起看看吧
    2023-12-12
  • Vue中父子组件的值传递与方法传递

    Vue中父子组件的值传递与方法传递

    这篇文章主要介绍了Vue中父子组件的值传递与方法传递,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
    2020-09-09
  • Vue实现点击导航栏当前标签后变色功能

    Vue实现点击导航栏当前标签后变色功能

    这篇文章主要为大家详细介绍了Vue实现点击导航栏当前标签后变色功能,文中示例代码介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
    2020-08-08
  • vue使用webSocket更新实时天气的方法

    vue使用webSocket更新实时天气的方法

    本文将结合实例代码,介绍vue使用webSocket更新实时天气的方法,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
    2021-06-06
  • Vue实现动态表单的示例详解

    Vue实现动态表单的示例详解

    在前端开发中,我们经常遇到根据用户输入动态生成不同表单项的需求,本文将详细讲解如何使用 Vue 3 的响应式特性,逐步构建一个递归动态表单,感兴趣的可以了解下
    2024-12-12

最新评论