doc-button.vue 537 B

12345678910111213141516171819202122
  1. <script lang="ts" setup>
  2. import { VBEN_DOC_URL } from '@vben/constants';
  3. import { openWindow } from '@vben/utils';
  4. import { Button } from 'ant-design-vue';
  5. const props = defineProps<{ path: string }>();
  6. function handleClick() {
  7. // 如果没有.html,打开页面时可能会出现404
  8. const path =
  9. VBEN_DOC_URL +
  10. (props.path.toLowerCase().endsWith('.html')
  11. ? props.path
  12. : `${props.path}.html`);
  13. openWindow(path);
  14. }
  15. </script>
  16. <template>
  17. <Button @click="handleClick">查看组件文档</Button>
  18. </template>