Commit 6c499faafdeba2eeb54239fdf865542876cadfae

Authored by xingyu4j
1 parent bca13b19

fix: button error

yudao-ui-admin-vue3/src/components/XButton/src/XButton.vue
1 1 <script setup lang="ts">
2 2 import { propTypes } from '@/utils/propTypes'
3 3 import { computed, useAttrs, PropType } from 'vue'
4   -import { useI18n } from '@/hooks/web/useI18n'
5   -
6   -const { t } = useI18n() // 国际化
7 4  
8 5 const props = defineProps({
9 6 modelValue: propTypes.bool.def(false),
10 7 loading: propTypes.bool.def(false),
11 8 preIcon: propTypes.string.def(''),
12 9 postIcon: propTypes.string.def(''),
13   - iTitle: propTypes.string.def(''),
14 10 title: propTypes.string.def('按钮'),
15   - type: propTypes.oneOf(['primary', 'success', 'warning', 'danger', 'info']).def('primary'),
  11 + type: propTypes.oneOf(['', 'primary', 'success', 'warning', 'danger', 'info']).def(''),
16 12 link: propTypes.bool.def(false),
17 13 circle: propTypes.bool.def(false),
18 14 round: propTypes.bool.def(false),
... ... @@ -35,7 +31,7 @@ const getBindValue = computed(() =&gt; {
35 31 <template>
36 32 <el-button v-bind="getBindValue" @click="onClick">
37 33 <Icon :icon="preIcon" v-if="preIcon" class="mr-1px" />
38   - {{ iTitle ? t(iTitle) : title }}
  34 + {{ title }}
39 35 <Icon :icon="postIcon" v-if="postIcon" class="mr-1px" />
40 36 </el-button>
41 37 </template>
... ...
yudao-ui-admin-vue3/src/views/system/menu/index.vue
... ... @@ -15,23 +15,26 @@
15 15 </el-select>
16 16 </el-form-item>
17 17 <el-form-item>
18   - <el-button type="primary" @click="handleQuery">
19   - <Icon icon="ep:search" class="mr-5px" />
20   - {{ t('common.query') }}
21   - </el-button>
22   - <el-button @click="resetQuery">
23   - <Icon icon="ep:refresh-right" class="mr-5px" />
24   - {{ t('common.reset') }}
25   - </el-button>
  18 + <XButton
  19 + type="primary"
  20 + preIcon="ep:search"
  21 + :title="t('common.query')"
  22 + @click="handleQuery()"
  23 + />
  24 + <XButton preIcon="ep:refresh-right" :title="t('common.reset')" @click="resetQuery()" />
26 25 </el-form-item>
27 26 </el-form>
28 27 <vxe-toolbar>
29 28 <template #buttons>
30   - <vxe-button status="primary" v-hasPermi="['system:post:create']" @click="handleCreate">
31   - <Icon icon="ep:zoom-in" class="mr-5px" /> {{ t('action.add') }}
32   - </vxe-button>
33   - <vxe-button @click="xTable?.setAllTreeExpand(true)">展开所有</vxe-button>
34   - <vxe-button @click="xTable?.clearTreeExpand()">关闭所有</vxe-button>
  29 + <XButton
  30 + type="primary"
  31 + preIcon="ep:zoom-in"
  32 + :title="t('action.add')"
  33 + v-hasPermi="['system:menu:create']"
  34 + @click="handleCreate()"
  35 + />
  36 + <XButton title="展开所有" @click="xTable?.setAllTreeExpand(true)" />
  37 + <XButton title="关闭所有" @click="xTable?.clearTreeExpand()" />
35 38 </template>
36 39 </vxe-toolbar>
37 40 <vxe-table
... ... @@ -70,22 +73,22 @@
70 73 <vxe-column title="创建时间" field="createTime" formatter="formatDate" />
71 74 <vxe-column title="操作" width="200">
72 75 <template #default="{ row }">
73   - <vxe-button
74   - type="text"
75   - status="primary"
  76 + <XButton
  77 + link
  78 + type="primary"
  79 + preIcon="ep:edit"
  80 + :title="t('action.edit')"
76 81 v-hasPermi="['system:menu:update']"
77   - @click="handleUpdate(row)"
78   - >
79   - <Icon icon="ep:edit" class="mr-1px" /> {{ t('action.edit') }}
80   - </vxe-button>
81   - <vxe-button
82   - type="text"
83   - status="primary"
  82 + @click="handleUpdate(row.id)"
  83 + />
  84 + <XButton
  85 + link
  86 + type="primary"
  87 + preIcon="ep:delete"
  88 + :title="t('action.del')"
84 89 v-hasPermi="['system:menu:delete']"
85 90 @click="handleDelete(row)"
86   - >
87   - <Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }}
88   - </vxe-button>
  91 + />
89 92 </template>
90 93 </vxe-column>
91 94 </vxe-table>
... ... @@ -228,14 +231,14 @@
228 231 </template>
229 232 <template #footer>
230 233 <!-- 操作按钮 -->
231   - <el-button
  234 + <XButton
232 235 v-if="['create', 'update'].includes(actionType)"
233 236 type="primary"
234 237 :loading="actionLoading"
235 238 @click="submitForm"
236   - :content="t('action.save')"
  239 + :title="t('action.save')"
237 240 />
238   - <el-button @click="dialogVisible = false" :content="t('dialog.close')" />
  241 + <XButton :loading="actionLoading" @click="dialogVisible = false" :title="t('dialog.close')" />
239 242 </template>
240 243 </XModal>
241 244 </template>
... ...
yudao-ui-admin-vue3/src/views/system/post/index.vue
... ... @@ -3,8 +3,9 @@
3 3 <vxe-grid ref="xGrid" v-bind="gridOptions" class="xtable-scrollbar">
4 4 <template #toolbar_buttons>
5 5 <XButton
  6 + type="primary"
6 7 preIcon="ep:zoom-in"
7   - iTitle="action.add"
  8 + :title="t('action.add')"
8 9 v-hasPermi="['system:post:create']"
9 10 @click="handleCreate()"
10 11 />
... ... @@ -15,22 +16,25 @@
15 16 <template #action_default="{ row }">
16 17 <XButton
17 18 link
  19 + type="primary"
18 20 preIcon="ep:edit"
19   - iTitle="action.edit"
  21 + :title="t('action.edit')"
20 22 v-hasPermi="['system:post:update']"
21 23 @click="handleUpdate(row.id)"
22 24 />
23 25 <XButton
24 26 link
  27 + type="primary"
25 28 preIcon="ep:view"
26   - iTitle="action.detail"
  29 + :title="t('action.detail')"
27 30 v-hasPermi="['system:post:update']"
28 31 @click="handleDetail(row)"
29 32 />
30 33 <XButton
31 34 link
  35 + type="primary"
32 36 preIcon="ep:delete"
33   - iTitle="action.del"
  37 + :title="t('action.del')"
34 38 v-hasPermi="['system:post:delete']"
35 39 @click="handleDelete(row.id)"
36 40 />
... ... @@ -64,13 +68,13 @@
64 68 <XButton
65 69 v-if="['create', 'update'].includes(actionType)"
66 70 :loading="actionLoading"
67   - iTitle="action.save"
  71 + :title="t('action.save')"
68 72 @click="submitForm"
69 73 />
70 74 <XButton
71 75 v-if="['create', 'update'].includes(actionType)"
72 76 :loading="actionLoading"
73   - iTitle="dialog.close"
  77 + :title="t('dialog.close')"
74 78 @click="dialogVisible = false"
75 79 />
76 80 </template>
... ...