1
This commit is contained in:
2
uni_modules/z-address-popup/changelog.md
Normal file
2
uni_modules/z-address-popup/changelog.md
Normal file
@@ -0,0 +1,2 @@
|
||||
## 1.0.0(2021-05-12)
|
||||
1. 支持uni_modules
|
||||
@@ -0,0 +1,108 @@
|
||||
<template>
|
||||
<z-popup v-model="currentValue">
|
||||
<view class="addresTitle">
|
||||
<text @click="currentValue = false">取消</text>
|
||||
<view>所在地区</view>
|
||||
<text @click="onConfirm">确定</text>
|
||||
</view>
|
||||
<z-address :dataList="addressVal" @change="addressChange" :length="length" :force="force"></z-address>
|
||||
</z-popup>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
dataList: {
|
||||
type: Array,
|
||||
default() {
|
||||
return [];
|
||||
}
|
||||
},
|
||||
value: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
length: {
|
||||
type: Number,
|
||||
default: 3
|
||||
},
|
||||
force:{
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
},
|
||||
created() {
|
||||
if (typeof this.value !== 'undefined') {
|
||||
this.currentValue = this.value;
|
||||
}
|
||||
if (this.dataList instanceof Array) {
|
||||
this.addressVal = this.dataList;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
value(val) {
|
||||
this.currentValue = val;
|
||||
},
|
||||
currentValue(val) {
|
||||
this.$emit(val ? 'on-show' : 'on-hide');
|
||||
this.$emit('input', val);
|
||||
},
|
||||
dataList(val) {
|
||||
this.addressVal = val;
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
currentValue: false,
|
||||
//选出的值
|
||||
addressVal: []
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
addressChange(val) {
|
||||
console.log(val);
|
||||
this.addressVal = val;
|
||||
},
|
||||
onConfirm() {
|
||||
if (parseInt(this.length) <= this.addressVal.length || !this.force && this.addressVal.length > 0) {
|
||||
this.currentValue = false;
|
||||
this.$emit('change', this.addressVal);
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '请选择',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import '@/style/mixin.scss';
|
||||
.addresTitle {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
height: 88upx;
|
||||
line-height: 88upx;
|
||||
border-bottom: 2upx solid #ebebeb;
|
||||
padding: 0 20upx;
|
||||
background-color: #FFF;
|
||||
}
|
||||
.addresTitle view {
|
||||
font-size: 32upx;
|
||||
}
|
||||
.addresTitle text {
|
||||
width: 80upx;
|
||||
flex-shrink: 0;
|
||||
text-align: center;
|
||||
}
|
||||
.addresTitle text {
|
||||
font-size: 28upx;
|
||||
color: #999;
|
||||
}
|
||||
.addresTitle text:last-child {
|
||||
color: $themeColor;
|
||||
}
|
||||
</style>
|
||||
78
uni_modules/z-address-popup/package.json
Normal file
78
uni_modules/z-address-popup/package.json
Normal file
@@ -0,0 +1,78 @@
|
||||
{
|
||||
"id": "z-address",
|
||||
"displayName": "三级联动弹窗,地址选择弹窗,可选长度",
|
||||
"version": "1.0.0",
|
||||
"description": "三级联动,地址选择,可选长度",
|
||||
"keywords": [
|
||||
"三级联动弹窗",
|
||||
"地址选择弹窗",
|
||||
"地区选择弹窗"
|
||||
],
|
||||
"repository": "https://github.com/zhouwei1994/uni-app-demo",
|
||||
"engines": {
|
||||
"HBuilderX": "^3.0.0"
|
||||
},
|
||||
"dcloudext": {
|
||||
"category": [
|
||||
"前端组件",
|
||||
"通用组件"
|
||||
],
|
||||
"sale": {
|
||||
"regular": {
|
||||
"price": "0.00"
|
||||
},
|
||||
"sourcecode": {
|
||||
"price": "0.00"
|
||||
}
|
||||
},
|
||||
"contact": {
|
||||
"qq": "465081029"
|
||||
},
|
||||
"declaration": {
|
||||
"ads": "无",
|
||||
"data": "无",
|
||||
"permissions": "无"
|
||||
},
|
||||
"npmurl": ""
|
||||
},
|
||||
"uni_modules": {
|
||||
"dependencies": [],
|
||||
"encrypt": [],
|
||||
"platforms": {
|
||||
"cloud": {
|
||||
"tcb": "y",
|
||||
"aliyun": "y"
|
||||
},
|
||||
"client": {
|
||||
"App": {
|
||||
"app-vue": "y",
|
||||
"app-nvue": "y"
|
||||
},
|
||||
"H5-mobile": {
|
||||
"Safari": "y",
|
||||
"Android Browser": "y",
|
||||
"微信浏览器(Android)": "y",
|
||||
"QQ浏览器(Android)": "y"
|
||||
},
|
||||
"H5-pc": {
|
||||
"Chrome": "y",
|
||||
"IE": "y",
|
||||
"Edge": "y",
|
||||
"Firefox": "y",
|
||||
"Safari": "y"
|
||||
},
|
||||
"小程序": {
|
||||
"微信": "y",
|
||||
"阿里": "y",
|
||||
"百度": "y",
|
||||
"字节跳动": "y",
|
||||
"QQ": "y"
|
||||
},
|
||||
"快应用": {
|
||||
"华为": "u",
|
||||
"联盟": "u"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
28
uni_modules/z-address-popup/readme.md
Normal file
28
uni_modules/z-address-popup/readme.md
Normal file
@@ -0,0 +1,28 @@
|
||||
# 三级联动弹窗,地址选择弹窗,可选长度
|
||||
|
||||
三级联动弹窗,地址选择弹窗,可选长度
|
||||
|
||||
| `QQ交流群(607391225)` | `微信交流群(加我好友备注"进群")` |
|
||||
| ----------------------------|--------------------------- |
|
||||
|||
|
||||
| QQ群号:607391225 |微信号:zhou0612wei|
|
||||
|
||||
### [点击跳转-5年的web前端开源的uni-app快速开发模板-下载看文档](https://ext.dcloud.net.cn/plugin?id=2009)
|
||||
|
||||
### 案例一
|
||||
```
|
||||
<z-address-popup v-model="true" :dataList="[]" @change="addressChange" :length="3" :force="force"></z-address-popup>
|
||||
```
|
||||
|
||||
### 属性
|
||||
| 名称 | 类型 | 默认值 | 描述 |
|
||||
| ----------------------------|--------------- | ------------- | ---------------------------------------------------|
|
||||
| dataList | Array | [] | 默认值|
|
||||
| length | Number | 3 | 地区选择长度(1-3) |
|
||||
| force | Boolean | true | 强制选择,选择长度必须达到指定长度|
|
||||
| value | Boolean | false | 控制弹窗是否打开 |
|
||||
|
||||
### 事件
|
||||
| 名称 | 类型 | 描述 |
|
||||
| -----------------|------------------ | --------------------------|
|
||||
| @change | function | 选择时数据返回 |
|
||||
Reference in New Issue
Block a user