fix: button error

pull/2/head
xingyu4j 2022-11-04 18:19:11 +08:00
parent bca13b1961
commit 6c499faafd
3 changed files with 44 additions and 41 deletions

View File

@ -1,18 +1,14 @@
<script setup lang="ts">
import { propTypes } from '@/utils/propTypes'
import { computed, useAttrs, PropType } from 'vue'
import { useI18n } from '@/hooks/web/useI18n'
const { t } = useI18n() //
const props = defineProps({
modelValue: propTypes.bool.def(false),
loading: propTypes.bool.def(false),
preIcon: propTypes.string.def(''),
postIcon: propTypes.string.def(''),
iTitle: propTypes.string.def(''),
title: propTypes.string.def('按钮'),
type: propTypes.oneOf(['primary', 'success', 'warning', 'danger', 'info']).def('primary'),
type: propTypes.oneOf(['', 'primary', 'success', 'warning', 'danger', 'info']).def(''),
link: propTypes.bool.def(false),
circle: propTypes.bool.def(false),
round: propTypes.bool.def(false),
@ -35,7 +31,7 @@ const getBindValue = computed(() => {
<template>
<el-button v-bind="getBindValue" @click="onClick">
<Icon :icon="preIcon" v-if="preIcon" class="mr-1px" />
{{ iTitle ? t(iTitle) : title }}
{{ title }}
<Icon :icon="postIcon" v-if="postIcon" class="mr-1px" />
</el-button>
</template>

View File

@ -15,23 +15,26 @@
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleQuery">
<Icon icon="ep:search" class="mr-5px" />
{{ t('common.query') }}
</el-button>
<el-button @click="resetQuery">
<Icon icon="ep:refresh-right" class="mr-5px" />
{{ t('common.reset') }}
</el-button>
<XButton
type="primary"
preIcon="ep:search"
:title="t('common.query')"
@click="handleQuery()"
/>
<XButton preIcon="ep:refresh-right" :title="t('common.reset')" @click="resetQuery()" />
</el-form-item>
</el-form>
<vxe-toolbar>
<template #buttons>
<vxe-button status="primary" v-hasPermi="['system:post:create']" @click="handleCreate">
<Icon icon="ep:zoom-in" class="mr-5px" /> {{ t('action.add') }}
</vxe-button>
<vxe-button @click="xTable?.setAllTreeExpand(true)"></vxe-button>
<vxe-button @click="xTable?.clearTreeExpand()"></vxe-button>
<XButton
type="primary"
preIcon="ep:zoom-in"
:title="t('action.add')"
v-hasPermi="['system:menu:create']"
@click="handleCreate()"
/>
<XButton title="展开所有" @click="xTable?.setAllTreeExpand(true)" />
<XButton title="关闭所有" @click="xTable?.clearTreeExpand()" />
</template>
</vxe-toolbar>
<vxe-table
@ -70,22 +73,22 @@
<vxe-column title="创建时间" field="createTime" formatter="formatDate" />
<vxe-column title="操作" width="200">
<template #default="{ row }">
<vxe-button
type="text"
status="primary"
<XButton
link
type="primary"
preIcon="ep:edit"
:title="t('action.edit')"
v-hasPermi="['system:menu:update']"
@click="handleUpdate(row)"
>
<Icon icon="ep:edit" class="mr-1px" /> {{ t('action.edit') }}
</vxe-button>
<vxe-button
type="text"
status="primary"
@click="handleUpdate(row.id)"
/>
<XButton
link
type="primary"
preIcon="ep:delete"
:title="t('action.del')"
v-hasPermi="['system:menu:delete']"
@click="handleDelete(row)"
>
<Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }}
</vxe-button>
/>
</template>
</vxe-column>
</vxe-table>
@ -228,14 +231,14 @@
</template>
<template #footer>
<!-- 操作按钮 -->
<el-button
<XButton
v-if="['create', 'update'].includes(actionType)"
type="primary"
:loading="actionLoading"
@click="submitForm"
:content="t('action.save')"
:title="t('action.save')"
/>
<el-button @click="dialogVisible = false" :content="t('dialog.close')" />
<XButton :loading="actionLoading" @click="dialogVisible = false" :title="t('dialog.close')" />
</template>
</XModal>
</template>

View File

@ -3,8 +3,9 @@
<vxe-grid ref="xGrid" v-bind="gridOptions" class="xtable-scrollbar">
<template #toolbar_buttons>
<XButton
type="primary"
preIcon="ep:zoom-in"
iTitle="action.add"
:title="t('action.add')"
v-hasPermi="['system:post:create']"
@click="handleCreate()"
/>
@ -15,22 +16,25 @@
<template #action_default="{ row }">
<XButton
link
type="primary"
preIcon="ep:edit"
iTitle="action.edit"
:title="t('action.edit')"
v-hasPermi="['system:post:update']"
@click="handleUpdate(row.id)"
/>
<XButton
link
type="primary"
preIcon="ep:view"
iTitle="action.detail"
:title="t('action.detail')"
v-hasPermi="['system:post:update']"
@click="handleDetail(row)"
/>
<XButton
link
type="primary"
preIcon="ep:delete"
iTitle="action.del"
:title="t('action.del')"
v-hasPermi="['system:post:delete']"
@click="handleDelete(row.id)"
/>
@ -64,13 +68,13 @@
<XButton
v-if="['create', 'update'].includes(actionType)"
:loading="actionLoading"
iTitle="action.save"
:title="t('action.save')"
@click="submitForm"
/>
<XButton
v-if="['create', 'update'].includes(actionType)"
:loading="actionLoading"
iTitle="dialog.close"
:title="t('dialog.close')"
@click="dialogVisible = false"
/>
</template>