# yuArea 地区级联选择器
WARNING
组件默认从public/plugins/Area.min.js
中加载全部省市区数据,本地开发环境需要在.env.development
环境配置文件中VUE_APP_COMM_RES_SRC
变量配置为终端服务地址,生产环境中,数据默认从公共资源包中加载。
# 效果预览
# 选择省市区
<template>
<yu-area label="地址" regionCode="140109" @confirm="confirmArea" columnsNum="3"></yu-area>
<template>
<script>
import yuArea from '@/components/yu-area/index.vue';
export default {
components: {
yuArea
},
data() {
},
methods: {
cancel() {
// 取消
},
confirmArea(data) {
console.log('选中的地址:', data.value, data.code);
}
},
}
</script>
# Attributes
参数 | 说明 | 类型 | 可选值 | 默认值 |
---|---|---|---|---|
regionCode | 地区码前两位代表省份,中间两位代表城市,后两位代表区县,以 0 补足 6 位。比如北京的地区码为 11,以 0 补足 6 位,为 110000 | string | - | - |
label | 标题 | String | - | - |
title | 选择器标题 | string | - | 地区 |
placeholder | 选择器提示描述 | string | - | 请选择 |
cancelBtntext | 取消按钮文字 | string | - | 取消 |
confirmBtntext | 确定按钮文字 | string | - | 确定 |
# events
方法名 | 说明 | 参数 |
---|---|---|
confirm | 确定按钮触发 | {code: '', value: ''} |
cancel | 取消按钮触发 | - |