diff --git a/pages.json b/pages.json index 910a1da3516257a79ba57a51def55acb8d0f5544..cd4197ef6dcd0b831fbb33677a8d0c4bdc1d325b 100644 --- a/pages.json +++ b/pages.json @@ -672,6 +672,12 @@ "navigationBarTitleText": "" } }, + { + "path": "pages/API/import-object/import-object", + "style": { + "navigationBarTitleText": "" + } + }, { "path": "pages/API/get-system-info/get-system-info", "style": { diff --git a/pages/API/call-function/call-function.uvue b/pages/API/call-function/call-function.uvue index 3756652e7ffd3ab18b2c2421d9bc1fb765b7c9a4..c40f6ab287fdd29516536ad36175c82453edc892 100644 --- a/pages/API/call-function/call-function.uvue +++ b/pages/API/call-function/call-function.uvue @@ -18,7 +18,7 @@ export default { data() { return { - title: 'uniCloud.callFunction' + title: '请求云函数' } }, onLoad() { diff --git a/pages/API/import-object/import-object.uvue b/pages/API/import-object/import-object.uvue new file mode 100644 index 0000000000000000000000000000000000000000..ec1edf743038902c31c66dece09261e8c4382d88 --- /dev/null +++ b/pages/API/import-object/import-object.uvue @@ -0,0 +1,116 @@ + + + + + diff --git a/pages/tabBar/API.uvue b/pages/tabBar/API.uvue index e3f45999ad98714491fdb3123c76e1b8440f6116..57869cfc5777463a7a8410e6b60d6a4bbac175ac 100644 --- a/pages/tabBar/API.uvue +++ b/pages/tabBar/API.uvue @@ -385,6 +385,10 @@ name: '云函数', url: 'call-function', }, + { + name: '云对象', + url: 'import-object', + }, ] as Page[], }, /* { diff --git a/uniCloud-aliyun/cloudfunctions/todo/index.obj.js b/uniCloud-aliyun/cloudfunctions/todo/index.obj.js new file mode 100644 index 0000000000000000000000000000000000000000..0f33ab3dd2f48e1431c3c6876995efde1610cbae --- /dev/null +++ b/uniCloud-aliyun/cloudfunctions/todo/index.obj.js @@ -0,0 +1,39 @@ +// 云对象教程: https://uniapp.dcloud.net.cn/uniCloud/cloud-obj +// jsdoc语法提示教程:https://ask.dcloud.net.cn/docs/#//ask.dcloud.net.cn/article/129 +module.exports = { + async add(title, content) { + console.log(title, content) + return { + showMessage: `Todo added, title: ${title}, content: ${content}` + } + }, + async randomFail() { + const random = Math.random() + console.log(random); + if (random > 0.5) { + return { + errCode: 'RANDOM_FAIL', + errMsg: 'todo.randomFail failed' + } + } else { + return { + errCode: 0, + errMsg: '', + showMessage: 'todo.randomFail successed' + } + } + }, + async fail() { + return { + errCode: 'TEST_ERROR_CODE', + errMsg: 'todo.fail failed', + } + }, + async success() { + return { + errCode: 0, + errMsg: '', + showMessage: 'todo.success successed' + } + } +} diff --git a/uniCloud-aliyun/cloudfunctions/todo/package.json b/uniCloud-aliyun/cloudfunctions/todo/package.json new file mode 100644 index 0000000000000000000000000000000000000000..217bc85cf26801806122fed25a297cfa417acfd1 --- /dev/null +++ b/uniCloud-aliyun/cloudfunctions/todo/package.json @@ -0,0 +1,6 @@ +{ + "name": "todo", + "dependencies": {}, + "extensions": { + } +} \ No newline at end of file