style: 移除不必要的 Promise 声明
This commit is contained in:
@@ -77,14 +77,12 @@ export function dbGet ({
|
|||||||
defaultValue = '',
|
defaultValue = '',
|
||||||
user = false
|
user = false
|
||||||
}) {
|
}) {
|
||||||
return new Promise(resolve => {
|
return cloneDeep(db.get(pathInit({
|
||||||
resolve(cloneDeep(db.get(pathInit({
|
dbName,
|
||||||
dbName,
|
path,
|
||||||
path,
|
user,
|
||||||
user,
|
defaultValue
|
||||||
defaultValue
|
})).value())
|
||||||
})).value()))
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -98,9 +96,7 @@ export function database ({
|
|||||||
validator = () => true,
|
validator = () => true,
|
||||||
defaultValue = ''
|
defaultValue = ''
|
||||||
} = {}) {
|
} = {}) {
|
||||||
return new Promise(resolve => {
|
return db.get(pathInit({
|
||||||
resolve(db.get(pathInit({
|
dbName, path, user, validator, defaultValue
|
||||||
dbName, path, user, validator, defaultValue
|
}))
|
||||||
})))
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,23 +26,18 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
// [业务逻辑] 根据 id 获取数据
|
// [业务逻辑] 根据 id 获取数据
|
||||||
getFormData (id) {
|
async getFormData (id) {
|
||||||
return new Promise((resolve, reject) => {
|
// 重置表单
|
||||||
// 重置表单
|
this.resetFormData()
|
||||||
this.resetFormData()
|
// 请求数据
|
||||||
// 请求数据
|
try {
|
||||||
detail(id)
|
const res = await detail(id)
|
||||||
.then(res => {
|
const { name, address } = res
|
||||||
const { name, address } = res
|
this.form = { name, address }
|
||||||
this.form = { name, address }
|
this.$message.success('getFormData')
|
||||||
this.$message.success('getFormData')
|
} catch (error) {
|
||||||
resolve()
|
console.log('error', error)
|
||||||
})
|
}
|
||||||
.catch(err => {
|
|
||||||
console.log('err', err)
|
|
||||||
reject(err)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
// [业务逻辑] 提交
|
// [业务逻辑] 提交
|
||||||
handleSubmit () {
|
handleSubmit () {
|
||||||
|
|||||||
Reference in New Issue
Block a user