更新记录

1.0.1(2019-12-23)

弥补自带pcker组件在被选择集合为复杂集合时使用的的不便 仅需初始化组件即可进行v-model双向绑定


平台兼容性

cc-picker

参考源码

View
<template>
    <view>
        <view class="form">
            <view class="form-row">
                <label class="title"><text class="red">*</text>国籍:</label>
                <ccPicker class="item" :range="list_country" v-model="person.country" @picker_change="country_change"></ccPicker>
            </view>
            <view class="form-row">
                <label class="title"><text class="red">*</text>性别:</label>
                <ccPicker class="item" :range="list_sex" k="text" v="id" null_str="不限" null_val="0" v-model="person.sex" @picker_change="sex_change"></ccPicker>
            </view>
        </view>
        <view class="form">
            <view class="form-row">
                <label class="title">国籍:</label>
                <view class="item">{{ person.country_str }}</view>
            </view>
            <view class="form-row">
                <label class="title">性别:</label>
                <view class="item">{{ person.sex_str }}</view>
            </view>
        </view>
    </view>
</template>
Javascrip
    import ccPicker from "@/components/cc-picker/cc-picker.vue"
    export default {
        components: {
            ccPicker
        },
        data() {
            return {
                person: {
                    sex: '1',
                    sex_str: '',
                    country: '1',
                    country_str: '',
                },
                list_country: [
                    { V: '1', K: '中国' },
                    { V: '2', K: '美国' },
                    { V: '3', K: '英国' },
                    { V: '4', K: '韩国' }
                ],
                list_sex: [
                    { id: '1', text: '男' },
                    { id: '2', text: '女' }
                ]
            }
        },
        methods: {
            country_change(e) {
                this.person.country_str = e.new_k;
            },
            sex_change(e) {
                this.person.sex_str = e.new_k;
            }
        }
    }

属性

名称 类型 是否必须 默认值 说明
range Array 被选择的集合
k string K 选择列表项显示的字符
v string V 选择列表项的值
null_str string 空选项显示的字符
null_val string 空选项的值

事件

名称 参数 说明
@picker_change new_v:新选项的值;new_k:新选项显示的字符 选中项发生改变时触发

隐私、权限声明

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

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

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

许可协议

MIT协议

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