WebApp【公共组件库】@前端(For Git Submodule)
Tevin
2023-08-17 bbf650c05d393447f8ff4afb7e6e21f109281c7b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/**
 * CFilterInput - 筛选项目,单选
 * @author Tevin
 */
 
<template>
    <view
        class="c-filter-input"
        :class="'type-'+type"
    >
        <view class="label">{{label}}</view>
        <AtInput
            type="text"
            :placeholder="'请输入' + label"
            :value="value"
            :onChange="evt => handleChange(evt)"
        />
    </view>
</template>
 
<script>
import Taro from '@tarojs/taro';
import { AtInput } from 'taro-ui-vue';
import './cFilterInput.scss';
 
export default {
    name: 'CFilterInput',
    components: {
        AtInput,
    },
    props: {
        type: String,
        label: String,
        value: String,
        onChange: Function,
    },
    data() {
        return {};
    },
    methods: {
        handleChange(value) {
            if (value) {
                this.onChange(value);
            } else {
                this.onChange(undefined);
            }
        },
    },
    mounted() {},
};
</script>