| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- import { d as defineComponent, c as createVNode, L as Transition } from "./index-5e4623ce.js";
- import { c as createNamespace, t as truthProp, z as makeStringProp, H as HAPTICS_FEEDBACK, I as Icon, w as withInstall } from "./index-487cde8c.js";
- const [name, bem] = createNamespace("tag");
- const tagProps = {
- size: String,
- mark: Boolean,
- show: truthProp,
- type: makeStringProp("default"),
- color: String,
- plain: Boolean,
- round: Boolean,
- textColor: String,
- closeable: Boolean
- };
- var stdin_default = defineComponent({
- name,
- props: tagProps,
- emits: ["close"],
- setup(props, {
- slots,
- emit
- }) {
- const onClose = (event) => {
- event.stopPropagation();
- emit("close", event);
- };
- const getStyle = () => {
- if (props.plain) {
- return {
- color: props.textColor || props.color,
- borderColor: props.color
- };
- }
- return {
- color: props.textColor,
- background: props.color
- };
- };
- const renderTag = () => {
- var _a;
- const {
- type,
- mark,
- plain,
- round,
- size,
- closeable
- } = props;
- const classes = {
- mark,
- plain,
- round
- };
- if (size) {
- classes[size] = size;
- }
- const CloseIcon = closeable && createVNode(Icon, {
- "name": "cross",
- "class": [bem("close"), HAPTICS_FEEDBACK],
- "onClick": onClose
- }, null);
- return createVNode("span", {
- "style": getStyle(),
- "class": bem([classes, type])
- }, [(_a = slots.default) == null ? void 0 : _a.call(slots), CloseIcon]);
- };
- return () => createVNode(Transition, {
- "name": props.closeable ? "van-fade" : void 0
- }, {
- default: () => [props.show ? renderTag() : null]
- });
- }
- });
- const Tag = withInstall(stdin_default);
- const index = "";
- export {
- Tag as T
- };
|