DropDownMenu.san 1.1 KB
Newer Older
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
<template>
    <div class="sm-form-item">
        <label class="label">{{label}}</label>
        <san-drop-down-menu
            error="{{error}}"
            disabled="{{disabled}}"
            value="{=value=}"
            maxHeight="{{200}}"
            autoWidth="{{false}}">
            <san-menu-item
                s-for="item in items"
                on-change="menuItemChange(item)"
                value="{{item.value}}"
                label="{{item.name}}" />
        </sm-drop-down-menu>
    </div>
</template>
<script>
import {DataTypes} from 'san';
import {MenuItem, DropDownMenu} from 'san-mui/Menu';
export default {
    components: {
        'san-menu-item': MenuItem,
        'san-drop-down-menu': DropDownMenu
    },
    dataTypes: {
        value: DataTypes.string,
        items: DataTypes.array,
        disabled: DataTypes.bool
    },
    menuItemChange(item) {
        let value = item.value;
        this.fire('valueChange', value);
        this.dispatch('UI:form-item-change');
    },
    initData() {
        return {
            value: '',
            items: []
        };
    }
};
</script>