提交 99dd98b7 编写于 作者: 雪洛's avatar 雪洛

feat: 移除无用的泛型

上级 2f1703ab
......@@ -55,13 +55,13 @@
num: 1,
str: 'ABC'
}
}).then<void>(res => {
}).then(res => {
const result = res.result
this.callFunctionResult = result
console.log(JSON.stringify(result))
uni.hideLoading()
this.notify(result['showMessage'] as string, '提示')
}).catch<void>((err : any | null) => {
}).catch((err : any | null) => {
const error = err as UniCloudError
this.callFunctionError = {
errCode: error.errCode,
......@@ -76,4 +76,4 @@
</script>
<style>
</style>
\ No newline at end of file
</style>
......@@ -67,16 +67,15 @@
.add({
num: 1,
tag: 'default-tag',
date: new Date(),
point: new db.Geo.Point(116, 38)
date: new Date()
})
.then<void>(res => {
.then(res => {
uni.hideLoading()
console.log(res)
this.addId = res.id
this.notify(`新增成功,id: ${res.id}`, '提示')
})
.catch<void>((err : any | null) => {
.catch((err : any | null) => {
uni.hideLoading()
const error = err as UniCloudError
this.notify(error.errMsg, '错误')
......@@ -95,7 +94,7 @@
num: 3,
tag: 'default-tag',
}])
.then<void>((res) => {
.then((res) => {
uni.hideLoading()
console.log(res)
console.log('JSON.stringify(res.inserted)', JSON.stringify(res.inserted))
......@@ -103,7 +102,7 @@
this.batchAddinserted = res.inserted
this.notify(`新增成功条数${res.inserted}, id列表: ${res.ids.join(',')}`, '提示')
})
.catch<void>((err : any | null) => {
.catch((err : any | null) => {
uni.hideLoading()
const error = err as UniCloudError
this.notify(error.errMsg, '错误')
......@@ -123,13 +122,13 @@
.skip(1)
.limit(2)
.get()
.then<void>(res => {
.then(res => {
uni.hideLoading()
console.log(res)
this.getData = res.data
this.notify(`获取成功,取到了${res.data.length}条数据`, '提示')
})
.catch<void>((err : any | null) => {
.catch((err : any | null) => {
uni.hideLoading()
const error = err as UniCloudError
this.notify(error.errMsg, '错误')
......@@ -149,13 +148,13 @@
.skip(1)
.limit(2)
.get()
.then<void>(res => {
.then(res => {
uni.hideLoading()
console.log(res)
this.getWithCommandData = res.data
this.notify(`获取成功,取到了${res.data.length}条数据`, '提示')
})
.catch<void>((err : any | null) => {
.catch((err : any | null) => {
uni.hideLoading()
const error = err as UniCloudError
this.notify(error.errMsg, '错误')
......@@ -173,13 +172,13 @@
.update({
num: 4
})
.then<void>(res => {
.then(res => {
uni.hideLoading()
console.log(res)
this.updateUpdated = res.updated
this.notify(`更新成功,更新了${res.updated}条数据`, '提示')
})
.catch<void>((err : any | null) => {
.catch((err : any | null) => {
uni.hideLoading()
const error = err as UniCloudError
this.notify(error.errMsg, '错误')
......@@ -195,13 +194,13 @@
'tag == "default-tag"'
)
.remove()
.then<void>(res => {
.then(res => {
uni.hideLoading()
console.log(res)
this.removeDeleted = res.deleted
this.notify(`删除成功,删掉了${res.deleted}条数据`, '提示')
})
.catch<void>((err : any | null) => {
.catch((err : any | null) => {
uni.hideLoading()
const error = err as UniCloudError
this.notify(error.errMsg, '错误')
......@@ -246,11 +245,11 @@
tag: "default-tag"
}])
})
.then<void>((_) : void => {
.then((_) : void => {
uni.hideLoading()
this.notify('数据初始化成功', '提示')
})
.catch<void>((err : any | null) => {
.catch((err : any | null) => {
uni.hideLoading()
console.error(err)
const error = err as UniCloudError
......@@ -270,13 +269,13 @@
.getTemp()
db.collection(local, foreign)
.get()
.then<void>(res => {
.then(res => {
uni.hideLoading()
console.log(res)
this.lookupData = res.data
this.notify(`联表查询成功,取到了${res.data.length}条数据`, '提示')
})
.catch<void>((err : any | null) => {
.catch((err : any | null) => {
uni.hideLoading()
const error = err as UniCloudError
this.notify(error.errMsg, '错误')
......@@ -287,4 +286,4 @@
</script>
<style>
</style>
\ No newline at end of file
</style>
......@@ -38,7 +38,7 @@
filePath: tempFilePath,
cloudPath: 'test.jpg'
})
.then<void>(function (res) {
.then(function (res) {
uni.hideLoading()
console.log(res)
uni.showModal({
......@@ -46,7 +46,7 @@
showCancel: false
});
})
.catch<void>(function (err : any | null) {
.catch(function (err : any | null) {
uni.hideLoading()
const error = err as UniCloudError
uni.showModal({
......@@ -68,4 +68,4 @@
</script>
<style>
</style>
\ No newline at end of file
</style>
......@@ -63,11 +63,11 @@
})
const title = this.todoTitle
const content = this.todoContent
todo.add(title, content).then<void>((res : UTSJSONObject) : void => {
todo.add(title, content).then((res : UTSJSONObject) : void => {
this.returnTodoTitle = res['title'] as string
this.returnTodoContent = res['content'] as string
this.notify(res['showMessage'] as string, '提示')
}).catch<void>((err : any | null) : void => {
}).catch((err : any | null) : void => {
const error = err as UniCloudError
console.error(error)
})
......@@ -78,9 +78,9 @@
retry: true
}
})
todoObj.randomFail().then<void>((res : UTSJSONObject) : void => {
todoObj.randomFail().then((res : UTSJSONObject) : void => {
this.notify(res['showMessage'] as string, '提示')
}).catch<void>((err : any | null) : void => {
}).catch((err : any | null) : void => {
const error = err as UniCloudError
console.error(error)
})
......@@ -89,10 +89,10 @@
const todo = uniCloud.importObject('todo', {
customUI: this.isUniTest
})
todo.fail().then<void>((res : UTSJSONObject) : void => {
todo.fail().then((res : UTSJSONObject) : void => {
this.notify('todo.fail应调用失败,此处错误的触发了成功回调', '错误')
console.log('todo.fail: ', res);
}).catch<void>((err : any | null) : void => {
}).catch((err : any | null) : void => {
const error = err as UniCloudError
this.failErrCode = error.errCode as string
console.error(error)
......@@ -107,10 +107,10 @@
const todo = uniCloud.importObject('todo', {
customUI: this.isUniTest
})
todo.success().then<void>((res : UTSJSONObject) : void => {
todo.success().then((res : UTSJSONObject) : void => {
this.successErrCode = res['errCode'] as number
this.notify(res['showMessage'] as string, '提示')
}).catch<void>((err : any | null) : void => {
}).catch((err : any | null) : void => {
const error = err as UniCloudError
console.error(error)
})
......@@ -121,4 +121,4 @@
<style>
</style>
\ No newline at end of file
</style>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册