1
0
mirror of https://github.com/PanJiaChen/vue-element-admin.git synced 2025-08-10 12:01:57 +08:00

fix: Lock record get values with router (#941)

This commit is contained in:
Edwin Betancourt 2021-06-26 21:24:31 -04:00 committed by GitHub
parent 548bb2f165
commit 69ba12d833
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 37 additions and 29 deletions

View File

@ -17,29 +17,28 @@
--> -->
<template> <template>
<div> <span v-if="isFirstTab" key="withTooltip">
<span v-if="isFirstTab" key="tooltip"> <el-tooltip
<el-tooltip v-if="isFirstTab"
v-if="isFirstTab" :content="isLocked ? $t('data.lockRecord') : $t('data.unlockRecord')"
:content="isLocked ? $t('data.lockRecord') : $t('data.unlockRecord')" placement="top"
placement="top" >
> <el-button type="text" @click="lockRecord()">
<el-button type="text" @click="lockRecord()"> <i
<i :class="isLocked ? 'el-icon-lock' : 'el-icon-unlock'"
:class="isLocked ? 'el-icon-lock' : 'el-icon-unlock'" style="font-size: 15px; color: black;"
style="font-size: 15px; color: black;" />
/> </el-button>
</el-button> </el-tooltip>
</el-tooltip>
<span :style="isLocked ? 'color: red;' :'color: #1890ff;'">
{{ tabName }}
</span>
</span>
<template v-else> <span :style="isLocked ? 'color: red;' :'color: #1890ff;'">
{{ tabName }} {{ tabName }}
</template> </span>
</div> </span>
<span v-else key="onlyName">
{{ tabName }}
</span>
</template> </template>
<script> <script>
@ -49,6 +48,10 @@ export default defineComponent({
name: 'LockRecord', name: 'LockRecord',
props: { props: {
tabUuid: {
type: String,
required: true
},
tabPosition: { tabPosition: {
type: Number, type: Number,
default: 0 default: 0
@ -56,12 +59,16 @@ export default defineComponent({
tabName: { tabName: {
type: String, type: String,
required: true required: true
},
tableName: {
type: String,
required: true
} }
}, },
setup(props, { root }) { setup(props, { root }) {
const { tabUuid: containerUuid } = root.$route.meta const containerUuid = props.tabUuid
const { tableName } = root.$route.params const tableName = props.tableName
const isFirstTab = computed(() => { const isFirstTab = computed(() => {
return props.tabPosition === 0 return props.tabPosition === 0

View File

@ -28,12 +28,13 @@
:disabled="Boolean(key > 0 && isCreateNew)" :disabled="Boolean(key > 0 && isCreateNew)"
:style="tabParentStyle" :style="tabParentStyle"
> >
<span slot="label"> <lock-record
<lock-record slot="label"
:tab-position="key" :tab-position="key"
:tab-name="tabAttributes.name" :tab-uuid="tabAttributes.uuid"
/> :table-name="tabAttributes.tableName"
</span> :tab-name="tabAttributes.name"
/>
<main-panel <main-panel
:parent-uuid="windowUuid" :parent-uuid="windowUuid"