1 line
7.8 KiB
Plaintext
1 line
7.8 KiB
Plaintext
|
{"version":3,"file":"wd-popover.js","sources":["../../../../../../../node_modules/wot-design-uni/components/wd-popover/wd-popover.vue","../../../../../../../uniComponent:/RDovQXBwL1dvcmsvYWRkci9hY2RyLXVpL25vZGVfbW9kdWxlcy93b3QtZGVzaWduLXVuaS9jb21wb25lbnRzL3dkLXBvcG92ZXIvd2QtcG9wb3Zlci52dWU"],"sourcesContent":["<template>\n <view :class=\"`wd-popover ${customClass}`\" :style=\"customStyle\" id=\"popover\" @click.stop=\"popover.noop\">\n <!-- TODO 插槽情况监听会有问题 待调整, 用于为渲染获取宽高的元素 -->\n <view class=\"wd-popover__pos wd-popover__hidden\" id=\"pos\">\n <view :class=\"`wd-popover__container ${customPop}`\">\n <view v-if=\"!useContentSlot && mode === 'normal'\" class=\"wd-popover__inner\">\n {{ content }}\n </view>\n <view v-if=\"!useContentSlot && mode === 'menu' && typeof content === 'object'\" class=\"wd-popover__menu\">\n <view v-for=\"(item, index) in content\" :key=\"index\" class=\"wd-popover__menu-inner\" @click=\"menuClick(index)\">\n <wd-icon v-if=\"item.iconClass\" :name=\"item.iconClass\" custom-class=\"wd-popover__icon\" />\n <text>{{ item.content }}</text>\n </view>\n </view>\n </view>\n </view>\n <wd-transition custom-class=\"wd-popover__pos\" :custom-style=\"popover.popStyle.value\" :show=\"modelValue\" name=\"fade\" :duration=\"200\">\n <view :class=\"`wd-popover__container ${customPop}`\">\n <view\n v-if=\"props.visibleArrow\"\n :class=\"`wd-popover__arrow ${popover.arrowClass.value} ${customArrow}`\"\n :style=\"popover.arrowStyle.value\"\n ></view>\n <!-- 普通模式 -->\n <view v-if=\"!useContentSlot && mode === 'normal'\" class=\"wd-popover__inner\">\n {{ content }}\n </view>\n <!-- 列表模式 -->\n <view v-if=\"!useContentSlot && mode === 'menu'\" class=\"wd-popover__menu\">\n <view\n v-for=\"(item, index) in content\"\n :key=\"index\"\n class=\"wd-popover__menu-inner\"\n @click=\"menuClick(index)\"\n :style=\"index === 0 ? 'border-top: none' : ''\"\n >\n <wd-icon v-if=\"typeof item === 'object' && item.iconClass\" :name=\"item.iconClass\" custom-class=\"wd-popover__icon\" />\n <view style=\"display: inline-block\">{{ typeof item === 'object' && item.content ? item.content : '' }}</view>\n </view>\n </view>\n <!-- 用户自定义样式 -->\n <slot name=\"content\" v-else />\n </view>\n <wd-icon v-if=\"showClose\" name=\"close\" custom-class=\"wd-popover__close-icon\" @click=\"toggle\"></wd-icon>\n </wd-transition>\n <view @click=\"toggle\" class=\"wd-popover__target\" id=\"target\">\n <slot />\n </view>\n </view>\n</template>\n\n<script lang=\"ts\">\nexport default {\n name: 'wd-popover',\n options: {\n virtualHost: true,\n addGlobalClass: true,\n styleIsolation: 'shared'\n }\n}\n</script>\n\n<script lang=\"ts\" setup>\nimport { getCurrentInstance, inject, onBeforeMount, onBeforeUnmount, onMounted, watch } from 'vue'\nimport { usePopover } from '../composables/usePopover'\nimport { closeOther, pushToQueue, removeFromQueue } from '../common/clickoutside'\nimport { type Queue, queueKey } from '../composables/useQueue'\nimport { popoverProps, type PopoverExpose } from './types'\nimport { isArray } from '../common/util'\n\nconst props = defineProps(popoverProps)\nconst emit = defineEmits(['update:modelValue', 'menuclick', 'change', 'open', 'close'])\n\nconst queue = inject<Queue | null>(queueKey, null)\n\nconst selector: string = 'popover'\nconst { proxy } = getCurrentInstance() as any\n\nwatch(\n () => props.content,\n (newVal) => {\n const { mode } = props\n if (selector === 'popover' && mode === 'normal' && typeof newVal !== 'string') {\n console.error('The value type must be a string type in normal mode')\n } else if (selector === 'popover' && mode === 'menu' && !isArray(newVal)) {\n conso
|