WebApp【公共组件库】@前端(For Git Submodule)
Tevin
2020-12-01 c4c9a03d3ba029b613d64a6514c132d28636d1c5
forms/select/CSelect.vue
@@ -7,8 +7,9 @@
    <view class="c-select">
        <picker
            mode="selector"
            :range="range"
            :range="options"
            :value="current"
            range-key="name"
            @change="evt=>handleChange(evt.detail)"
        >
            <AtInput
@@ -41,13 +42,11 @@
        itemData: Object,
    },
    data() {
        return {
            optionKey: typeof this.options[0].value === 'undefined' ? 'id' : 'value',
        };
        return {};
    },
    computed: {
        range() {
            return (this.options || []).map((item) => item.name || item[this.optionKey]);
        optionKey() {
            return typeof (this.options[0] || {}).value === 'undefined' ? 'id' : 'value';
        },
        current() {
            const curVal = this.itemData.formData[this.itemData.name];