Merge branch 'xingyy'

xingyy
xingyy 1 year ago
commit 52b35116bf

@ -0,0 +1,6 @@
## 1.0.22023-06-09
增加预览二维码
## 1.0.12023-04-14
增加示例
## 1.0.02023-03-31
初始发布

@ -0,0 +1,275 @@
<template>
<view >
<view :class="['scroll-popup', isShow ? 'scroll-open' : '', animation ? 'scroll-animation' : '']">
<view class="scroll-box">
<view class="scroll-top">
<view class="scroll-top-left" @click="getResult('cancel')"></view>
<view class="scroll-top-right" :style="'color:'+selectBg" @click="getResult('confirm')"></view>
</view>
<scroll-view class="scroll-view_H" scroll-y="true">
<view class="scroll-view-grid-box" v-if="dataList.length>0">
<view v-for="(item, index) in dataList" :key="index" @click="chooseItem(item,index)"
:style="{backgroundColor:item.state?selectBg:noSelectBg}"
:class="{'card-list scroll-view-item-true':item.state,'card-list scroll-view-item':!item.state}">
<view :style="{color:item.state?selectColor:noSelectColor}">{{ item.name }}</view>
<image class="select-img" :src="selectImg" v-if="item.state"></image>
</view>
</view>
<view class="scroll-view-noBox" v-else>
<image :src="noDataImg"></image>
<view class="text">暂无数据</view>
</view>
</scroll-view>
<view v-show="safeArea" class="scroll-temp"></view>
</view>
</view>
<view v-show="isShow" class="scroll-mask" @click="isMask ? close() : ''"></view>
</view>
</template>
<script>
import noData from '../../static/noData.png'
import selectInfo from '../../static/select.png'
export default {
props: {
//
multiple: {
type: Boolean,
default: true,
},
//
list: {
type: Array
},
//
selectColor: {
type: String,
default: '#FFFFFF',
},
//
noSelectColor: {
type: String,
default: '#333333',
},
//
selectBg: {
type: String,
default: '#1890ff',
},
//
noSelectBg: {
type: String,
default: '#f7f7f7',
},
//
isMask: {
type: Boolean,
default: true,
},
//
animation: {
type: Boolean,
default: true,
},
//
safeArea: {
type: Boolean,
default: false,
},
},
data() {
return {
dataList: this.list,
isShow: false,
noDataImg: '',
selectImg: '',
selectArr: this.list
};
},
mounted() {
this.selectImg = selectInfo
this.noDataImg = noData
},
methods: {
open() {
this.isShow = true
this.init()
},
close() {
this.isShow = false
},
init() {
this.dataList = JSON.parse(JSON.stringify(this.selectArr))
this.dataList.forEach(res => {
if (!res.state) {
res.state = false
}
})
},
//
chooseItem(item, index) {
if (this.multiple) {
item.state = !item.state
this.dataList = JSON.parse(JSON.stringify(this.dataList))
} else {
this.dataList.forEach((res, inx) => {
if (inx == index) {
res.state = !res.state
} else {
res.state = false
}
})
this.dataList = JSON.parse(JSON.stringify(this.dataList))
}
},
getResult(event) {
if (event == 'confirm') {
let result = []
this.dataList.forEach((item, index) => {
if (item.state) {
result.push(item)
}
})
this.selectArr = JSON.parse(JSON.stringify(this.dataList))
this.$emit('change', result)
}
this.close()
}
},
};
</script>
<style lang="scss" scoped>
/* 弹出层默认样式 */
.scroll-popup {
width: 750rpx;
position: fixed;
bottom: -100%;
z-index: 999;
}
/* bottom ,
同理如需更改弹出方向只需将bottom改成topleftright即可
(默认样式的方向也需一起更改哦) */
.scroll-open {
bottom: 0px !important;
}
.scroll-animation {
transition: all 0.25s linear;
}
/* 遮罩层样式 */
.scroll-mask {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.3);
z-index: 998;
}
.scroll-box {
position: absolute;
bottom: 0;
width: 100%;
background: #ffff;
border-radius: 24rpx 24rpx 0 0;
}
.scroll-temp {
padding-bottom: env(safe-area-inset-bottom);
}
.scroll-top {
height: 88rpx;
line-height: 88rpx;
}
.scroll-top-left {
float: left;
padding-left: 24rpx;
font-size: 28rpx;
}
.scroll-top-right {
float: right;
padding-right: 24rpx;
color: #1890ff;
font-size: 28rpx;
}
.scroll-view_H {
white-space: nowrap;
width: 100%;
height: 400rpx;
line-height: 100rpx;
background-color: #ffffff;
}
.scroll-view-grid-box {
width: calc(100% - 20rpx);
margin: 10rpx;
padding-bottom: 10rpx;
}
.scroll-view-noBox {
width: 100%;
height: 400rpx;
text-align: center;
image {
width: 200rpx;
height: 200rpx;
margin-top: 32rpx;
}
.text {
width: 100%;
text-align: center;
color: #888;
font-size: 28rpx;
margin-top: -40rpx;
}
}
.scroll-view-item {
padding: 0rpx 24rpx;
text-align: left;
border-radius: 6rpx;
font-size: 28rpx;
margin: 12rpx 4rpx;
height: 66rpx;
line-height: 66rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.scroll-view-item-true {
padding: 0rpx 24rpx;
text-align: left;
border-radius: 6rpx;
font-size: 28rpx;
margin: 12rpx 4rpx;
height: 66rpx;
line-height: 66rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.card-list {
display: flex;
align-items: center;
justify-content: space-between;
.select-img {
min-width: 30rpx;
width: 30rpx;
height: 30rpx;
margin-left: 20rpx;
}
}
</style>

@ -0,0 +1,6 @@
### 1、本插件可免费下载使用
### 2、未经许可严禁复制本插件派生同类插件上传插件市场
### 3、未经许可严禁在插件市场恶意复制抄袭本插件进行违规获利;
### 4、对本软件的任何使用都必须遵守这些条款违反这些条款的个人或组织将面临法律追究。

@ -0,0 +1,85 @@
{
"id": "liu-select",
"displayName": "下拉选择器",
"version": "1.0.2",
"description": "简单好用的下拉选择器,支持多选、单选、自定义数据格式、自定义文字和背景颜色,简单易修改",
"keywords": [
"下拉选择",
"多选",
"下拉框",
"select",
"单选"
],
"repository": "",
"engines": {
"HBuilderX": "^3.1.0"
},
"dcloudext": {
"type": "component-vue",
"sale": {
"regular": {
"price": "0.00"
},
"sourcecode": {
"price": "0.00"
}
},
"contact": {
"qq": ""
},
"declaration": {
"ads": "无",
"data": "无",
"permissions": "无"
},
"npmurl": ""
},
"uni_modules": {
"dependencies": [],
"encrypt": [],
"platforms": {
"cloud": {
"tcb": "y",
"aliyun": "y"
},
"client": {
"Vue": {
"vue2": "y",
"vue3": "u"
},
"App": {
"app-vue": "u",
"app-nvue": "u"
},
"H5-mobile": {
"Safari": "y",
"Android Browser": "y",
"微信浏览器(Android)": "y",
"QQ浏览器(Android)": "y"
},
"H5-pc": {
"Chrome": "y",
"IE": "u",
"Edge": "y",
"Firefox": "y",
"Safari": "y"
},
"小程序": {
"微信": "y",
"阿里": "u",
"百度": "u",
"字节跳动": "u",
"QQ": "u",
"钉钉": "u",
"快手": "u",
"飞书": "u",
"京东": "u"
},
"快应用": {
"华为": "u",
"联盟": "u"
}
}
}
}
}

@ -0,0 +1,70 @@
### liu-select适用于uni-app项目的下拉选择组件
### 本组件目前兼容微信小程序、H5
### 本组件是简单好用的下拉选择器,支持多选、单选、自定义数据格式、自定义文字和背景颜色,简单易修改
# --- 扫码预览、关注我们 ---
## 扫码关注公众号,查看更多插件信息,预览插件效果!
![](https://uni.ckapi.pro/uniapp/publicize.png)
``` html
<view @click="openAddress" class="btn">打开选择器</view>
<liu-select ref="scroll" :list="dataList" @change='chooseSuccess'></liu-select>
```
``` javascript
export default {
data() {
return {
dataList: [{
id: 1,
name: '测试1'
}, {
id: 2,
name: '测试2'
}, {
id: 3,
name: '测试3'
}, {
id: 4,
name: '测试4'
}, {
id: 5,
name: '测试5'
}, {
id: 6,
name: '测试6'
}, {
id: 7,
name: '测试7'
}], //数据源
};
},
methods: {
//打开选择器
openAddress() {
this.$refs.scroll.open()
},
//选择成功
chooseSuccess(e) {
console.log('所选择的信息:', e)
}
}
}
```
### 属性说明
| 名称 | 类型 | 默认值 | 描述 |
| ----------------------------|--------------- | -------------------------| ---------------|
| multiple | Boolean | true | 是否多选true:多选 false:单选)
| list | Array | [] | 选择项数据
| selectColor | String | '#FFFFFF' | 选中字体颜色
| noSelectColor | String | '#333333' | 未选中字体颜色
| selectBg | String | '#1890ff' | 选中背景色
| noSelectBg | String | '#f7f7f7' | 未选中背景色
| isMask | Boolean | true | 是否点击阴影关闭
| animation | Boolean | true | 是否开启动画
| safeArea | Boolean | true | 是否开启安全条
| @change | Function | | 选择成功回调事件

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Loading…
Cancel
Save