1c5f2e1311dfbf7985c9a43c4f00b458b08490b5c2c6f380749d0dbb570993d027d401fc88d65f13f551e0201c946d3471f9c200a539bd0c7bb6d83501186c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import { defineComponent, computed, openBlock, createElementBlock, normalizeClass, unref, renderSlot } from 'vue';
  2. import { checkTagProps, checkTagEmits } from './check-tag.mjs';
  3. import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
  4. import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
  5. import { CHANGE_EVENT } from '../../../constants/event.mjs';
  6. const __default__ = defineComponent({
  7. name: "ElCheckTag"
  8. });
  9. const _sfc_main = /* @__PURE__ */ defineComponent({
  10. ...__default__,
  11. props: checkTagProps,
  12. emits: checkTagEmits,
  13. setup(__props, { emit }) {
  14. const props = __props;
  15. const ns = useNamespace("check-tag");
  16. const isDisabled = computed(() => props.disabled);
  17. const containerKls = computed(() => [
  18. ns.b(),
  19. ns.is("checked", props.checked),
  20. ns.is("disabled", isDisabled.value),
  21. ns.m(props.type || "primary")
  22. ]);
  23. const handleChange = () => {
  24. if (isDisabled.value)
  25. return;
  26. const checked = !props.checked;
  27. emit(CHANGE_EVENT, checked);
  28. emit("update:checked", checked);
  29. };
  30. return (_ctx, _cache) => {
  31. return openBlock(), createElementBlock("span", {
  32. class: normalizeClass(unref(containerKls)),
  33. onClick: handleChange
  34. }, [
  35. renderSlot(_ctx.$slots, "default")
  36. ], 2);
  37. };
  38. }
  39. });
  40. var CheckTag = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "check-tag.vue"]]);
  41. export { CheckTag as default };
  42. //# sourceMappingURL=check-tag2.mjs.map