diff --git a/src/App.vue b/src/App.vue index 7f15db3..85d8155 100644 --- a/src/App.vue +++ b/src/App.vue @@ -14,9 +14,8 @@ - {{userInfo.username.slice(0, 5)}} + {{userInfo.username.slice(0, 5)}} - @@ -138,22 +137,25 @@ export default { fn() } else { // 已登录 系统无数据 - getObject('BOOKMARK').then((res) => { - if (res.length > 0) { - rowData = JSON.parse(res[0].attributes.formDatas) - } else { + getObject('BOOKMARK') + .then((res) => { + if (res.length > 0) { + rowData = JSON.parse(res[0].attributes.formDatas) + } else { + localStorage.setItem('BOOKMARK', JSON.stringify(myData)) + rowData = JSON.parse(JSON.stringify(myData)) + } + }) + .catch(() => { localStorage.setItem('BOOKMARK', JSON.stringify(myData)) rowData = JSON.parse(JSON.stringify(myData)) - } - }).catch(() => { - localStorage.setItem('BOOKMARK', JSON.stringify(myData)) - rowData = JSON.parse(JSON.stringify(myData)) - }).finally(() => { - fn() - data.data = rowData - data.bookMark = rowData[0].children - data.allData = flatten(rowData) - }) + }) + .finally(() => { + fn() + data.data = rowData + data.bookMark = rowData[0].children + data.allData = flatten(rowData) + }) } } diff --git a/src/components/Dialog.vue b/src/components/Dialog.vue index d7e2209..9eec8ed 100644 --- a/src/components/Dialog.vue +++ b/src/components/Dialog.vue @@ -46,21 +46,21 @@ import { ElMessage } from 'element-plus' export default { model: { value: 'isDetailVisible', - events: 'closeViews' + events: 'closeViews', }, props: { isDetailVisible: { type: Boolean, - default: false + default: false, }, selectType: { type: Number, - default: 0 + default: 0, }, detail: { type: Object, - default: () => {} - } + default: () => {}, + }, }, setup(props, context) { const isBOOKMARK = JSON.parse(localStorage.getItem('BOOKMARK')) @@ -71,13 +71,13 @@ export default { type: '', desc: '', url: '', - logo: '' - } + logo: '', + }, }) // 定义校验规则 表单代码中必须以 :rules 接收 const rules = { title: [{ required: true, message: '请输入书签名称', trigger: 'blur' }], - type: [{ required: true, message: '请选择书签类别', trigger: 'change' }] + type: [{ required: true, message: '请选择书签类别', trigger: 'change' }], } const refruleForm = ref(null) // 确定按钮的格式 @@ -101,7 +101,9 @@ export default { // 更改了分类 // 当前分类删除该数据 if (myDetail.type === v.type) { - const pindex = v.children.findIndex(p => p.title === myDetail.title) + const pindex = v.children.findIndex( + (p) => p.title === myDetail.title + ) v.children.splice(pindex, 1) } // 新分类添加该分类 @@ -148,11 +150,10 @@ export default { submitForm, refruleForm, rules, - BOOKMARK + BOOKMARK, } }, - methods: { - } + methods: {}, } diff --git a/src/components/Login.vue b/src/components/Login.vue index f937ec4..942cc85 100644 --- a/src/components/Login.vue +++ b/src/components/Login.vue @@ -12,7 +12,6 @@ -