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