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"> <script setup lang="ts">
import { propTypes } from '@/utils/propTypes' import { propTypes } from '@/utils/propTypes'
import { computed, useAttrs, PropType } from 'vue' import { computed, useAttrs, PropType } from 'vue'
import { useI18n } from '@/hooks/web/useI18n'
const { t } = useI18n() //
const props = defineProps({ const props = defineProps({
modelValue: propTypes.bool.def(false), modelValue: propTypes.bool.def(false),
loading: propTypes.bool.def(false), loading: propTypes.bool.def(false),
preIcon: propTypes.string.def(''), preIcon: propTypes.string.def(''),
postIcon: propTypes.string.def(''), postIcon: propTypes.string.def(''),
iTitle: propTypes.string.def(''),
title: 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), link: propTypes.bool.def(false),
circle: propTypes.bool.def(false), circle: propTypes.bool.def(false),
round: propTypes.bool.def(false), round: propTypes.bool.def(false),
@ -35,7 +31,7 @@ const getBindValue = computed(() => {
<template> <template>
<el-button v-bind="getBindValue" @click="onClick"> <el-button v-bind="getBindValue" @click="onClick">
<Icon :icon="preIcon" v-if="preIcon" class="mr-1px" /> <Icon :icon="preIcon" v-if="preIcon" class="mr-1px" />
{{ iTitle ? t(iTitle) : title }} {{ title }}
<Icon :icon="postIcon" v-if="postIcon" class="mr-1px" /> <Icon :icon="postIcon" v-if="postIcon" class="mr-1px" />
</el-button> </el-button>
</template> </template>

View File

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

View File

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