feat:增加 DocAlert 文档说明
This commit is contained in:
3
apps/web-antd/src/components/doc-alert/index.ts
Normal file
3
apps/web-antd/src/components/doc-alert/index.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
import DocAlert from './src/DocAlert.vue'
|
||||
|
||||
export { DocAlert }
|
||||
42
apps/web-antd/src/components/doc-alert/src/DocAlert.vue
Normal file
42
apps/web-antd/src/components/doc-alert/src/DocAlert.vue
Normal file
@@ -0,0 +1,42 @@
|
||||
<script lang="ts" setup>
|
||||
import { computed } from 'vue';
|
||||
import { Alert, Typography } from 'ant-design-vue';
|
||||
|
||||
export interface DocAlertProps {
|
||||
/**
|
||||
* 文档标题
|
||||
*/
|
||||
title: string;
|
||||
/**
|
||||
* 文档 URL 地址
|
||||
*/
|
||||
url: string;
|
||||
}
|
||||
|
||||
const props = defineProps<DocAlertProps>();
|
||||
|
||||
/** 跳转 URL 链接 */
|
||||
const goToUrl = () => {
|
||||
window.open(props.url);
|
||||
};
|
||||
|
||||
/** 是否开启 */
|
||||
const isEnabled = computed(() => {
|
||||
return import.meta.env.VITE_APP_DOCALERT_ENABLE !== 'false';
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Alert
|
||||
v-if="isEnabled"
|
||||
type="info"
|
||||
show-icon
|
||||
class="mb-2 rounded"
|
||||
>
|
||||
<template #message>
|
||||
<Typography.Link @click="goToUrl">
|
||||
【{{ title }}】文档地址:{{ url }}
|
||||
</Typography.Link>
|
||||
</template>
|
||||
</Alert>
|
||||
</template>
|
||||
Reference in New Issue
Block a user