// Utils import { createNamespace } from '../utils'; import { RED } from '../utils/constant'; // Components import Tag from '../tag'; import Icon from '../icon'; import Cell from '../cell'; import Radio from '../radio'; import Button from '../button'; import RadioGroup from '../radio-group'; const [createComponent, bem, t] = createNamespace('contact-list'); export default createComponent({ props: { list: Array, addText: String, modelValue: null, defaultTagText: String, }, emits: ['add', 'edit', 'select', 'update:modelValue'], setup(props, { emit }) { return () => { const List = props.list && props.list.map((item, index) => { function onClick() { emit('update:modelValue', item.id); emit('select', item, index); } function RightIcon() { return ( ); } function LeftIcon() { return ( { event.stopPropagation(); emit('edit', item, index); }} /> ); } function Content() { const nodes = [`${item.name},${item.tel}`]; if (item.isDefault && props.defaultTagText) { nodes.push( {props.defaultTagText} ); } return nodes; } return ( ); }); return (
{List}
); }; }, });