第一次提交

This commit is contained in:
gxwebsoft
2023-08-04 13:14:48 +08:00
commit 1b923e5cff
1030 changed files with 128016 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
## 1.0.42023-06-09
增加预览信息
## 1.0.32023-06-09
增加预览
## 1.0.22023-04-14
增加示例
## 1.0.12023-03-16
1.0.1
## 1.0.02023-03-14
初始发布

View File

@@ -0,0 +1,365 @@
<template>
<view>
<!-- 弹出层 -->
<view :class="['sel-popup', isShow ? 'sel-open' : '', animation ? 'sel-animation' : '']">
<view class="sel-box">
<view class="sel-top">
<view class="sel-top-left" @click="getResult('cancel')">取消</view>
<view :class="confirmClass" @click="getResult('confirm')">确定</view>
</view>
<view class="sel-title">
<view class="sel-title-item" v-for="(i, e) in tabList" :key="e" @click="checkTab(e)">
<view v-if="tabId >= e" :id="'se-' + e"
:class="tabId == e ? ' sel-title-item-true' : 'sel-title-item-false'">
{{ checkArr[e] ? checkArr[e].label : i.title }}
</view>
</view>
</view>
<scroll-view class="sel-scroll-view_H" scroll-y="true">
<view class="sel-scroll-view-box" v-if="checkBox.length && checkBox[tabId]">
<view class="sel-scroll-view-list" v-for="(item, index) in checkBox[tabId]" :key="index"
@click="check(index)"
:class="checkArr[tabId] ? item.label == checkArr[tabId].label ? 'sel-scroll-view-item-true' : 'sel-scroll-view-item' : 'sel-scroll-view-item'">
{{ item.label }}
</view>
</view>
<view class="sel-scroll-view-noBox" v-else>
<image :src="noDataImg"></image>
<view class="text">暂无数据</view>
</view>
</scroll-view>
<view v-show="safeArea" class="sel-temp"></view>
</view>
</view>
<!-- 遮罩层 -->
<view v-show="isShow" class="sel-mask" @click="isMask ? close() : ''"></view>
</view>
</template>
<script>
// import cityList from '../../city.js';
import noData from '../../static/noData.png'
export default {
props: {
//是否开启动画
animation: {
type: Boolean,
default: true,
},
//是否点击阴影关闭
isMask: {
type: Boolean,
default: true,
},
//是否开启安全条
safeArea: {
type: Boolean,
default: true,
},
},
computed: {
confirmClass() {
return this.checkArr.length == this.tabList.length ? 'sel-top-right-check' : 'sel-top-right';
},
},
data() {
return {
isShow: false,
checkBox: [],
noDataImg: '',
cityList: [],
tabId: 0, //计算当前顶部滑块id
checkArr: [],
id: 0, //通tabId他们2的区别是id先赋值tabId在数据请求成功后才会赋值
tabList: [{
title: '选择所在省',
id: 0,
},
{
title: '选择所在市',
id: 1,
},
{
title: '选择所在县',
id: 2,
}
],
};
},
mounted() {
this.noDataImg = noData
},
methods: {
init() {
// 初始化数据
this.id = 0;
this.tabId = 0;
this.checkBox = [];
this.checkArr = [];
this.getData();
},
open() {
this.isShow = true;
this.init();
},
close() {
this.isShow = false;
},
async check(index) {
this.$set(this.checkArr, this.id, this.checkBox[this.id][index]);
if (this.id < this.tabList.length - 1) this.id = this.id + 1;
await this.getData(); //同步请求
if (this.tabId < this.tabList.length - 1) this.tabId = this.tabId + 1;
},
checkTab(e) {
if (e == this.id) return;
this.id = e;
this.tabId = e;
this.checkArr = this.checkArr.splice(0, e);
},
getResult(event) {
if (event == 'confirm') {
if (this.checkArr.length != this.tabList.length) return;
let result = this.checkArr;
this.$emit('change', {
value: result
});
}
this.close();
},
async getData() {
// 加载数据
if (this.checkArr.length == this.tabList.length) return;
// 模拟数据
let list = [];
uni.showLoading({
title: '加载中...'
});
if (this.checkArr.length) {
var id = this.checkArr?.[this.id - 1]?.value
let idList = this.checkBox?.[this.id - 1]?.find(item => {
return item.value == id;
})
idList?.children.map(e => {
list.push(e);
});
uni.hideLoading();
this.$set(this.checkBox, this.id, list)
} else {
// 接口请求数据实例--------------
// console.log("cityList: ",this.cityList);
uni.request({
url: 'https://file.wsdns.cn/json/city.js',
success(res) {
res.data.map(e => {
list.push(e);
});
}
})
// this.cityList.map(e => {
// list.push(e);
// });
uni.hideLoading();
this.$set(this.checkBox, this.id, list)
}
//接口请求数据实例--------------
// let params = {
// code: this.checkArr && this.checkArr.length > 0 ? this.checkArr[this.checkArr.length - 1]
// .code : ''
// };
// await getData(params).then(res => {
// if (res.code == 200) {
// this.$set(this.checkBox, this.id, res.data);
// } else {
// this.$set(this.checkBox, this.id, []);
// }
// uni.hideLoading()
// })
},
},
};
</script>
<style>
/deep/ ::-webkit-scrollbar {
width: 0;
height: 0;
color: transparent;
display: none;
}
</style>
<style lang="scss" scoped>
/* 弹出层默认样式 */
.sel-popup {
width: 100%;
position: fixed;
bottom: -100%;
z-index: 999;
}
/* 点击按钮是将盒子 bottom 值归零即可实现弹出效果,
同理如需更改弹出方向只需将bottom改成top、left、right即可
(默认样式的方向也需一起更改哦) */
.sel-open {
bottom: 0px !important;
}
.sel-animation {
transition: all 0.25s linear;
}
/* 遮罩层样式 */
.sel-mask {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.3);
z-index: 998;
}
.sel-box {
position: absolute;
bottom: 0;
width: 100%;
background: #ffff;
border-radius: 12rpx 12px 0 0;
}
.sel-temp {
padding-bottom: env(safe-area-inset-bottom);
}
.sel-top {
height: 88rpx;
line-height: 88rpx;
display: flex;
justify-content: space-between;
margin: 28rpx 32rpx 0rpx 32rpx;
}
.sel-top-left {
font-size: 30rpx;
color: #999;
height: 68rpx;
line-height: 68rpx;
}
.sel-top-right {
height: 68rpx;
color: #999;
line-height: 68rpx;
font-size: 30rpx;
}
.sel-top-right-check {
height: 68rpx;
color: #3f72f4;
line-height: 68rpx;
font-size: 30rpx;
}
.sel-title {
height: 96rpx;
line-height: 96rpx;
background-color: #ffffff;
display: grid;
grid-template-columns: repeat(3, 33.33333%);
border-bottom: solid #f0f0f0 1rpx;
border-top: solid #f0f0f0 1rpx;
}
.sel-scroll-view_H {
white-space: nowrap;
width: 100%;
height: 500rpx;
line-height: 100rpx;
background-color: #ffffff;
}
.sel-title-item {
margin: 0 22rpx;
font-size: 34rpx;
text-align: center;
color: #333333;
}
.sel-title-item-false {
font-size: 30rpx;
text-align: center;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
.sel-title-item-true {
font-size: 30rpx;
font-weight: 700;
color: #3f72f4;
}
.sel-scroll-view-box {
display: grid;
grid-template-columns: repeat(4, 25%);
padding: 10rpx 10rpx;
.sel-scroll-view-list {
margin: 10rpx;
background: #f3f3f3;
height: 72rpx;
border-radius: 8rpx;
line-height: 72rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 30rpx;
color: #333333;
}
}
.sel-scroll-view-noBox {
width: 100%;
height: 400rpx;
image {
width: 240rpx;
height: 200rpx;
margin: 0 255rpx;
margin-top: 32rpx;
}
.text {
width: 100%;
text-align: center;
color: #888;
}
}
.sel-scroll-view-item {
display: inline-block;
padding: 0 8rpx;
text-align: center;
border-radius: 16rpx;
font-size: 24rpx;
margin: 24rpx;
height: 48rpx;
line-height: 48rpx;
}
.sel-scroll-view-item-true {
display: inline-block;
padding: 0 8rpx;
text-align: center;
border-radius: 16rpx;
margin: 24rpx;
font-size: 24rpx;
background-color: #3f72f4 !important;
color: #ffffff !important;
height: 48rpx;
line-height: 48rpx;
}
</style>

View File

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

View File

@@ -0,0 +1,81 @@
{
"id": "liu-customize-sel",
"displayName": "省市区地址选择、三级联动地址选择、多级联动地址选择、地址选择器、多级选择器",
"version": "1.0.4",
"description": "地址选择器常用于省市县小区选择自带动画效果脱离uni-popup可在任何地方直接应用自带省市区",
"keywords": [
"liu-customize-sel"
],
"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": "u",
"IE": "u",
"Edge": "u",
"Firefox": "u",
"Safari": "u"
},
"小程序": {
"微信": "y",
"阿里": "u",
"百度": "u",
"字节跳动": "u",
"QQ": "u",
"钉钉": "u",
"快手": "u",
"飞书": "u",
"京东": "u"
},
"快应用": {
"华为": "u",
"联盟": "u"
}
}
}
}
}

View File

@@ -0,0 +1,44 @@
### liu-customize-sel适用于uni-app项目的省市区三级选择组件
### 本组件目前兼容微信小程序、H5
### 本组件地址选择器常用于省市县、小区选择自带动画效果脱离uni-popup可在任何地方直接应用自带省市区
# --- 扫码预览、关注我们 ---
## 扫码关注公众号,查看更多插件信息,预览插件效果!
![](https://uni.ckapi.pro/uniapp/publicize.png)
### 使用方式
``` html
<button @click="openAddress">打开地址选择器</button>
<liu-customize-sel ref="scroll" @change='chooseSuccess'></liu-customize-sel>
```
``` javascript
export default {
data() {
return {
};
},
methods: {
//打开地址选择器
openAddress() {
this.$refs.scroll.open()
},
//地址选择成功
chooseSuccess(e) {
console.log('所选择的地址信息:', e)
}
}
}
```
### 属性说明
| 名称 | 类型 | 默认值 | 描述 |
| ----------------------------|--------------- | ---------------------- | ---------------|
| animation | Boolean | true | 是否开启动画
| safeArea | Boolean | true | 是否开启安全条
| isMask | Boolean | true | 是否点击阴影关闭
| @change | Function | | 选择成功回调事件

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB