提交 16ec2f4e 编写于 作者: D DCloud_LXH

feat: uts api

上级 5c38b259
......@@ -106,7 +106,17 @@ const config = {
},
plugins: [
["vuepress-plugin-juejin-style-copy", copyOptions]
]
],
/**
*
* @param {string} path path: js 资源文件路径
* @param {string} type type: 资源文件类型,取值有 script 等
* @returns
*/
shouldPrefetch: (path, type) => {
if (type === 'script' && path.indexOf('/docs/') > -1) return false
return true
}
}
module.exports = config
\ No newline at end of file
let cssJson = {};
let utsJson = {};
let utsApiJson = {};
try {
cssJson = require('../utils/cssJson.json');
} catch (error) {}
try {
utsJson = require('../utils/utsJson.json');
} catch (error) {}
try {
utsApiJson = require('../utils/utsApiJson.json');
} catch (error) {}
function getRegExp(key) {
return new RegExp(`<!--\\s*${key}.([\\w\\W]+[^\\s])\\s*-->`)
}
const getJSON = text => {
let match = text.match(/<!--\s*CSSJSON.([\w\W]+[^\s])\s*-->/);
let match = text.match(getRegExp('CSSJSON'));
if (match) {
return {
match,
json: cssJson,
};
}
match = text.match(/<!--\s*UTSJSON.([\w\W]+[^\s])\s*-->/);
match = text.match(getRegExp('UTSJSON'));
if (match) {
return {
match,
json: utsJson,
};
}
match = text.match(getRegExp('UTSAPIJSON'));
if (match) {
return {
match,
json: utsApiJson,
};
}
return {
match: null,
......@@ -33,8 +49,8 @@ const getJSON = text => {
module.exports = function (md, opts) {
if (Object.keys(cssJson) === 0) return false;
md.core.ruler.after('inline', 'merge-css', function (state) {
/* const ids = []
let idIdx = 1 */
const ids = []
let idIdx = 1
for (let index = 0; index < state.tokens.length; index++) {
const blockToken = state.tokens[index];
if (blockToken.type === 'html_block') {
......@@ -47,9 +63,9 @@ module.exports = function (md, opts) {
if (!temp) return false;
temp = temp[key];
});
if (!temp) continue
const parseTokens = md.parse(temp, undefined, false);
/* parseTokens.forEach(token => {
if (!temp) continue;
const parseTokens = md.parse(temp);
parseTokens.forEach(token => {
if (token.type === 'heading_open') {
const id = token.attrGet('id')
if(ids.includes(id)) {
......@@ -58,7 +74,7 @@ module.exports = function (md, opts) {
ids.push(id)
}
}
}) */
})
state.tokens.splice(index, 1, ...parseTokens);
index = index + parseTokens.length - 1;
// blockToken.content = temp
......
此差异已折叠。
......@@ -89,6 +89,7 @@
* [text-decoration-thickness](css/text-decoration-thickness.md)
* [visibility](css/visibility.md)
* [lines](css/lines.md)
* [API](api.md)
* [事件](event.md)
<!-- * [新建项目]()
* [1. 通过 HBuilderX 可视化界面](quickstart-hx.md)
......
## uni.createInnerAudioContext() @createinneraudiocontext
<!-- UTSAPIJSON.createInnerAudioContext.description -->
<!-- UTSAPIJSON.createInnerAudioContext.param -->
<!-- UTSAPIJSON.createInnerAudioContext.returnValue -->
<!-- UTSAPIJSON.createInnerAudioContext.compatibility -->
<!-- UTSAPIJSON.createInnerAudioContext.tutorial -->
## uni.getBackgroundAudioManager() @getbackgroundaudiomanager
<!-- UTSAPIJSON.getBackgroundAudioManager.description -->
<!-- UTSAPIJSON.getBackgroundAudioManager.param -->
<!-- UTSAPIJSON.getBackgroundAudioManager.returnValue -->
<!-- UTSAPIJSON.getBackgroundAudioManager.compatibility -->
<!-- UTSAPIJSON.getBackgroundAudioManager.tutorial -->
## uni.exitApp() @exitapp
<!-- UTSAPIJSON.exitApp.description -->
<!-- UTSAPIJSON.exitApp.param -->
<!-- UTSAPIJSON.exitApp.returnValue -->
<!-- UTSAPIJSON.exitApp.compatibility -->
<!-- UTSAPIJSON.exitApp.tutorial -->
## uni.getFileSystemManager() @getfilesystemmanager
<!-- UTSAPIJSON.getFileSystemManager.description -->
<!-- UTSAPIJSON.getFileSystemManager.param -->
<!-- UTSAPIJSON.getFileSystemManager.returnValue -->
<!-- UTSAPIJSON.getFileSystemManager.compatibility -->
<!-- UTSAPIJSON.getFileSystemManager.tutorial -->
## uni.getAccessibilityInfo() @getaccessibilityinfo
<!-- UTSAPIJSON.getAccessibilityInfo.description -->
<!-- UTSAPIJSON.getAccessibilityInfo.param -->
<!-- UTSAPIJSON.getAccessibilityInfo.returnValue -->
<!-- UTSAPIJSON.getAccessibilityInfo.compatibility -->
<!-- UTSAPIJSON.getAccessibilityInfo.tutorial -->
## uni.getAppAuthorizeSetting() @getappauthorizesetting
<!-- UTSAPIJSON.getAppAuthorizeSetting.description -->
<!-- UTSAPIJSON.getAppAuthorizeSetting.param -->
<!-- UTSAPIJSON.getAppAuthorizeSetting.returnValue -->
<!-- UTSAPIJSON.getAppAuthorizeSetting.compatibility -->
<!-- UTSAPIJSON.getAppAuthorizeSetting.tutorial -->
## uni.getAppBaseInfo(config?) @getappbaseinfo
<!-- UTSAPIJSON.getAppBaseInfo.description -->
<!-- UTSAPIJSON.getAppBaseInfo.param -->
<!-- UTSAPIJSON.getAppBaseInfo.returnValue -->
<!-- UTSAPIJSON.getAppBaseInfo.compatibility -->
<!-- UTSAPIJSON.getAppBaseInfo.tutorial -->
## uni.getDeviceInfo(config?) @getdeviceinfo
<!-- UTSAPIJSON.getDeviceInfo.description -->
<!-- UTSAPIJSON.getDeviceInfo.param -->
<!-- UTSAPIJSON.getDeviceInfo.returnValue -->
<!-- UTSAPIJSON.getDeviceInfo.compatibility -->
<!-- UTSAPIJSON.getDeviceInfo.tutorial -->
## uni.getLocation(options) @getlocation
<!-- UTSAPIJSON.getLocation.description -->
<!-- UTSAPIJSON.getLocation.param -->
<!-- UTSAPIJSON.getLocation.returnValue -->
<!-- UTSAPIJSON.getLocation.compatibility -->
<!-- UTSAPIJSON.getLocation.tutorial -->
## uni.getLocation(options) @getlocation
<!-- UTSAPIJSON.getLocation.description -->
<!-- UTSAPIJSON.getLocation.param -->
<!-- UTSAPIJSON.getLocation.returnValue -->
<!-- UTSAPIJSON.getLocation.compatibility -->
<!-- UTSAPIJSON.getLocation.tutorial -->
## uni.getNetworkType(options) @getnetworktype
<!-- UTSAPIJSON.getNetworkType.description -->
<!-- UTSAPIJSON.getNetworkType.param -->
<!-- UTSAPIJSON.getNetworkType.returnValue -->
<!-- UTSAPIJSON.getNetworkType.compatibility -->
<!-- UTSAPIJSON.getNetworkType.tutorial -->
## uni.getRecorderManager() @getrecordermanager
<!-- UTSAPIJSON.getRecorderManager.description -->
<!-- UTSAPIJSON.getRecorderManager.param -->
<!-- UTSAPIJSON.getRecorderManager.returnValue -->
<!-- UTSAPIJSON.getRecorderManager.compatibility -->
<!-- UTSAPIJSON.getRecorderManager.tutorial -->
## uni.getSystemInfo(options) @getsysteminfo
<!-- UTSAPIJSON.getSystemInfo.description -->
<!-- UTSAPIJSON.getSystemInfo.param -->
<!-- UTSAPIJSON.getSystemInfo.returnValue -->
<!-- UTSAPIJSON.getSystemInfo.compatibility -->
<!-- UTSAPIJSON.getSystemInfo.tutorial -->
## uni.getSystemInfoSync() @getsysteminfosync
<!-- UTSAPIJSON.getSystemInfoSync.description -->
<!-- UTSAPIJSON.getSystemInfoSync.param -->
<!-- UTSAPIJSON.getSystemInfoSync.returnValue -->
<!-- UTSAPIJSON.getSystemInfoSync.compatibility -->
<!-- UTSAPIJSON.getSystemInfoSync.tutorial -->
## uni.getWindowInfo() @getwindowinfo
<!-- UTSAPIJSON.getWindowInfo.description -->
<!-- UTSAPIJSON.getWindowInfo.param -->
<!-- UTSAPIJSON.getWindowInfo.returnValue -->
<!-- UTSAPIJSON.getWindowInfo.compatibility -->
<!-- UTSAPIJSON.getWindowInfo.tutorial -->
## uni.getSystemSetting() @getsystemsetting
<!-- UTSAPIJSON.getSystemSetting.description -->
<!-- UTSAPIJSON.getSystemSetting.param -->
<!-- UTSAPIJSON.getSystemSetting.returnValue -->
<!-- UTSAPIJSON.getSystemSetting.compatibility -->
<!-- UTSAPIJSON.getSystemSetting.tutorial -->
## uni.chooseImage(options) @chooseimage
<!-- UTSAPIJSON.chooseImage.description -->
<!-- UTSAPIJSON.chooseImage.param -->
<!-- UTSAPIJSON.chooseImage.returnValue -->
<!-- UTSAPIJSON.chooseImage.compatibility -->
<!-- UTSAPIJSON.chooseImage.tutorial -->
## uni.previewImage(options) @previewimage
<!-- UTSAPIJSON.previewImage.description -->
<!-- UTSAPIJSON.previewImage.param -->
<!-- UTSAPIJSON.previewImage.returnValue -->
<!-- UTSAPIJSON.previewImage.compatibility -->
<!-- UTSAPIJSON.previewImage.tutorial -->
## uni.closePreviewImage(options) @closepreviewimage
<!-- UTSAPIJSON.closePreviewImage.description -->
<!-- UTSAPIJSON.closePreviewImage.param -->
<!-- UTSAPIJSON.closePreviewImage.returnValue -->
<!-- UTSAPIJSON.closePreviewImage.compatibility -->
<!-- UTSAPIJSON.closePreviewImage.tutorial -->
## uni.getImageInfo(options) @getimageinfo
<!-- UTSAPIJSON.getImageInfo.description -->
<!-- UTSAPIJSON.getImageInfo.param -->
<!-- UTSAPIJSON.getImageInfo.returnValue -->
<!-- UTSAPIJSON.getImageInfo.compatibility -->
<!-- UTSAPIJSON.getImageInfo.tutorial -->
## uni.saveImageToPhotosAlbum(options) @saveimagetophotosalbum
<!-- UTSAPIJSON.saveImageToPhotosAlbum.description -->
<!-- UTSAPIJSON.saveImageToPhotosAlbum.param -->
<!-- UTSAPIJSON.saveImageToPhotosAlbum.returnValue -->
<!-- UTSAPIJSON.saveImageToPhotosAlbum.compatibility -->
<!-- UTSAPIJSON.saveImageToPhotosAlbum.tutorial -->
## uni.compressImage(options) @compressimage
<!-- UTSAPIJSON.compressImage.description -->
<!-- UTSAPIJSON.compressImage.param -->
<!-- UTSAPIJSON.compressImage.returnValue -->
<!-- UTSAPIJSON.compressImage.compatibility -->
<!-- UTSAPIJSON.compressImage.tutorial -->
## uni.chooseVideo(options) @choosevideo
<!-- UTSAPIJSON.chooseVideo.description -->
<!-- UTSAPIJSON.chooseVideo.param -->
<!-- UTSAPIJSON.chooseVideo.returnValue -->
<!-- UTSAPIJSON.chooseVideo.compatibility -->
<!-- UTSAPIJSON.chooseVideo.tutorial -->
## uni.getVideoInfo(options) @getvideoinfo
<!-- UTSAPIJSON.getVideoInfo.description -->
<!-- UTSAPIJSON.getVideoInfo.param -->
<!-- UTSAPIJSON.getVideoInfo.returnValue -->
<!-- UTSAPIJSON.getVideoInfo.compatibility -->
<!-- UTSAPIJSON.getVideoInfo.tutorial -->
## uni.saveVideoToPhotosAlbum(options) @savevideotophotosalbum
<!-- UTSAPIJSON.saveVideoToPhotosAlbum.description -->
<!-- UTSAPIJSON.saveVideoToPhotosAlbum.param -->
<!-- UTSAPIJSON.saveVideoToPhotosAlbum.returnValue -->
<!-- UTSAPIJSON.saveVideoToPhotosAlbum.compatibility -->
<!-- UTSAPIJSON.saveVideoToPhotosAlbum.tutorial -->
## uni.compressVideo(options) @compressvideo
<!-- UTSAPIJSON.compressVideo.description -->
<!-- UTSAPIJSON.compressVideo.param -->
<!-- UTSAPIJSON.compressVideo.returnValue -->
<!-- UTSAPIJSON.compressVideo.compatibility -->
<!-- UTSAPIJSON.compressVideo.tutorial -->
## uni.uploadFile(options) @uploadfile
<!-- UTSAPIJSON.uploadFile.description -->
<!-- UTSAPIJSON.uploadFile.param -->
<!-- UTSAPIJSON.uploadFile.returnValue -->
<!-- UTSAPIJSON.uploadFile.compatibility -->
<!-- UTSAPIJSON.uploadFile.tutorial -->
## uni.downloadFile(options) @downloadfile
<!-- UTSAPIJSON.downloadFile.description -->
<!-- UTSAPIJSON.downloadFile.param -->
<!-- UTSAPIJSON.downloadFile.returnValue -->
<!-- UTSAPIJSON.downloadFile.compatibility -->
<!-- UTSAPIJSON.downloadFile.tutorial -->
## uni.openAppAuthorizeSetting(options) @openappauthorizesetting
<!-- UTSAPIJSON.openAppAuthorizeSetting.description -->
<!-- UTSAPIJSON.openAppAuthorizeSetting.param -->
<!-- UTSAPIJSON.openAppAuthorizeSetting.returnValue -->
<!-- UTSAPIJSON.openAppAuthorizeSetting.compatibility -->
<!-- UTSAPIJSON.openAppAuthorizeSetting.tutorial -->
## uni.showToast(options) @showtoast
<!-- UTSAPIJSON.showToast.description -->
<!-- UTSAPIJSON.showToast.param -->
<!-- UTSAPIJSON.showToast.returnValue -->
<!-- UTSAPIJSON.showToast.compatibility -->
<!-- UTSAPIJSON.showToast.tutorial -->
## uni.hideToast() @hidetoast
<!-- UTSAPIJSON.hideToast.description -->
<!-- UTSAPIJSON.hideToast.param -->
<!-- UTSAPIJSON.hideToast.returnValue -->
<!-- UTSAPIJSON.hideToast.compatibility -->
<!-- UTSAPIJSON.hideToast.tutorial -->
## uni.showLoading(options) @showloading
<!-- UTSAPIJSON.showLoading.description -->
<!-- UTSAPIJSON.showLoading.param -->
<!-- UTSAPIJSON.showLoading.returnValue -->
<!-- UTSAPIJSON.showLoading.compatibility -->
<!-- UTSAPIJSON.showLoading.tutorial -->
## uni.hideLoading() @hideloading
<!-- UTSAPIJSON.hideLoading.description -->
<!-- UTSAPIJSON.hideLoading.param -->
<!-- UTSAPIJSON.hideLoading.returnValue -->
<!-- UTSAPIJSON.hideLoading.compatibility -->
<!-- UTSAPIJSON.hideLoading.tutorial -->
## uni.showModal(options) @showmodal
<!-- UTSAPIJSON.showModal.description -->
<!-- UTSAPIJSON.showModal.param -->
<!-- UTSAPIJSON.showModal.returnValue -->
<!-- UTSAPIJSON.showModal.compatibility -->
<!-- UTSAPIJSON.showModal.tutorial -->
## uni.showActionSheet(options) @showactionsheet
<!-- UTSAPIJSON.showActionSheet.description -->
<!-- UTSAPIJSON.showActionSheet.param -->
<!-- UTSAPIJSON.showActionSheet.returnValue -->
<!-- UTSAPIJSON.showActionSheet.compatibility -->
<!-- UTSAPIJSON.showActionSheet.tutorial -->
## uni.setStorage(options) @setstorage
<!-- UTSAPIJSON.setStorage.description -->
<!-- UTSAPIJSON.setStorage.param -->
<!-- UTSAPIJSON.setStorage.returnValue -->
<!-- UTSAPIJSON.setStorage.compatibility -->
<!-- UTSAPIJSON.setStorage.tutorial -->
## uni.setStorageSync(key, data) @setstoragesync
<!-- UTSAPIJSON.setStorageSync.description -->
<!-- UTSAPIJSON.setStorageSync.param -->
<!-- UTSAPIJSON.setStorageSync.returnValue -->
<!-- UTSAPIJSON.setStorageSync.compatibility -->
<!-- UTSAPIJSON.setStorageSync.tutorial -->
## uni.getStorage(options) @getstorage
<!-- UTSAPIJSON.getStorage.description -->
<!-- UTSAPIJSON.getStorage.param -->
<!-- UTSAPIJSON.getStorage.returnValue -->
<!-- UTSAPIJSON.getStorage.compatibility -->
<!-- UTSAPIJSON.getStorage.tutorial -->
## uni.getStorageSync(key) @getstoragesync
<!-- UTSAPIJSON.getStorageSync.description -->
<!-- UTSAPIJSON.getStorageSync.param -->
<!-- UTSAPIJSON.getStorageSync.returnValue -->
<!-- UTSAPIJSON.getStorageSync.compatibility -->
<!-- UTSAPIJSON.getStorageSync.tutorial -->
## uni.getStorageInfo(options) @getstorageinfo
<!-- UTSAPIJSON.getStorageInfo.description -->
<!-- UTSAPIJSON.getStorageInfo.param -->
<!-- UTSAPIJSON.getStorageInfo.returnValue -->
<!-- UTSAPIJSON.getStorageInfo.compatibility -->
<!-- UTSAPIJSON.getStorageInfo.tutorial -->
## uni.getStorageInfoSync() @getstorageinfosync
<!-- UTSAPIJSON.getStorageInfoSync.description -->
<!-- UTSAPIJSON.getStorageInfoSync.param -->
<!-- UTSAPIJSON.getStorageInfoSync.returnValue -->
<!-- UTSAPIJSON.getStorageInfoSync.compatibility -->
<!-- UTSAPIJSON.getStorageInfoSync.tutorial -->
## uni.removeStorage(options) @removestorage
<!-- UTSAPIJSON.removeStorage.description -->
<!-- UTSAPIJSON.removeStorage.param -->
<!-- UTSAPIJSON.removeStorage.returnValue -->
<!-- UTSAPIJSON.removeStorage.compatibility -->
<!-- UTSAPIJSON.removeStorage.tutorial -->
## uni.removeStorageSync(key) @removestoragesync
<!-- UTSAPIJSON.removeStorageSync.description -->
<!-- UTSAPIJSON.removeStorageSync.param -->
<!-- UTSAPIJSON.removeStorageSync.returnValue -->
<!-- UTSAPIJSON.removeStorageSync.compatibility -->
<!-- UTSAPIJSON.removeStorageSync.tutorial -->
## uni.clearStorage(option?) @clearstorage
<!-- UTSAPIJSON.clearStorage.description -->
<!-- UTSAPIJSON.clearStorage.param -->
<!-- UTSAPIJSON.clearStorage.returnValue -->
<!-- UTSAPIJSON.clearStorage.compatibility -->
<!-- UTSAPIJSON.clearStorage.tutorial -->
## uni.clearStorageSync() @clearstoragesync
<!-- UTSAPIJSON.clearStorageSync.description -->
<!-- UTSAPIJSON.clearStorageSync.param -->
<!-- UTSAPIJSON.clearStorageSync.returnValue -->
<!-- UTSAPIJSON.clearStorageSync.compatibility -->
<!-- UTSAPIJSON.clearStorageSync.tutorial -->
## uni.connectSocket(options) @connectsocket
<!-- UTSAPIJSON.connectSocket.description -->
<!-- UTSAPIJSON.connectSocket.param -->
<!-- UTSAPIJSON.connectSocket.returnValue -->
<!-- UTSAPIJSON.connectSocket.compatibility -->
<!-- UTSAPIJSON.connectSocket.tutorial -->
## uni.onSocketOpen(options) @onsocketopen
<!-- UTSAPIJSON.onSocketOpen.description -->
<!-- UTSAPIJSON.onSocketOpen.param -->
<!-- UTSAPIJSON.onSocketOpen.returnValue -->
<!-- UTSAPIJSON.onSocketOpen.compatibility -->
<!-- UTSAPIJSON.onSocketOpen.tutorial -->
## uni.onSocketError(callback) @onsocketerror
<!-- UTSAPIJSON.onSocketError.description -->
<!-- UTSAPIJSON.onSocketError.param -->
<!-- UTSAPIJSON.onSocketError.returnValue -->
<!-- UTSAPIJSON.onSocketError.compatibility -->
<!-- UTSAPIJSON.onSocketError.tutorial -->
## uni.sendSocketMessage(options) @sendsocketmessage
<!-- UTSAPIJSON.sendSocketMessage.description -->
<!-- UTSAPIJSON.sendSocketMessage.param -->
<!-- UTSAPIJSON.sendSocketMessage.returnValue -->
<!-- UTSAPIJSON.sendSocketMessage.compatibility -->
<!-- UTSAPIJSON.sendSocketMessage.tutorial -->
## uni.onSocketMessage(callback) @onsocketmessage
<!-- UTSAPIJSON.onSocketMessage.description -->
<!-- UTSAPIJSON.onSocketMessage.param -->
<!-- UTSAPIJSON.onSocketMessage.returnValue -->
<!-- UTSAPIJSON.onSocketMessage.compatibility -->
<!-- UTSAPIJSON.onSocketMessage.tutorial -->
## uni.closeSocket(options) @closesocket
<!-- UTSAPIJSON.closeSocket.description -->
<!-- UTSAPIJSON.closeSocket.param -->
<!-- UTSAPIJSON.closeSocket.returnValue -->
<!-- UTSAPIJSON.closeSocket.compatibility -->
<!-- UTSAPIJSON.closeSocket.tutorial -->
## uni.onSocketClose(callback) @onsocketclose
<!-- UTSAPIJSON.onSocketClose.description -->
<!-- UTSAPIJSON.onSocketClose.param -->
<!-- UTSAPIJSON.onSocketClose.returnValue -->
<!-- UTSAPIJSON.onSocketClose.compatibility -->
<!-- UTSAPIJSON.onSocketClose.tutorial -->
<!-- UTSAPIJSON.general_type.name -->
<!-- UTSAPIJSON.general_type.param -->
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册