import { use } from '../utils'; import Button from '../button'; import RadioGroup from '../radio-group'; import AddressItem from './Item'; const [sfc, bem, t] = use('address-list'); export default sfc({ props: { list: Array, disabledList: Array, disabledText: String, addButtonText: String, value: [String, Number], switchable: { type: Boolean, default: true } }, render(h) { const getList = (list, disabled) => list.map((item, index) => ( { this.$emit(disabled ? 'select-disabled' : 'select', item, index); }} onEdit={() => { this.$emit(disabled ? 'edit-disabled' : 'edit', item, index); }} /> )); const List = getList(this.list); const DisabledList = getList(this.disabledList, true); return (
{this.$slots.top} this.$emit('input', event)}> {List} {this.disabledText &&
{this.disabledText}
} {DisabledList} {this.$slots.default}
); } });