// 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 }) {
const renderItem = (item, index) => {
const onClick = () => {
emit('update:modelValue', item.id);
emit('select', item, index);
};
const renderRightIcon = () => (
);
const renderEditIcon = () => (
{
event.stopPropagation();
emit('edit', item, index);
}}
/>
);
const renderContent = () => {
const nodes = [`${item.name},${item.tel}`];
if (item.isDefault && props.defaultTagText) {
nodes.push(
{props.defaultTagText}
);
}
return nodes;
};
return (
|
);
};
return () => (
{props.list && props.list.map(renderItem)}
);
},
});