refactor: 优化组件,修复控制台报错:Message compilation error,i18n的@为特殊符号
This commit is contained in:
parent
62b8327d07
commit
1cf855b073
@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, useAttrs } from 'vue';
|
||||
import { type VNode, computed, useAttrs } from 'vue';
|
||||
import type { ButtonProps, PopoverPlacement } from 'naive-ui';
|
||||
import { twMerge } from 'tailwind-merge';
|
||||
|
||||
@ -11,6 +11,8 @@ defineOptions({
|
||||
interface Props {
|
||||
/** Button class */
|
||||
class?: string;
|
||||
/** Show popconfirm icon */
|
||||
showPopconfirmIcon?: boolean;
|
||||
/** Iconify icon name */
|
||||
icon?: string;
|
||||
/** Local icon name */
|
||||
@ -19,8 +21,8 @@ interface Props {
|
||||
tooltipContent?: string;
|
||||
/** Tooltip placement */
|
||||
tooltipPlacement?: PopoverPlacement;
|
||||
/** Popconfirm content */
|
||||
popconfirmContent?: string;
|
||||
/** Popconfirm content - can be string or VNode */
|
||||
popconfirmContent?: string | VNode;
|
||||
zIndex?: number;
|
||||
quaternary?: boolean;
|
||||
[key: string]: any;
|
||||
@ -28,6 +30,7 @@ interface Props {
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
class: '',
|
||||
showPopconfirmIcon: true,
|
||||
icon: '',
|
||||
localIcon: '',
|
||||
tooltipContent: '',
|
||||
@ -59,8 +62,11 @@ const handlePositiveClick = () => {
|
||||
<template>
|
||||
<NTooltip :placement="tooltipPlacement" :z-index="zIndex" :disabled="!tooltipContent">
|
||||
<template #trigger>
|
||||
<NPopconfirm :disabled="!popconfirmContent" @positive-click="handlePositiveClick">
|
||||
{{ popconfirmContent }}
|
||||
<NPopconfirm :show-icon="showPopconfirmIcon" :disabled="!popconfirmContent" @positive-click="handlePositiveClick">
|
||||
<template #default>
|
||||
<component :is="popconfirmContent" v-if="typeof popconfirmContent !== 'string'" />
|
||||
<template v-else>{{ popconfirmContent }}</template>
|
||||
</template>
|
||||
<template #trigger>
|
||||
<NButton
|
||||
:quaternary="quaternary"
|
||||
|
@ -580,7 +580,7 @@ const local: App.I18n.Schema = {
|
||||
'If you select yes, it will be cached by `keep-alive`, and the `name` and address of the matching component must be consistent',
|
||||
visibleTip: 'If you choose Hide, the route will not appear in the sidebar, but it can still be accessed.',
|
||||
statusTip: 'If you choose to disable, the route will not appear in the sidebar and cannot be accessed.',
|
||||
permsTip: "Permission string defined in the controller, such as: @SaCheckPermission('system:user:list')",
|
||||
permsTip: "Permission string defined in the controller, such as: {'@'}SaCheckPermission('system:user:list')",
|
||||
componentTip:
|
||||
'The component path to access, such as: `system/user/index`, which is in the `views` directory by default',
|
||||
pathTip:
|
||||
|
@ -579,7 +579,7 @@ const local: App.I18n.Schema = {
|
||||
isCacheTip: '选择是则会被`keep-alive`缓存,需要匹配组件的`name`和地址保持一致',
|
||||
visibleTip: '选择隐藏则路由将不会出现在侧边栏,但仍然可以访问',
|
||||
statusTip: '选择停用则路由将不会出现在侧边栏,也不能被访问',
|
||||
permsTip: "控制器中定义的权限字符,如:`@SaCheckPermission('system:user:list')`",
|
||||
permsTip: "控制器中定义的权限字符,如:`{'@'}SaCheckPermission('system:user:list')`",
|
||||
componentTip: '访问的组件路径,如:`system/user/index`,默认在`views`目录下',
|
||||
pathTip:
|
||||
'Router path,Example:`user`,If the external network address needs to be accessed in the internal link,then `http(s)://` beginning',
|
||||
|
Loading…
Reference in New Issue
Block a user