更新记录

1.0.2(2020-09-09)

通过json数据渲染picker组件 1.未完全组件化,可能需要按照json格式做一些对应修改; 2.cityType="black" 或 cityType="white" 选择黑白样式; 3.多级列表可根据需求自行删除或添加(主逻辑在此函数中multiPicker(multiIndex, multiArray) );

1.0.0(2020-09-04)

2020-09-04


平台兼容性

通过json数据渲染picker组件
1.未完全组件化,可能需要按照json格式做一些对应修改;
2.cityType="black" 或 cityType="white" 选择黑白样式;
3.多级列表可根据需求自行删除或添加(主逻辑在此函数中multiPicker(multiIndex, multiArray) );

    import tudiPicker from '@/components/tudi-picker/picker.vue'
    import {
        cityData
    } from './city.js'
    export default {
        data() {
            return {
                // 地区选择
                multiIndex: [0, 0, 0],
                cityText: "地区",
                cityId: '',
            }
        },
        computed: {
            cityData: () => cityData,
        },
        methods: {
            init() {

            },
            reload() {

            },
            // 地区选择
            multiPickerChange: function(e) {
                let row = e.detail.value;
                console.log(row)
                this.multiIndex = row;
                if (this.cityData[row[0]].children[row[1]].children && this.cityData[row[0]].children[row[1]].children.length) {
                    this.cityText = this.cityData[row[0]].children[row[1]].children[row[2]].label;
                    this.cityId = this.cityData[row[0]].children[row[1]].children[row[2]].value;
                    // this.cityText = this.cityFormat(this.cityText);
                } else if (this.cityData[row[0]].children && this.cityData[row[0]].children.length) {
                    this.cityText = this.cityData[row[0]].children[row[1]].label;
                    this.cityId = this.cityData[row[0]].children[row[1]].value;
                    this.cityText = this.cityFormat(this.cityText);
                } else {
                    this.cityText = this.cityData[row[0]].label;
                    this.cityId = this.cityData[row[0]].value;
                    this.cityText = this.cityFormat(this.cityText);
                }
            },
            cityFormat(cityText) {
                // 城市 文本处理  一二级城市时需处理
                if (cityText.indexOf('区') != -1) {
                    cityText = this.cityData[this.multiIndex[0]].label;
                    this.cityId = this.cityData[this.multiIndex[0]].value;
                }
                if (cityText.indexOf('市') != -1) {
                    cityText = cityText.slice(0, -1);
                }
                return cityText;
            },
        },
        components: {
            tudiPicker,
        },
        onLoad() {
            this.init()
        },
        onShow() {},

    }

隐私、权限声明

1. 本插件需要申请的系统权限列表:

2. 本插件采集的数据、发送的服务器地址、以及数据用途说明:

插件不采集任何数据

3. 本插件是否包含广告,如包含需详细说明广告表达方式、展示频率:

许可协议

MIT协议

暂无用户评论。

使用中有什么不明白的地方,就向插件作者提问吧~ 我要提问