acdr-ui/dist/dev/mp-weixin/node-modules/wot-design-uni/components/wd-toast/wd-toast.js.map

1 line
8.4 KiB
Plaintext

{"version":3,"file":"wd-toast.js","sources":["../../../../../../../node_modules/wot-design-uni/components/wd-toast/wd-toast.vue","../../../../../../../uniComponent:/RDovQXBwL1dvcmsvYWRkci9hY2RyLXVpL25vZGVfbW9kdWxlcy93b3QtZGVzaWduLXVuaS9jb21wb25lbnRzL3dkLXRvYXN0L3dkLXRvYXN0LnZ1ZQ"],"sourcesContent":["<template>\n <wd-overlay v-if=\"cover\" :z-index=\"zIndex\" lock-scroll :show=\"show\" custom-style=\"background-color: transparent;pointer-events: auto;\"></wd-overlay>\n <wd-transition name=\"fade\" :show=\"show\" :custom-style=\"transitionStyle\" @after-enter=\"handleAfterEnter\" @after-leave=\"handleAfterLeave\">\n <view :class=\"rootClass\">\n <!--iconName优先级更高-->\n <wd-loading v-if=\"iconName === 'loading'\" :type=\"loadingType\" :color=\"loadingColor\" custom-class=\"wd-toast__icon\" :customStyle=\"loadingStyle\" />\n <view\n class=\"wd-toast__iconWrap wd-toast__icon\"\n v-else-if=\"iconName === 'success' || iconName === 'warning' || iconName === 'info' || iconName === 'error'\"\n :style=\"`width:${iconSize}px; height:${iconSize}px`\"\n >\n <view class=\"wd-toast__iconBox\">\n <view class=\"wd-toast__iconSvg\" :style=\"`background-image: url(${svgStr}); width:${iconSize}px; height:${iconSize}px`\"></view>\n </view>\n </view>\n <view v-else-if=\"customIcon\" class=\"wd-toast__icon custom-icon-class\" />\n <!--文本-->\n <view v-if=\"msg\" class=\"wd-toast__msg\">{{ msg }}</view>\n </view>\n </wd-transition>\n</template>\n\n<script lang=\"ts\">\nexport default {\n name: 'wd-toast',\n options: {\n addGlobalClass: true,\n virtualHost: true,\n styleIsolation: 'shared'\n }\n}\n</script>\n\n<script lang=\"ts\" setup>\nimport { computed, inject, onBeforeMount, ref, watch, type CSSProperties } from 'vue'\nimport base64 from '../common/base64'\nimport { defaultOptions, toastDefaultOptionKey, toastIcon } from '.'\nimport { toastProps, type ToastLoadingType, type ToastOptions } from './types'\nimport { isDef, isFunction, objToStyle } from '../common/util'\n\nconst props = defineProps(toastProps)\n\nconst iconName = ref<string>('') // 图标类型\nconst customIcon = ref<boolean>(false)\nconst msg = ref<string>('') // 消息内容\nconst position = ref<string>('middle')\nconst show = ref<boolean>(false)\nconst zIndex = ref<number>(100)\nconst loadingType = ref<ToastLoadingType>('outline')\nconst loadingColor = ref<string>('#4D80F0')\nconst iconSize = ref<number>(42)\nconst svgStr = ref<string>('') // 图标\nconst cover = ref<boolean>(false) // 是否存在遮罩层\n\nlet opened: (() => void) | null = null\n\nlet closed: (() => void) | null = null\n\nconst toastOptionKey = props.selector ? toastDefaultOptionKey + props.selector : toastDefaultOptionKey\nconst toastOption = inject(toastOptionKey, ref<ToastOptions>(defaultOptions)) // toast选项\n\n// 监听options变化展示\nwatch(\n () => toastOption.value,\n (newVal: ToastOptions) => {\n reset(newVal)\n },\n {\n deep: true,\n immediate: true\n }\n)\n\n// 监听options变化展示\nwatch(\n () => iconName.value,\n () => {\n buildSvg()\n },\n {\n deep: true,\n immediate: true\n }\n)\n\n/**\n * 动画自定义样式\n */\nconst transitionStyle = computed(() => {\n const style: CSSProperties = {\n 'z-index': zIndex.value,\n position: 'fixed',\n top: '50%',\n left: 0,\n width: '100%',\n transform: 'translate(0, -50%)',\n 'text-align': 'center'\n }\n return objToStyle(style)\n})\n\n/**\n * 加载自定义样式\n */\nconst loadingStyle = computed(() => {\n const style: CSSProperties = {\n display: 'inline-block',\n 'margin-right': '16px'\n }\n return objToStyle(style)\n})\n\nconst rootClass = computed(() => {\n return `wd-toast ${props.customClass} wd-toast--${position.value} ${\n (iconName.value !== 'loading' || msg.value) && (iconName.value || customIcon.value) ? 'wd-toast--with-icon' : ''\n } ${iconName.value === 'loading' && !msg.value ? 'wd-toast--loading' : ''}`\n})\n\nonBeforeMount(() => {\n buildSvg()\n})\n\nfunction handleAfterEnter() {\n if (isFunction(opened)) {\n opened()\n }\n}\n\nfunction handleAfterLeave() {\n if (isFunction(closed)) {\n closed()\n }\n}\n\nfunction buildSvg() {\n if (iconName.value !== 'success' && iconName.value !== 'warning' && iconName.value !== 'info' && iconName.value !== 'error') return\n const iconSvg = toastIcon[iconName.value]()\n const iconSvgStr = `\"data:image/svg+xml;base64,${base64(iconSvg)}\"`\n svgStr.value = iconSvgStr\n}\n\n/**\n * 重置toast选项值\n * @param option toast选项值\n */\nfunction reset(option: ToastOptions) {\n if (option) {\n show.value = isDef(option.show) ? option.show : false\n\n if (show.value) {\n iconName.value = isDef(option.iconName!) ? option.iconName! : ''\n customIcon.value = isDef(option.customIcon!) ? option.customIcon! : false\n msg.value = isDef(option.msg!) ? option.msg! : ''\n position.value = isDef(option.position!) ? option.position! : 'middle'\n zIndex.value = isDef(option.zIndex!) ? option.zIndex! : 100\n loadingType.value = isDef(option.loadingType!) ? option.loadingType! : 'outline'\n loadingColor.value = isDef(option.loadingColor!) ? option.loadingColor! : '#4D80F0'\n iconSize.value = isDef(option.iconSize!) ? option.iconSize! : 42\n cover.value = isDef(option.cover!) ? option.cover! : false\n closed = isFunction(option.closed) ? option.closed : null\n opened = isFunction(option.opened) ? option.opened : null\n }\n }\n}\n</script>\n<style lang=\"scss\" scoped>\n@import './index.scss';\n</style>\n","import Component from 'D:/App/Work/addr/acdr-ui/node_modules/wot-design-uni/components/wd-toast/wd-toast.vue'\nwx.createComponent(Component)"],"names":["ref","toastDefaultOptionKey","inject","defaultOptions","watch","computed","objToStyle","onBeforeMount","isFunction","toastIcon","base64","isDef"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,MAAA,cAAe;AAAA,EACb,MAAM;AAAA,EACN,SAAS;AAAA,IACP,gBAAgB;AAAA,IAChB,aAAa;AAAA,IACb,gBAAgB;AAAA,EAClB;AACF;;;;AAUA,UAAM,QAAQ;AAER,UAAA,WAAWA,kBAAY,EAAE;AACzB,UAAA,aAAaA,kBAAa,KAA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