Commit b8665a9bc67c91a14d05e06641c147e8d7fc91ff
1 parent
9c033d01
perf: add xtextbutton
Showing
5 changed files
with
21 additions
and
17 deletions
yudao-ui-admin-vue3/src/components/XButton/index.ts
yudao-ui-admin-vue3/src/components/XButton/src/XButton.vue
| ... | ... | @@ -7,7 +7,7 @@ const props = defineProps({ |
| 7 | 7 | loading: propTypes.bool.def(false), |
| 8 | 8 | preIcon: propTypes.string.def(''), |
| 9 | 9 | postIcon: propTypes.string.def(''), |
| 10 | - title: propTypes.string.def('按钮'), | |
| 10 | + title: propTypes.string.def(''), | |
| 11 | 11 | type: propTypes.oneOf(['', 'primary', 'success', 'warning', 'danger', 'info']).def(''), |
| 12 | 12 | link: propTypes.bool.def(false), |
| 13 | 13 | circle: propTypes.bool.def(false), |
| ... | ... | @@ -31,7 +31,17 @@ const getBindValue = computed(() => { |
| 31 | 31 | <template> |
| 32 | 32 | <el-button v-bind="getBindValue" @click="onClick"> |
| 33 | 33 | <Icon :icon="preIcon" v-if="preIcon" class="mr-1px" /> |
| 34 | - {{ title }} | |
| 34 | + {{ title ? title : '' }} | |
| 35 | 35 | <Icon :icon="postIcon" v-if="postIcon" class="mr-1px" /> |
| 36 | 36 | </el-button> |
| 37 | 37 | </template> |
| 38 | +<style lang="less" scoped> | |
| 39 | +:deep(.el-button.is-text) { | |
| 40 | + margin-left: 0; | |
| 41 | + padding: 8px 4px; | |
| 42 | +} | |
| 43 | +:deep(.el-button.is-link) { | |
| 44 | + margin-left: 0; | |
| 45 | + padding: 8px 4px; | |
| 46 | +} | |
| 47 | +</style> | ... | ... |
yudao-ui-admin-vue3/src/components/index.ts
| ... | ... | @@ -5,7 +5,7 @@ import { Table } from '@/components/Table' |
| 5 | 5 | import { Search } from '@/components/Search' |
| 6 | 6 | import { Dialog } from '@/components/Dialog' |
| 7 | 7 | import { XModal } from '@/components/XModal' |
| 8 | -import { XButton } from '@/components/XButton' | |
| 8 | +import { XButton, XTextButton } from '@/components/XButton' | |
| 9 | 9 | import { DictTag } from '@/components/DictTag' |
| 10 | 10 | import { ContentWrap } from '@/components/ContentWrap' |
| 11 | 11 | import { Descriptions } from '@/components/Descriptions' |
| ... | ... | @@ -18,6 +18,7 @@ export const setupGlobCom = (app: App<Element>): void => { |
| 18 | 18 | app.component('Dialog', Dialog) |
| 19 | 19 | app.component('XModal', XModal) |
| 20 | 20 | app.component('XButton', XButton) |
| 21 | + app.component('XTextButton', XTextButton) | |
| 21 | 22 | app.component('DictTag', DictTag) |
| 22 | 23 | app.component('ContentWrap', ContentWrap) |
| 23 | 24 | app.component('Descriptions', Descriptions) | ... | ... |
yudao-ui-admin-vue3/src/views/system/menu/index.vue
| ... | ... | @@ -73,17 +73,13 @@ |
| 73 | 73 | <vxe-column title="创建时间" field="createTime" formatter="formatDate" /> |
| 74 | 74 | <vxe-column title="操作" width="200"> |
| 75 | 75 | <template #default="{ row }"> |
| 76 | - <XButton | |
| 77 | - link | |
| 78 | - type="primary" | |
| 76 | + <XTextButton | |
| 79 | 77 | preIcon="ep:edit" |
| 80 | 78 | :title="t('action.edit')" |
| 81 | 79 | v-hasPermi="['system:menu:update']" |
| 82 | 80 | @click="handleUpdate(row.id)" |
| 83 | 81 | /> |
| 84 | - <XButton | |
| 85 | - link | |
| 86 | - type="primary" | |
| 82 | + <XTextButton | |
| 87 | 83 | preIcon="ep:delete" |
| 88 | 84 | :title="t('action.del')" |
| 89 | 85 | v-hasPermi="['system:menu:delete']" | ... | ... |
yudao-ui-admin-vue3/src/views/system/post/index.vue
| ... | ... | @@ -14,23 +14,19 @@ |
| 14 | 14 | <DictTag :type="DICT_TYPE.COMMON_STATUS" :value="row.status" /> |
| 15 | 15 | </template> |
| 16 | 16 | <template #action_default="{ row }"> |
| 17 | - <XButton | |
| 18 | - link | |
| 19 | - type="primary" | |
| 17 | + <XTextButton | |
| 20 | 18 | preIcon="ep:edit" |
| 21 | 19 | :title="t('action.edit')" |
| 22 | 20 | v-hasPermi="['system:post:update']" |
| 23 | 21 | @click="handleUpdate(row.id)" |
| 24 | 22 | /> |
| 25 | - <XButton | |
| 26 | - link | |
| 27 | - type="primary" | |
| 23 | + <XTextButton | |
| 28 | 24 | preIcon="ep:view" |
| 29 | 25 | :title="t('action.detail')" |
| 30 | 26 | v-hasPermi="['system:post:update']" |
| 31 | 27 | @click="handleDetail(row)" |
| 32 | 28 | /> |
| 33 | - <XButton | |
| 29 | + <XTextButton | |
| 34 | 30 | link |
| 35 | 31 | type="primary" |
| 36 | 32 | preIcon="ep:delete" | ... | ... |