| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- const n = `<template>\r
- <div class="s-empty-common">\r
- <a-empty :image="image" :imageStyle="iconStyle">\r
- <template #description>\r
- <span class="description" v-if="$slots.default">\r
- <slot />\r
- </span>\r
- <span class="description" v-else>\r
- {{ description }}\r
- </span>\r
- </template>\r
- </a-empty>\r
- </div>\r
- </template>\r
- <script setup>\r
- import { onMounted, ref, getCurrentInstance } from 'vue'\r
- import { Empty } from 'ant-design-vue'\r
- const app = getCurrentInstance()\r
- const { $l } = app.appContext.config.globalProperties\r
- \r
- const props = defineProps({\r
- /**\r
- * icon类型\r
- * @type\r
- */\r
- type: {\r
- type: [String, Number],\r
- default: 1\r
- },\r
- /**\r
- * 提示信息\r
- * @icon\r
- */\r
- icon: {\r
- type: [String, Object],\r
- default: ''\r
- },\r
- /**\r
- * 描述信息\r
- * @desc\r
- */\r
- desc: {\r
- type: [String, Boolean],\r
- default() {\r
- return\r
- }\r
- },\r
- /**\r
- * 图片样式\r
- * @desc\r
- */\r
- iconStyle: {\r
- type: Object,\r
- default() {\r
- return {}\r
- }\r
- }\r
- })\r
- const image = ref('')\r
- const description = ref('')\r
- \r
- onMounted(() => {\r
- if (!props.icon) {\r
- if (parseInt(props.type) === 1) {\r
- image.value = Empty.PRESENTED_IMAGE_DEFAULT\r
- } else if (parseInt(props.type) === 2) {\r
- image.value = Empty.PRESENTED_IMAGE_SIMPLE\r
- } else {\r
- image.value = Empty.PRESENTED_IMAGE_DEFAULT\r
- console.warn(\r
- '内置type类型为:1 或者 2,如需其他类型,请使用icon属性,例如:icon="https://xxx.png'\r
- )\r
- }\r
- } else {\r
- image.value = props.icon\r
- }\r
- \r
- if (props.desc === undefined) {\r
- description.value = $l('暂无数据')\r
- } else {\r
- if (typeof props.desc === 'string') {\r
- description.value = props.desc.trim()\r
- } else {\r
- description.value = $l('暂无数据')\r
- }\r
- }\r
- })\r
- <\/script>\r
- <style lang="less" scoped>\r
- .description {\r
- color: var(--s-text-color-secondary);\r
- }\r
- </style>\r
- `;
- export {
- n as default
- };
|