提交 c3b90765 编写于 作者: 无木

feat(modal): add `tooltip` for action buttons

为最大化、全屏、还原等操作按钮添加工具提示
上级 b96ea075
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
- 新增`onChange`用于接受头像剪裁并上传成功事件 - 新增`onChange`用于接受头像剪裁并上传成功事件
- 新增`btnText``btnProps` 用于自定义上传按钮文案和属性 - 新增`btnText``btnProps` 用于自定义上传按钮文案和属性
- 为剪裁`Modal`内的操作按钮添加工具提示 - 为剪裁`Modal`内的操作按钮添加工具提示
- **Modal** 为右上角的操作按钮添加工具提示
### 🐛 Bug Fixes ### 🐛 Bug Fixes
......
<template> <template>
<div :class="getClass"> <div :class="getClass">
<template v-if="canFullscreen"> <template v-if="canFullscreen">
<FullscreenExitOutlined role="full" @click="handleFullScreen" v-if="fullScreen" /> <Tooltip :title="t('component.modal.restore')" placement="bottom" v-if="fullScreen">
<FullscreenOutlined role="close" @click="handleFullScreen" v-else /> <FullscreenExitOutlined role="full" @click="handleFullScreen" />
</Tooltip>
<Tooltip :title="t('component.modal.maximize')" placement="bottom" v-else>
<FullscreenOutlined role="close" @click="handleFullScreen" />
</Tooltip>
</template> </template>
<CloseOutlined @click="handleCancel" /> <Tooltip :title="t('component.modal.close')" placement="bottom">
<CloseOutlined @click="handleCancel" />
</Tooltip>
</div> </div>
</template> </template>
<script lang="ts"> <script lang="ts">
import { defineComponent, computed } from 'vue'; import { defineComponent, computed } from 'vue';
import { FullscreenExitOutlined, FullscreenOutlined, CloseOutlined } from '@ant-design/icons-vue'; import { FullscreenExitOutlined, FullscreenOutlined, CloseOutlined } from '@ant-design/icons-vue';
import { useDesign } from '/@/hooks/web/useDesign'; import { useDesign } from '/@/hooks/web/useDesign';
import { Tooltip } from 'ant-design-vue';
import { useI18n } from '/@/hooks/web/useI18n';
export default defineComponent({ export default defineComponent({
name: 'ModalClose', name: 'ModalClose',
components: { FullscreenExitOutlined, FullscreenOutlined, CloseOutlined }, components: { Tooltip, FullscreenExitOutlined, FullscreenOutlined, CloseOutlined },
props: { props: {
canFullscreen: { type: Boolean, default: true }, canFullscreen: { type: Boolean, default: true },
fullScreen: { type: Boolean }, fullScreen: { type: Boolean },
...@@ -22,6 +30,7 @@ ...@@ -22,6 +30,7 @@
emits: ['cancel', 'fullscreen'], emits: ['cancel', 'fullscreen'],
setup(props, { emit }) { setup(props, { emit }) {
const { prefixCls } = useDesign('basic-modal-close'); const { prefixCls } = useDesign('basic-modal-close');
const { t } = useI18n();
const getClass = computed(() => { const getClass = computed(() => {
return [ return [
...@@ -44,6 +53,7 @@ ...@@ -44,6 +53,7 @@
} }
return { return {
t,
getClass, getClass,
prefixCls, prefixCls,
handleCancel, handleCancel,
......
...@@ -48,6 +48,9 @@ export default { ...@@ -48,6 +48,9 @@ export default {
modal: { modal: {
cancelText: 'Close', cancelText: 'Close',
okText: 'Confirm', okText: 'Confirm',
close: 'Close',
maximize: 'Maximize',
restore: 'Restore',
}, },
table: { table: {
settingDens: 'Density', settingDens: 'Density',
......
...@@ -50,6 +50,9 @@ export default { ...@@ -50,6 +50,9 @@ export default {
modal: { modal: {
cancelText: '关闭', cancelText: '关闭',
okText: '确认', okText: '确认',
close: '关闭',
maximize: '最大化',
restore: '还原',
}, },
table: { table: {
settingDens: '密度', settingDens: '密度',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册