Commit 6c499faafdeba2eeb54239fdf865542876cadfae

Authored by xingyu4j
1 parent bca13b19

fix: button error

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