fix: 升级element-plus2.2.0后,button默认样式变化

This commit is contained in:
roymondchen 2022-05-13 14:52:18 +08:00 committed by jia000
parent 7dc54797d2
commit 1486beb52c
8 changed files with 27 additions and 15 deletions

View File

@ -2,10 +2,10 @@
<el-tabs v-if="data.type === 'tabs'" class="m-editor-sidebar" v-model="activeTabName" type="card" tab-position="left">
<el-tab-pane v-for="item in items" :key="item.text" :name="item.text">
<template #label>
<span>
<div :key="item.text">
<m-icon v-if="item.icon" :icon="item.icon"></m-icon>
<div v-if="item.text" class="magic-editor-tab-panel-title">{{ item.text }}</div>
</span>
</div>
</template>
<component :is="item.component" v-bind="item.props || {}" v-on="item.listeners || {}">

View File

@ -14,6 +14,10 @@
.el-tabs__item {
font-size: 12px;
}
.el-input__wrapper {
border-radius: 0;
}
}
.m-editor-props-panel-popper {

View File

@ -43,6 +43,7 @@
<el-button
plain
size="small"
type="primary"
:icon="ArrowUp"
text
@click="upHandler(scope.$index + 1 + pagecontext * pagesize - 1)"
@ -57,6 +58,7 @@
<el-button
plain
size="small"
type="primary"
:icon="ArrowDown"
text
@click="downHandler(scope.$index + 1 + pagecontext * pagesize - 1)"
@ -107,10 +109,16 @@
</el-tooltip>
<slot></slot>
<el-button v-if="addable" size="small" type="primary" plain @click="newHandler()">添加</el-button> &nbsp;
<el-button :icon="Grid" size="small" @click="toggleMode" v-if="enableToggleMode && !isFullscreen"
<el-button :icon="Grid" size="small" type="primary" @click="toggleMode" v-if="enableToggleMode && !isFullscreen"
>展开配置</el-button
>
<el-button :icon="FullScreen" size="small" @click="toggleFullscreen" v-if="config.enableFullscreen !== false">
<el-button
:icon="FullScreen"
size="small"
type="primary"
@click="toggleFullscreen"
v-if="config.enableFullscreen !== false"
>
{{ isFullscreen ? '退出全屏' : '全屏编辑' }}
</el-button>
<el-upload

View File

@ -2,7 +2,7 @@
<a v-if="config.href && !disabled" target="_blank" :href="href" :style="config.css || {}">{{ displayText }}</a>
<span v-else-if="config.href && disabled" :style="config.disabledCss || {}">{{ displayText }}</span>
<div v-else class="m-fields-link">
<el-button text @click="editHandler">点击编辑</el-button>
<el-button text type="primary" @click="editHandler">点击编辑</el-button>
<m-form-dialog
ref="editor"
:title="config.formTitle || '编辑扩展配置'"

View File

@ -7,6 +7,7 @@
v-html="action.text"
class="action-btn"
text
type="primary"
size="small"
:key="actionIndex"
@click="actionHandler(action, scope.row, scope.$index)"
@ -15,6 +16,7 @@
class="action-btn"
v-show="editState[scope.$index]"
text
type="primary"
size="small"
@click="save(scope.$index, config)"
>保存</el-button
@ -23,6 +25,7 @@
class="action-btn"
v-show="editState[scope.$index]"
text
type="primary"
size="small"
@click="editState[scope.$index] = undefined"
>取消</el-button
@ -72,9 +75,9 @@ const display = (fuc: boolean | Function | undefined, row: any) => {
return true;
};
const success = (msg: string, action: ColumnActionConfig) => {
const success = (msg: string, action: ColumnActionConfig, row: any) => {
ElMessage.success(msg);
action.after?.();
action.after?.(row);
};
const error = (msg: string) => ElMessage.error(msg);
@ -89,7 +92,7 @@ const deleteAction = async (action: ColumnActionConfig, row: any) => {
const res = await action.handler?.(row);
if (res.ret === 0) {
success('删除成功!', action);
success('删除成功!', action, row);
} else {
error(res.msg || '删除失败');
}
@ -106,7 +109,7 @@ const copyHandler = async (action: ColumnActionConfig, row: any) => {
const res = await action.handler?.(row);
if (res.ret === 0) {
success('复制成功!', action);
success('复制成功!', action, row);
} else {
error(`复制失败!${res.msg}`);
}

View File

@ -9,7 +9,7 @@
:data="scope.row[config.prop]"
></m-table>
<template #reference>
<el-button text> {{ config.text || formatter(config, scope.row) }}</el-button>
<el-button text type="primary"> {{ config.text || formatter(config, scope.row) }}</el-button>
</template>
</el-popover>
</template>

View File

@ -205,9 +205,6 @@ export default defineComponent({
<style lang="scss">
.m-table {
.el-button.action-btn {
margin-right: 10px;
}
.el-button.action-btn + .el-button.action-btn {
margin-left: 0;
}

View File

@ -18,7 +18,7 @@
></m-form-container>
</el-form>
<el-button v-else-if="config.action === 'actionLink'" text @click="config.handler(scope.row)">
<el-button v-else-if="config.action === 'actionLink'" text type="primary" @click="config.handler(scope.row)">
{{ formatter(config, scope.row) }}
</el-button>
@ -34,7 +34,7 @@
<template #content>
<div>{{ formatter(config, scope.row) }}</div>
</template>
<el-button text>扩展配置</el-button>
<el-button text type="primary">扩展配置</el-button>
</el-tooltip>
<el-tag