fix: 请求地址,localStorage(key)优化

This commit is contained in:
@changcode
2022-04-14 15:52:07 +08:00
parent 58e2d233d6
commit 2cc23bf1a9
24 changed files with 147 additions and 92 deletions

View File

@@ -38,6 +38,7 @@
</template>
<script>
import { storageKey } from '@/utils/constants'
export default {
props: {
customTableTitle: Array, // 自定义的title
@@ -51,9 +52,9 @@ export default {
}
},
created () {
const localStorageTitle = JSON.parse(localStorage.getItem('cn-tableTitle-' + localStorage.getItem('cn-username') + '-' + this.tableId))
const localStorageTitle = JSON.parse(localStorage.getItem(storageKey.tableTitle + '-' + localStorage.getItem(storageKey.username) + '-' + this.tableId))
if (localStorageTitle) {
localStorage.setItem('cn-tableTitle-' + localStorage.getItem('cn-username') + '-' + this.tableId, JSON.stringify(localStorageTitle))
localStorage.setItem(storageKey.tableTitle + '-' + localStorage.getItem(storageKey.username) + '-' + this.tableId, JSON.stringify(localStorageTitle))
}
},
watch: {
@@ -92,10 +93,8 @@ export default {
// 点击第二个cancel
save () {
this.$emit('update', this.custom)
localStorage.setItem(
'cn-tableTitle-' + localStorage.getItem('cn-username') + '-' + this.tableId,
JSON.stringify(this.custom)
)
localStorage.setItem(storageKey.tableTitle + '-' + localStorage.getItem(storageKey.username) + '-' + this.tableId,
JSON.stringify(this.custom))
this.esc()
}
},