diff --git a/README.md b/README.md index a2c26f58bc0eba4ae1fcae52fb1978ede31a12a0..1846e5e9bffd44186f09378bfbbf896e5e972b42 100644 --- a/README.md +++ b/README.md @@ -43,4 +43,8 @@ 8. 标题(Badge)组件 [详情](https://vuepress.vuejs.org/zh/guide/using-vue.html#badge) ![](https://web-assets.dcloud.net.cn/unidoc/zh/docs_bage_component.jpg) 9. 可使用模板语法 [详情](https://vuepress.vuejs.org/zh/guide/using-vue.html#%E6%A8%A1%E6%9D%BF%E8%AF%AD%E6%B3%95) - ![](https://web-assets.dcloud.net.cn/unidoc/zh/docs_temp_code.jpg) \ No newline at end of file + ![](https://web-assets.dcloud.net.cn/unidoc/zh/docs_temp_code.jpg) +10. 图片点击放大 `img.class="zooming"` + ```html + + ``` \ No newline at end of file diff --git a/docs/api/request/socket-task.md b/docs/api/request/socket-task.md index 40f67d054862fbc61b060cb3ec2c70da1f597843..d350f425c85e4ba333309f08e3b0f4b6b371ac89 100644 --- a/docs/api/request/socket-task.md +++ b/docs/api/request/socket-task.md @@ -72,6 +72,15 @@ WebSocket 连接打开事件的回调函数 WebSocket 连接关闭事件的回调函数 +**回调函数中的参数** + +`Object` + +|属性|类型|说明|平台兼容性| +|:-|:-|:-|:-| +|code|number|一个数字值表示关闭连接的状态号,表示连接被关闭的原因。|HBuilderX(3.7.12+)| +|reason|string|一个可读的字符串,表示连接被关闭的原因。|HBuilderX(3.7.12+)| + ### SocketTask.onError(CALLBACK) 监听 WebSocket 错误事件 diff --git a/docs/collocation/manifest-app.md b/docs/collocation/manifest-app.md index 41b1c4bbcbcc0ff6a198ee19bc7c4fc65c2a2067..642e566bd7e570bba775650deab4b7ab626460a6 100644 --- a/docs/collocation/manifest-app.md +++ b/docs/collocation/manifest-app.md @@ -57,6 +57,14 @@ iOS平台云端打包相关配置 |CFBundleName|String|应用的CFBundleName名称,默认值为HBuilder| |validArchitectures|Array|编译时支持的CPU指令,可取值arm64、arm64e、armv7、armv7s、x86_64| |pushRegisterMode|String|使用“Push(消息推送)”模块时申请系统推送权限模式,设置为manual表示调用push相关API时申请,设置为其它值表示应用启动时自动申请| +|privacyRegisterMode|String|设置为manual表示同意隐私政策后再获取相关隐私信息,设置为其它值表示应用启动时自动获取[详见](/collocation/manifest?id=privacyRegisterMode)| + + +#### privacyRegisterMode@privacyRegisterMode +为了统计应用的崩溃信息,应用在启动时需要获取idfv,虽然不影响苹果审核但是可能被部分合规检测机构判定为不合规。需要通过隐私合规检测的应用可以将字段配置为manual,并且在用户点击同意隐私政策的方法里执行`plus.runtime.argeePrivacy()`即可。 +注意:配置后如未调用`plus.runtime.argeePrivacy()`会导致崩溃统计失效。 + + @@ -262,7 +270,8 @@ iOS平台云端打包相关配置 "validArchitectures": [ //可选,字符串数组类型,编译时支持的CPU指令,可取值arm64、arm64e、armv7、armv7s、x86_64 "arm64" ], - "pushRegisterMode": "manual" //可选,使用“Push(消息推送)”模块时申请系统推送权限模式,manual表示调用push相关API时申请,其它值表示应用启动时自动申请 + "pushRegisterMode": "manual", //可选,使用“Push(消息推送)”模块时申请系统推送权限模式,manual表示调用push相关API时申请,其它值表示应用启动时自动申请 + "privacyRegisterMode": "manual" //可选,仅iOS有效,设置为manual表示用户同意隐私政策后才获取idfv,设置为其它值表示应用启动时自动获取 }, "sdkConfigs": { //可选,JSON对象,三方SDK相关配置 "geolocation": { //可选,JSON对象,Geolocation(定位)模块三方SDK配置 diff --git a/docs/component/map.md b/docs/component/map.md index d4806220e105779f05ba1c3627e1c47d702c155b..e2d157d0cbe03fcc89405b40469e1ebb342e0a35 100644 --- a/docs/component/map.md +++ b/docs/component/map.md @@ -15,7 +15,7 @@ |地图服务商|App|H5|微信小程序| |:-:|:-:|:-:|:-:| |高德|√|3.6.0+|| -|Goolge|3.4+|3.2.10+|| +|Goolge|3.4+ 仅nvue页面|3.2.10+|| |腾讯||√|√| diff --git a/docs/plugin/uts-for-android.md b/docs/plugin/uts-for-android.md index de787315f42bbd8cd47b06da1946ea4fb71a0e43..21970c5982691316e1980b9ca06c78eb24234e46 100644 --- a/docs/plugin/uts-for-android.md +++ b/docs/plugin/uts-for-android.md @@ -1047,6 +1047,20 @@ console.log(permissionArray.toTypedArray()) ``` +### 6.7 如何生成byte[]对象 + +在java平台中,二进制操作一般采用字节数组实现。 + +UTS在android平台编译后的语言为Kotlin,对应的语法对象是ByteArray. + +使用这个类不需要额外引入包,直接运行即可 + +下面是一个简单的示例 + +``` +let byteTest = new ByteArray(5) +console.log(byteTest) +``` ## 7 已知待解决问题(持续更新) diff --git a/docs/tutorial/syntax-uts.md b/docs/tutorial/syntax-uts.md index a4fc09e9af45ab02285273de4fcc5d9f21dc0820..f1e27f42a27d4b236cf464d90835adf4605b216a 100644 --- a/docs/tutorial/syntax-uts.md +++ b/docs/tutorial/syntax-uts.md @@ -2993,11 +2993,264 @@ console.log(financial(0.004)); // expected output: "0.00" ``` +### RegExp + +RegExp 对象用于将文本与一个模式匹配。 + +#### 实例属性 + +#### dotAll + +dotAll 属性表明是否在正则表达式中一起使用"s"修饰符。 + +**平台差异说明** + +|JavaScript|Kotlin|Swift| +|:-:|:-:|:-:| +|√|x|x| + +```ts +const regex1 = new RegExp('foo', 's'); + +console.log(regex1.dotAll); +// expected output: true + +const regex2 = new RegExp('bar'); + +console.log(regex2.dotAll); +// expected output: false +``` + +#### flags + +flags 属性属性返回一个字符串,由当前正则表达式对象的标志组成。 + +**平台差异说明** + +|JavaScript|Kotlin|Swift| +|:-:|:-:|:-:| +|√|x|x| + +```ts +console.log(/foo/ig.flags); +// expected output: "gi" + +console.log(/bar/myu.flags); +// expected output: "muy" +``` + +#### global + +global 属性表明正则表达式是否使用了 "g" 标志。 + +**平台差异说明** + +|JavaScript|Kotlin|Swift| +|:-:|:-:|:-:| +|√|x|x| + +```ts +var regex = new RegExp("foo", "g") + +console.log(regex.global) // true +// expected output: "muy" +``` + +#### hasIndices + +hasIndices 属性指示 "d" 标志是否与正则表达式一起使用。 + +**平台差异说明** + +|JavaScript|Kotlin|Swift| +|:-:|:-:|:-:| +|√|x|x| + +```ts +const regex1 = new RegExp('foo', 'd'); + +console.log(regex1.hasIndices); +// expected output: true + +const regex2 = new RegExp('bar'); + +console.log(regex2.hasIndices); +// expected output: false +``` + +#### lastIndex + +lastIndex 是正则表达式的一个可读可写的整型属性,用来指定下一次匹配的起始索引。 + +**平台差异说明** + +|JavaScript|Kotlin|Swift| +|:-:|:-:|:-:| +|√|x|x| + +```ts +const regex1 = new RegExp('foo', 'g'); +const str1 = 'table football, foosball'; + +regex1.test(str1); + +console.log(regex1.lastIndex); +// expected output: 9 + +regex1.test(str1); + +console.log(regex1.lastIndex); +// expected output: 19 +``` + +#### multiline + +multiline 属性表明正则表达式是否使用了 "m" 标志。 + +**平台差异说明** + +|JavaScript|Kotlin|Swift| +|:-:|:-:|:-:| +|√|x|x| + +```ts +var regex = new RegExp("foo", "m"); + +console.log(regex.multiline); +// expected output: true +``` + +#### source + +source 属性返回一个值为当前正则表达式对象的模式文本的字符串,该字符串不会包含正则字面量两边的斜杠以及任何的标志字符。 + +**平台差异说明** + +|JavaScript|Kotlin|Swift| +|:-:|:-:|:-:| +|√|x|x| + +```ts +const regex1 = /fooBar/ig; + +console.log(regex1.source); +// expected output: "fooBar" + +console.log(new RegExp().source); +// expected output: "(?:)" +``` + +#### sticky + +sticky 属性反映了搜索是否具有粘性(仅从正则表达式的 lastIndex 属性表示的索引处搜索)。 + +**平台差异说明** + +|JavaScript|Kotlin|Swift| +|:-:|:-:|:-:| +|√|x|x| + +```ts +const str1 = 'table football'; +const regex1 = new RegExp('foo', 'y'); + +regex1.lastIndex = 6; + +console.log(regex1.sticky); +// expected output: true + +console.log(regex1.test(str1)); +// expected output: true + +console.log(regex1.test(str1)); +// expected output: false +``` + +#### unicode + +unicode 属性表明正则表达式带有"u" 标志。 + +**平台差异说明** + +|JavaScript|Kotlin|Swift| +|:-:|:-:|:-:| +|√|x|x| + +```ts +var regex = new RegExp('\u{61}', 'u'); + +console.log(regex.unicode); +// expected output: true +``` +#### 实例方法 + +#### exec + +exec() 方法在一个指定字符串中执行一个搜索匹配。返回一个结果数组或 null。 + +```ts +const regex1 = RegExp('foo*', 'g'); +const str1 = 'table football, foosball'; +let array1; + +while ((array1 = regex1.exec(str1)) !== null) { + console.log(`Found ${array1[0]}. Next starts at ${regex1.lastIndex}.`); + // expected output: "Found foo. Next starts at 9." + // expected output: "Found foo. Next starts at 19." +} +``` + +#### test + +test() 方法执行一个检索,用来查看正则表达式与指定的字符串是否匹配。返回 true 或 false。 + +```ts +const str = 'table football'; + +const regex = new RegExp('foo*'); +const globalRegex = new RegExp('foo*', 'g'); + +console.log(regex.test(str)); +// expected output: true + +console.log(globalRegex.lastIndex); +// expected output: 0 + +console.log(globalRegex.test(str)); +// expected output: true + +console.log(globalRegex.lastIndex); +// expected output: 9 + +console.log(globalRegex.test(str)); +// expected output: false +``` + +#### toString + +toString() 返回一个表示该正则表达式的字符串。 + +```ts +console.log(new RegExp('a+b+c')); +// expected output: /a+b+c/ + +console.log(new RegExp('a+b+c').toString()); +// expected output: "/a+b+c/" + +console.log(new RegExp('bar', 'g').toString()); +// expected output: "/bar/g" + +console.log(new RegExp('\n', 'g').toString()); +// expected output (if your browser supports escaping): "/\n/g" + +console.log(new RegExp('\\n', 'g').toString()); +// expected output: "/\n/g" +``` + ### Set Set 对象是值的集合,你可以按照插入的顺序迭代它的元素。Set 中的元素只会出现一次,即 Set 中的元素是唯一的。 - #### 实例属性 #### size diff --git a/docs/uniCloud/README.md b/docs/uniCloud/README.md index 77a55bcb5a085f280c5b6a83306f867d77835d1b..a1a7973c2b23b1523bee6ec63980ad540f6b4807 100644 --- a/docs/uniCloud/README.md +++ b/docs/uniCloud/README.md @@ -19,7 +19,7 @@ uniCloud为每个开发者提供一个免费服务空间,让你也可以拥有 ### 看视频,只需25分钟,快速入门uniCloud - uniCloud视频教程 +
### uniCloud是什么和不是什么 diff --git a/docs/uniCloud/jql-schema-ext.md b/docs/uniCloud/jql-schema-ext.md index d5de2f508d7e276ba4cfbd440defaa7835899cf7..7749f2325d36c3cf4b34d0b996dd1316b2da47c5 100644 --- a/docs/uniCloud/jql-schema-ext.md +++ b/docs/uniCloud/jql-schema-ext.md @@ -94,7 +94,7 @@ ext.js里引入公共模块的机制: |limit |number |- |否 |返回的结果集(文档数量)的限制,新增于`3.7.0` | |sample |object |- |否 |sample(随机选取)方法的参数,新增于`3.7.0` | |docId |string |- |否 |doc方法的参数,数据库记录的_id,新增于`3.7.0` | -|isGetTempLookup |boolean |- |联表触发时必备,仅主表触发器有此参数 |联表查询时用于标识,本次查询是否使用了getTemp,新增于`3.7.1` | +|isGetTempLookup |boolean |- |联表触发时必备 |联表查询时用于标识,本次查询是否使用了getTemp,新增于`3.7.1` | #### secondaryCollection@secondary-collection @@ -475,12 +475,11 @@ module.exports { beforeUpdate: async function({ collection, operation, - where, + docId, updateData, clientInfo } = {}) { - const id = where && where._id - if(typeof id === 'string' && (updateData.title || updateData.content)) { //如果字段较多,也可以不列举字段,删掉后半个判断 + if(typeof docId === 'string' && (updateData.title || updateData.content)) { //如果字段较多,也可以不列举字段,删掉后半个判断 if(updateData.content) { // updateData.summary = 'xxxx' // 根据content生成summary } @@ -500,16 +499,15 @@ module.exports { afterRead: async function({ collection, operation, - where, + docId, field, clientInfo } = {}) { const db = uniCloud.database() - const id = where && where._id // clientInfo.uniIdToken可以解出客户端用户信息,再进行判断是否应该加1。为了让示例简单清晰,此处省略相关逻辑 - if(typeof id === 'string' && field.includes('content')) { + if(typeof docId === 'string' && field.includes('content')) { // 读取了content字段后view_count加1 - await db.collection('article').where(where).update({ + await db.collection('article').doc(docId).update({ view_count: db.command.inc(1) }) } @@ -527,15 +525,14 @@ module.exports { beforeDelete: async function({ collection, operation, - where, + docId, clientInfo } = {}) { const db = uniCloud.database() - const id = where && where._id - if(typeof id !== 'string') { // 此处也可以加入管理员可以批量删除的逻辑 + if(typeof docId !== 'string') { // 此处也可以加入管理员可以批量删除的逻辑 throw new Error('禁止批量删除') } - const res = await db.collection('article').where(where).get() + const res = await db.collection('article').doc(docId).get() const record = res.data[0] if(record) { await db.collection('article-archived').add(record) @@ -632,12 +629,11 @@ uniCloud.databaseForJQL({ module.exports = { trigger: { afterRead: async function ({ - where, + docId, field, clientInfo } = {}) { - const id = where && where._id - if(typeof id !== 'string' || !field.includes('content')) { + if(typeof docId !== 'string' || !field.includes('content')) { return } const dbJQL = uniCloud.databaseForJQL({ @@ -646,7 +642,7 @@ module.exports = { }) await dbJQL.collection('article-view-log') .add({ - article_id: id, + article_id: docId, reader_id: dbJQL.getCloudEnv('$cloudEnv_uid') }) } diff --git a/package.json b/package.json index ac262d66d0ba9cd3a04218f7376caac7804ee04f..43496795ddb4a94647fff6c8503a2a1d370cd8c0 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "cross-env": "^7.0.3", "fs-extra": "^10.0.0", "glob": "^7.1.7", - "vuepress-theme-uni-app-test": "^1.3.6" + "vuepress-theme-uni-app-test": "^1.3.7" }, "dependencies": { "@docsearch/js": "^3.1.0", diff --git a/yarn.lock b/yarn.lock index a90c743d2189d95df25fdca655aab7d82a1897c0..2e2bd565a825438445c3f589053b30be7728496b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9215,10 +9215,10 @@ vuepress-plugin-zooming@^1.1.8: dependencies: zooming "^2.1.1" -vuepress-theme-uni-app-test@^1.3.6: - version "1.3.6" - resolved "https://registry.npmmirror.com/vuepress-theme-uni-app-test/-/vuepress-theme-uni-app-test-1.3.6.tgz#f22a5084988ccb047a36415622d020cb1cd3049e" - integrity sha512-r734HP1GcBDVOd4gGI98UO423zljYVucxbo4oJB8+4cgxs7kji7NHVbzbrcG1KhLIqhwX/IuyYNKeQ/NlmrY2w== +vuepress-theme-uni-app-test@^1.3.7: + version "1.3.7" + resolved "https://registry.npmmirror.com/vuepress-theme-uni-app-test/-/vuepress-theme-uni-app-test-1.3.7.tgz#1c8495dff68d5e66803a45a28deae234c5ac2d06" + integrity sha512-cUQxjuWNlpm8SrqoadnkEoBMWOJeSoX7Nn7uvYuGJ7myxpluv/r/CuRT7or8rvf181iIRei6/qNEtoLV8icPuw== dependencies: "@vuepress/plugin-back-to-top" "^1.9.5" "@vuepress/theme-default" "^1.8.2"