Jelajahi Sumber

perf: add xtextbutton

xingyu4j 2 tahun lalu
induk
melakukan
b8665a9bc6

+ 2 - 1
yudao-ui-admin-vue3/src/components/XButton/index.ts

@@ -1,3 +1,4 @@
 import XButton from './src/XButton.vue'
+import XTextButton from './src/XTextButton.vue'
 
-export { XButton }
+export { XButton, XTextButton }

+ 12 - 2
yudao-ui-admin-vue3/src/components/XButton/src/XButton.vue

@@ -7,7 +7,7 @@ const props = defineProps({
   loading: propTypes.bool.def(false),
   preIcon: propTypes.string.def(''),
   postIcon: propTypes.string.def(''),
-  title: propTypes.string.def('按钮'),
+  title: propTypes.string.def(''),
   type: propTypes.oneOf(['', 'primary', 'success', 'warning', 'danger', 'info']).def(''),
   link: propTypes.bool.def(false),
   circle: propTypes.bool.def(false),
@@ -31,7 +31,17 @@ const getBindValue = computed(() => {
 <template>
   <el-button v-bind="getBindValue" @click="onClick">
     <Icon :icon="preIcon" v-if="preIcon" class="mr-1px" />
-    {{ title }}
+    {{ title ? title : '' }}
     <Icon :icon="postIcon" v-if="postIcon" class="mr-1px" />
   </el-button>
 </template>
+<style lang="less" scoped>
+:deep(.el-button.is-text) {
+  margin-left: 0;
+  padding: 8px 4px;
+}
+:deep(.el-button.is-link) {
+  margin-left: 0;
+  padding: 8px 4px;
+}
+</style>

+ 2 - 1
yudao-ui-admin-vue3/src/components/index.ts

@@ -5,7 +5,7 @@ import { Table } from '@/components/Table'
 import { Search } from '@/components/Search'
 import { Dialog } from '@/components/Dialog'
 import { XModal } from '@/components/XModal'
-import { XButton } from '@/components/XButton'
+import { XButton, XTextButton } from '@/components/XButton'
 import { DictTag } from '@/components/DictTag'
 import { ContentWrap } from '@/components/ContentWrap'
 import { Descriptions } from '@/components/Descriptions'
@@ -18,6 +18,7 @@ export const setupGlobCom = (app: App<Element>): void => {
   app.component('Dialog', Dialog)
   app.component('XModal', XModal)
   app.component('XButton', XButton)
+  app.component('XTextButton', XTextButton)
   app.component('DictTag', DictTag)
   app.component('ContentWrap', ContentWrap)
   app.component('Descriptions', Descriptions)

+ 2 - 6
yudao-ui-admin-vue3/src/views/system/menu/index.vue

@@ -73,17 +73,13 @@
       <vxe-column title="创建时间" field="createTime" formatter="formatDate" />
       <vxe-column title="操作" width="200">
         <template #default="{ row }">
-          <XButton
-            link
-            type="primary"
+          <XTextButton
             preIcon="ep:edit"
             :title="t('action.edit')"
             v-hasPermi="['system:menu:update']"
             @click="handleUpdate(row.id)"
           />
-          <XButton
-            link
-            type="primary"
+          <XTextButton
             preIcon="ep:delete"
             :title="t('action.del')"
             v-hasPermi="['system:menu:delete']"

+ 3 - 7
yudao-ui-admin-vue3/src/views/system/post/index.vue

@@ -14,23 +14,19 @@
         <DictTag :type="DICT_TYPE.COMMON_STATUS" :value="row.status" />
       </template>
       <template #action_default="{ row }">
-        <XButton
-          link
-          type="primary"
+        <XTextButton
           preIcon="ep:edit"
           :title="t('action.edit')"
           v-hasPermi="['system:post:update']"
           @click="handleUpdate(row.id)"
         />
-        <XButton
-          link
-          type="primary"
+        <XTextButton
           preIcon="ep:view"
           :title="t('action.detail')"
           v-hasPermi="['system:post:update']"
           @click="handleDetail(row)"
         />
-        <XButton
+        <XTextButton
           link
           type="primary"
           preIcon="ep:delete"