\n"+r+""+s+">\n"}listitem(e){let t="";if(e.task){let n=this.checkbox({checked:!!e.checked});e.loose?"paragraph"===e.tokens[0]?.type?(e.tokens[0].text=n+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&"text"===e.tokens[0].tokens[0].type&&(e.tokens[0].tokens[0].text=n+" "+w(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:"text",raw:n+" ",text:n+" ",escaped:!0}):t+=n+" "}return t+=this.parser.parse(e.tokens,!!e.loose),`${t} \n`}checkbox({checked:e}){return" '}paragraph({tokens:e}){return`${this.parser.parseInline(e)}
\n`}table(e){let t="",n="";for(let t=0;t${r}`),"\n"}tablerow({text:e}){return`\n${e} \n`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`${n}>\n`}strong({tokens:e}){return`${this.parser.parseInline(e)} `}em({tokens:e}){return`${this.parser.parseInline(e)} `}codespan({text:e}){return`${w(e,!0)}`}br(e){return" "}del({tokens:e}){return`${this.parser.parseInline(e)}`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),s=J(e);if(null===s)return r;let l='"+r+" ",l}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let s=J(e);if(null===s)return w(n);let l=` ",l}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:w(e.text)}},$=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}},b=class e{options;renderer;textRenderer;constructor(e){this.options=e||T,this.options.renderer=this.options.renderer||new P,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new $}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e,t=!0){let n="";for(let r=0;r{let s=e[r].flat(1/0);n=n.concat(this.walkTokens(s,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw new Error("extension name required");if("renderer"in e){let n=t.renderers[e.name];t.renderers[e.name]=n?function(...t){let r=e.renderer.apply(this,t);return!1===r&&(r=n.apply(this,t)),r}:e.renderer}if("tokenizer"in e){if(!e.level||"block"!==e.level&&"inline"!==e.level)throw new Error("extension level must be 'block' or 'inline'");let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&("block"===e.level?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:"inline"===e.level&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}"childTokens"in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new P(this.defaults);for(let n in e.renderer){if(!(n in t))throw new Error(`renderer '${n}' does not exist`);if(["options","parser"].includes(n))continue;let r=n,s=e.renderer[r],l=t[r];t[r]=(...e)=>{let n=s.apply(t,e);return!1===n&&(n=l.apply(t,e)),n||""}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new y(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw new Error(`tokenizer '${n}' does not exist`);if(["options","rules","lexer"].includes(n))continue;let r=n,s=e.tokenizer[r],l=t[r];t[r]=(...e)=>{let n=s.apply(t,e);return!1===n&&(n=l.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new S;for(let n in e.hooks){if(!(n in t))throw new Error(`hook '${n}' does not exist`);if(["options","block"].includes(n))continue;let r=n,s=e.hooks[r],l=t[r];S.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async&&S.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await s.call(t,e);return l.call(t,n)})();let r=s.call(t,e);return l.call(t,r)}:t[r]=(...e)=>{if(this.defaults.async)return(async()=>{let n=await s.apply(t,e);return!1===n&&(n=await l.apply(t,e)),n})();let n=s.apply(t,e);return!1===n&&(n=l.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return x.lex(e,t??this.defaults)}parser(e,t){return b.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},s={...this.defaults,...r},l=this.onError(!!s.silent,!!s.async);if(!0===this.defaults.async&&!1===r.async)return l(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||null===t)return l(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof t)return l(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(s.hooks&&(s.hooks.options=s,s.hooks.block=e),s.async)return(async()=>{let n=s.hooks?await s.hooks.preprocess(t):t,r=await(s.hooks?await s.hooks.provideLexer():e?x.lex:x.lexInline)(n,s),l=s.hooks?await s.hooks.processAllTokens(r):r;s.walkTokens&&await Promise.all(this.walkTokens(l,s.walkTokens));let i=await(s.hooks?await s.hooks.provideParser():e?b.parse:b.parseInline)(l,s);return s.hooks?await s.hooks.postprocess(i):i})().catch(l);try{s.hooks&&(t=s.hooks.preprocess(t));let n=(s.hooks?s.hooks.provideLexer():e?x.lex:x.lexInline)(t,s);s.hooks&&(n=s.hooks.processAllTokens(n)),s.walkTokens&&this.walkTokens(n,s.walkTokens);let r=(s.hooks?s.hooks.provideParser():e?b.parse:b.parseInline)(n,s);return s.hooks&&(r=s.hooks.postprocess(r)),r}catch(e){return l(e)}}}onError(e,t){return n=>{if(n.message+="\nPlease report this to https://github.com/markedjs/marked.",e){let e="An error occurred:
"+w(n.message+"",!0)+" ";return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}},_=new B;function k(e,t){return _.parse(e,t)}k.options=k.setOptions=function(e){return _.setOptions(e),k.defaults=_.defaults,G(k.defaults),k},k.getDefaults=L,k.defaults=T,k.use=function(...e){return _.use(...e),k.defaults=_.defaults,G(k.defaults),k},k.walkTokens=function(e,t){return _.walkTokens(e,t)},k.parseInline=_.parseInline,k.Parser=b,k.parser=b.parse,k.Renderer=P,k.TextRenderer=$,k.Lexer=x,k.lexer=x.lex,k.Tokenizer=y,k.Hooks=S,k.parse=k;var Zt=k.options,Gt=k.setOptions,Nt=k.use,Ft=k.walkTokens,jt=k.parseInline,Qt=k,Ut=b.parse,Kt=x.lex;export{S as Hooks,x as Lexer,B as Marked,b as Parser,P as Renderer,$ as TextRenderer,y as Tokenizer,T as defaults,L as getDefaults,Kt as lexer,k as marked,Zt as options,Qt as parse,jt as parseInline,Ut as parser,Gt as setOptions,Nt as use,Ft as walkTokens};
\ No newline at end of file
diff --git a/miniprogram/miniprogram_npm/tdesign-miniprogram/navbar/navbar.js b/miniprogram/miniprogram_npm/tdesign-miniprogram/navbar/navbar.js
index bf3b0a9..2fc3689 100644
--- a/miniprogram/miniprogram_npm/tdesign-miniprogram/navbar/navbar.js
+++ b/miniprogram/miniprogram_npm/tdesign-miniprogram/navbar/navbar.js
@@ -1 +1 @@
-import{__decorate}from"tslib";import{SuperComponent,wxComponent}from"../common/src/index";import{getRect,systemInfo}from"../common/utils";import config from"../common/config";import props from"./props";const{prefix:prefix}=config,name=`${prefix}-navbar`;let Navbar=class extends SuperComponent{constructor(){super(...arguments),this.externalClasses=[`${prefix}-class`,`${prefix}-class-placeholder`,`${prefix}-class-content`,`${prefix}-class-title`,`${prefix}-class-left`,`${prefix}-class-center`,`${prefix}-class-left-icon`,`${prefix}-class-home-icon`,`${prefix}-class-capsule`,`${prefix}-class-nav-btn`],this.timer=null,this.options={multipleSlots:!0},this.properties=props,this.observers={visible(t){const{animation:e}=this.properties,i=`${name}${t?"--visible":"--hide"}`;this.setData({visibleClass:`${i}${e?"-animation":""}`}),this.timer&&clearTimeout(this.timer),e&&(this.timer=setTimeout(()=>{this.setData({visibleClass:i})},300))},"title,titleMaxLength"(){const{title:t}=this.properties,e=this.properties.titleMaxLength||Number.MAX_SAFE_INTEGER;let i=t.slice(0,e);e`${t}: ${e}`).join("; ");this.setData({boxStyle:a,_boxStyle:s})},getLeftRect(){getRect(this,`.${name}__left`).then(t=>{t.right>this.data._leftRect.right&&this.calcCenterStyle(t,this.data._menuRect,this.data._boxStyle)})},getMenuRect(){if(wx.getMenuButtonBoundingClientRect){const t=wx.getMenuButtonBoundingClientRect();this.setData({_menuRect:t,_leftRect:{right:systemInfo.windowWidth-t.left}})}},onMenuButtonBoundingClientRectWeightChange(){wx.onMenuButtonBoundingClientRectWeightChange&&(this.onMenuButtonBoundingClientRectWeightChangeCallback=t=>this.queryElements(t),wx.onMenuButtonBoundingClientRectWeightChange(this.onMenuButtonBoundingClientRectWeightChangeCallback))},offMenuButtonBoundingClientRectWeightChange(){this.onMenuButtonBoundingClientRectWeightChangeCallback&&wx.offMenuButtonBoundingClientRectWeightChange(this.onMenuButtonBoundingClientRectWeightChangeCallback)},queryElements(t){Promise.all([getRect(this,`.${this.data.classPrefix}__left`),getRect(this,`.${this.data.classPrefix}__center`)]).then(([e,i])=>{const n=Math.round(e.right),s=Math.round(i.right),a=t.left;this.setData({hideLeft:n>a,hideCenter:n>a||s>a})})},goBack(){const{delta:t}=this.data,e=this;this.triggerEvent("go-back"),t>0&&wx.navigateBack({delta:t,fail(t){e.triggerEvent("fail",t)},complete(t){e.triggerEvent("complete",t)},success(t){e.triggerEvent("success",t)}})}}}attached(){this.initStyle(),this.getLeftRect(),this.onMenuButtonBoundingClientRectWeightChange()}detached(){this.offMenuButtonBoundingClientRectWeightChange()}};Navbar=__decorate([wxComponent()],Navbar);export default Navbar;
\ No newline at end of file
+import{__decorate}from"tslib";import{SuperComponent,wxComponent}from"../common/src/index";import{getRect,systemInfo}from"../common/utils";import config from"../common/config";import props from"./props";const{prefix:prefix}=config,name=`${prefix}-navbar`;let Navbar=class extends SuperComponent{constructor(){super(...arguments),this.externalClasses=[`${prefix}-class`,`${prefix}-class-placeholder`,`${prefix}-class-content`,`${prefix}-class-title`,`${prefix}-class-left`,`${prefix}-class-center`,`${prefix}-class-left-icon`,`${prefix}-class-home-icon`,`${prefix}-class-capsule`,`${prefix}-class-nav-btn`],this.timer=null,this.options={multipleSlots:!0},this.properties=props,this.observers={visible(t){const{animation:e}=this.properties,i=`${name}${t?"--visible":"--hide"}`;this.setData({visibleClass:`${i}${e?"-animation":""}`}),this.timer&&clearTimeout(this.timer),e&&(this.timer=setTimeout(()=>{this.setData({visibleClass:i})},300))},"title,titleMaxLength"(){const{title:t}=this.properties,e=this.properties.titleMaxLength||Number.MAX_SAFE_INTEGER;let i=t.slice(0,e);e`${t}: ${e}`).join("; ");this.setData({boxStyle:a,_boxStyle:s})},getLeftRect(){getRect(this,`.${name}__left`).then(t=>{t.right>this.data._leftRect.right&&this.calcCenterStyle(t,this.data._menuRect,this.data._boxStyle)})},getMenuRect(){if(wx.getMenuButtonBoundingClientRect){const t=wx.getMenuButtonBoundingClientRect();this.setData({_menuRect:t,_leftRect:{right:systemInfo.windowWidth-t.left}})}},onMenuButtonBoundingClientRectWeightChange(){wx.onMenuButtonBoundingClientRectWeightChange&&(this.onMenuButtonBoundingClientRectWeightChangeCallback=t=>this.queryElements(t),wx.onMenuButtonBoundingClientRectWeightChange(this.onMenuButtonBoundingClientRectWeightChangeCallback))},offMenuButtonBoundingClientRectWeightChange(){this.onMenuButtonBoundingClientRectWeightChangeCallback&&wx.offMenuButtonBoundingClientRectWeightChange(this.onMenuButtonBoundingClientRectWeightChangeCallback)},queryElements(t){Promise.all([getRect(this,`.${this.data.classPrefix}__left`),getRect(this,`.${this.data.classPrefix}__center`)]).then(([e,i])=>{const n=Math.round(e.right),s=Math.round(i.right),a=t.left;this.setData({hideLeft:n>a,hideCenter:n>a||s>a})})},goBack(){const{delta:t}=this.data,e=this;this.triggerEvent("go-back"),t>0&&wx.navigateBack({delta:t,fail(t){e.triggerEvent("fail",t)},complete(t){e.triggerEvent("complete",t)},success(t){e.triggerEvent("success",t)}})}}}attached(){this.initStyle(),this.getLeftRect(),this.onMenuButtonBoundingClientRectWeightChange()}detached(){this.offMenuButtonBoundingClientRectWeightChange()}};Navbar=__decorate([wxComponent()],Navbar);export default Navbar;
\ No newline at end of file
diff --git a/miniprogram/miniprogram_npm/tdesign-miniprogram/navbar/navbar.wxml b/miniprogram/miniprogram_npm/tdesign-miniprogram/navbar/navbar.wxml
index ddb1cb1..c3ef8e8 100644
--- a/miniprogram/miniprogram_npm/tdesign-miniprogram/navbar/navbar.wxml
+++ b/miniprogram/miniprogram_npm/tdesign-miniprogram/navbar/navbar.wxml
@@ -1 +1 @@
-{{showTitle}}
\ No newline at end of file
+{{showTitle}}
\ No newline at end of file
diff --git a/miniprogram/miniprogram_npm/tdesign-miniprogram/navbar/navbar.wxss b/miniprogram/miniprogram_npm/tdesign-miniprogram/navbar/navbar.wxss
index 7282913..ba5ce62 100644
--- a/miniprogram/miniprogram_npm/tdesign-miniprogram/navbar/navbar.wxss
+++ b/miniprogram/miniprogram_npm/tdesign-miniprogram/navbar/navbar.wxss
@@ -1,17 +1,18 @@
-@import '../common/style/index.wxss';.t-navbar--fixed .t-navbar__content{position:fixed;top:0;left:0;z-index:5001;}
+@import '../common/style/index.wxss';.t-navbar{position:relative;}
+.t-navbar--fixed .t-navbar__content{position:fixed;top:0;left:0;}
.t-navbar--visible{display:'';}
.t-navbar--visible-animation{opacity:1;transition:opacity .3s cubic-bezier(.645,.045,.355,1);}
.t-navbar--hide-animation{opacity:0;transition:opacity .3s cubic-bezier(.645,.045,.355,1);}
.t-navbar--hide{display:none;}
.t-navbar__placeholder{height:var(--td-navbar-height,48px);padding-top:var(--td-navbar-padding-top,20px);position:relative;visibility:hidden;box-sizing:content-box;}
-.t-navbar__content{position:relative;z-index:1;height:var(--td-navbar-height,48px);width:calc(100% - var(--td-navbar-right,95px));padding-right:var(--td-navbar-right,95px);padding-top:var(--td-navbar-padding-top,20px);color:var(--td-navbar-color,var(--td-text-color-primary,var(--td-font-gray-1,rgba(0,0,0,.9))));background:var(--td-navbar-background,var(--td-navbar-bg-color,var(--td-bg-color-container,var(--td-font-white-1,#fff))));display:flex;align-items:center;box-sizing:content-box;}
+.t-navbar__content{position:relative;height:var(--td-navbar-height,48px);width:calc(100% - var(--td-navbar-right,95px));padding-right:var(--td-navbar-right,95px);padding-top:var(--td-navbar-padding-top,20px);color:var(--td-navbar-color,var(--td-text-color-primary,var(--td-font-gray-1,rgba(0,0,0,.9))));background:var(--td-navbar-background,var(--td-navbar-bg-color,var(--td-bg-color-container,var(--td-font-white-1,#fff))));display:flex;align-items:center;box-sizing:content-box;}
.t-navbar__left{position:relative;box-sizing:border-box;max-width:var(--td-navbar-left-max-width);overflow:hidden;display:flex;align-items:center;margin-left:var(--td-spacer-1,24rpx);transition:opacity .3s cubic-bezier(.645,.045,.355,1);}
.t-navbar__left-arrow{font-size:var(--td-navbar-left-arrow-size,24px);}
.t-navbar__left--hide{opacity:0;}
.t-navbar__capsule{box-sizing:border-box;width:var(--td-navbar-capsule-width,88px);height:var(--td-navbar-capsule-height,32px);display:flex;align-items:center;}
-.t-navbar__capsule::before{content:'';position:absolute;z-index:-1;top:0;left:0;width:200%;height:200%;transform:scale(.5);transform-origin:0 0;box-sizing:border-box;border-radius:calc(var(--td-navbar-capsule-border-radius,16px) * 2);border:2rpx solid var(--td-navbar-capsule-border-color,var(--td-border-level-1-color,var(--td-gray-color-3,#e7e7e7)));}
+.t-navbar__capsule::before{content:'';position:absolute;top:0;left:0;width:200%;height:200%;transform:scale(.5);transform-origin:0 0;box-sizing:border-box;border-radius:calc(var(--td-navbar-capsule-border-radius,16px) * 2);border:2rpx solid var(--td-navbar-capsule-border-color,var(--td-border-level-1-color,var(--td-gray-color-3,#e7e7e7)));}
.t-navbar__capsule:empty{display:none;}
-.t-navbar__center{font-size:18px;text-align:center;position:absolute;bottom:0;left:var(--td-navbar-center-left,var(--td-navbar-right,95px));width:var(--td-navbar-center-width,187px);height:var(--td-navbar-height,48px);line-height:var(--td-navbar-height,48px);flex:1;display:flex;align-items:center;justify-content:center;overflow:hidden;transition:opacity .3s cubic-bezier(.645,.045,.355,1);}
+.t-navbar__center{text-align:center;position:absolute;bottom:0;left:var(--td-navbar-center-left,var(--td-navbar-right,95px));width:var(--td-navbar-center-width,187px);height:var(--td-navbar-height,48px);flex:1;display:flex;align-items:center;justify-content:center;overflow:hidden;transition:opacity .3s cubic-bezier(.645,.045,.355,1);}
.t-navbar__center:empty{display:none;}
-.t-navbar__center-title{font-size:var(--td-navbar-title-font-size,18px);text-overflow:ellipsis;white-space:nowrap;overflow:hidden;font-weight:var(--td-navbar-title-font-weight,600);}
+.t-navbar__center-title{font:var(--td-navbar-title-font,var(--td-font-title-large,600 36rpx / 52rpx var(--td-font-family,PingFang SC,Microsoft YaHei,Arial Regular)));text-overflow:ellipsis;white-space:nowrap;overflow:hidden;}
.t-navbar__center--hide{opacity:0;}
\ No newline at end of file
diff --git a/miniprogram/miniprogram_npm/tdesign-miniprogram/navbar/props.js b/miniprogram/miniprogram_npm/tdesign-miniprogram/navbar/props.js
index ed824a0..dd5e8d3 100644
--- a/miniprogram/miniprogram_npm/tdesign-miniprogram/navbar/props.js
+++ b/miniprogram/miniprogram_npm/tdesign-miniprogram/navbar/props.js
@@ -1 +1 @@
-const props={animation:{type:Boolean,value:!0},delta:{type:Number,value:1},fixed:{type:Boolean,value:!0},leftArrow:{type:Boolean,value:!1},safeAreaInsetTop:{type:Boolean,value:!0},title:{type:String},titleMaxLength:{type:Number},visible:{type:Boolean,value:!0}};export default props;
\ No newline at end of file
+const props={animation:{type:Boolean,value:!0},delta:{type:Number,value:1},fixed:{type:Boolean,value:!0},leftArrow:{type:Boolean,value:!1},placeholder:{type:Boolean,value:!1},safeAreaInsetTop:{type:Boolean,value:!0},title:{type:String},titleMaxLength:{type:Number},visible:{type:Boolean,value:!0},zIndex:{type:Number,value:1}};export default props;
\ No newline at end of file
diff --git a/miniprogram/miniprogram_npm/tdesign-miniprogram/navbar/type.d.ts b/miniprogram/miniprogram_npm/tdesign-miniprogram/navbar/type.d.ts
index f0c9ab3..f260160 100644
--- a/miniprogram/miniprogram_npm/tdesign-miniprogram/navbar/type.d.ts
+++ b/miniprogram/miniprogram_npm/tdesign-miniprogram/navbar/type.d.ts
@@ -15,6 +15,10 @@ export interface TdNavbarProps {
type: BooleanConstructor;
value?: boolean;
};
+ placeholder?: {
+ type: BooleanConstructor;
+ value?: boolean;
+ };
safeAreaInsetTop?: {
type: BooleanConstructor;
value?: boolean;
@@ -31,4 +35,8 @@ export interface TdNavbarProps {
type: BooleanConstructor;
value?: boolean;
};
+ zIndex?: {
+ type: NumberConstructor;
+ value?: number;
+ };
}
diff --git a/miniprogram/miniprogram_npm/tdesign-miniprogram/notice-bar/notice-bar.wxss b/miniprogram/miniprogram_npm/tdesign-miniprogram/notice-bar/notice-bar.wxss
index d5f44c1..0110065 100644
--- a/miniprogram/miniprogram_npm/tdesign-miniprogram/notice-bar/notice-bar.wxss
+++ b/miniprogram/miniprogram_npm/tdesign-miniprogram/notice-bar/notice-bar.wxss
@@ -1,5 +1,5 @@
-@import '../common/style/index.wxss';.t-notice-bar{display:flex;align-items:flex-start;padding:26rpx 32rpx;font-size:var(--td-font-size-base,28rpx);}
-.t-notice-bar__content-wrap{flex:1;overflow-x:hidden;line-height:44rpx;color:var(--td-notice-bar-font-color,var(--td-text-color-primary,var(--td-font-gray-1,rgba(0,0,0,.9))));}
+@import '../common/style/index.wxss';.t-notice-bar{display:flex;align-items:flex-start;padding:26rpx 32rpx;}
+.t-notice-bar__content-wrap{flex:1;overflow-x:hidden;font:var(--td-font-body-medium,28rpx / 44rpx var(--td-font-family,PingFang SC,Microsoft YaHei,Arial Regular));color:var(--td-notice-bar-font-color,var(--td-text-color-primary,var(--td-font-gray-1,rgba(0,0,0,.9))));}
.t-notice-bar__content{display:inline-block;white-space:nowrap;}
.t-notice-bar__content-wrapable{white-space:normal;}
.t-notice-bar__content--vertical{display:block;height:44rpx;line-height:44rpx;}
diff --git a/miniprogram/miniprogram_npm/tdesign-miniprogram/picker-item/picker-item.d.ts b/miniprogram/miniprogram_npm/tdesign-miniprogram/picker-item/picker-item.d.ts
index 893ac12..97821d9 100644
--- a/miniprogram/miniprogram_npm/tdesign-miniprogram/picker-item/picker-item.d.ts
+++ b/miniprogram/miniprogram_npm/tdesign-miniprogram/picker-item/picker-item.d.ts
@@ -4,9 +4,22 @@ export default class PickerItem extends SuperComponent {
relations: RelationsOptions;
options: ComponentsOptionsType;
externalClasses: string[];
- properties: import("./type").TdPickerItemProps;
+ properties: {
+ useSlots: {
+ type: BooleanConstructor;
+ value: boolean;
+ };
+ format?: {
+ type: undefined;
+ value?: (option: PickerItemOption, columnIndex: number) => PickerItemOption;
+ };
+ options?: {
+ type: ArrayConstructor;
+ value?: PickerItemOption[];
+ };
+ };
observers: {
- 'options, pickerKeys'(): void;
+ 'options, keys'(): void;
};
data: {
prefix: string;
@@ -16,11 +29,7 @@ export default class PickerItem extends SuperComponent {
value: string;
curIndex: number;
columnIndex: number;
- pickerKeys: {
- value: string;
- label: string;
- icon: string;
- };
+ keys: {};
formatOptions: PickerItemOption[];
enableVirtualScroll: boolean;
visibleOptions: any[];
diff --git a/miniprogram/miniprogram_npm/tdesign-miniprogram/picker-item/picker-item.js b/miniprogram/miniprogram_npm/tdesign-miniprogram/picker-item/picker-item.js
index 59718f6..9254a27 100644
--- a/miniprogram/miniprogram_npm/tdesign-miniprogram/picker-item/picker-item.js
+++ b/miniprogram/miniprogram_npm/tdesign-miniprogram/picker-item/picker-item.js
@@ -1 +1 @@
-import{__decorate}from"tslib";import{SuperComponent,wxComponent}from"../common/src/index";import config from"../common/config";import props from"./props";const{prefix:prefix}=config,name=`${prefix}-picker-item`,ANIMATION_DURATION=1e3,INERTIA_TIME=300,INERTIA_DISTANCE=15,VIRTUAL_SCROLL_CONFIG={ENABLE_THRESHOLD:100,BUFFER_COUNT:8,THROTTLE_TIME:16,FAST_SCROLL_BUFFER:12,FAST_SCROLL_THRESHOLD:50},range=function(t,e,i){return Math.min(Math.max(t,e),i)},momentum=(t,e)=>{let i=t;return i=Math.abs(i/e)/.005*(i<0?-1:1),i};let PickerItem=class extends SuperComponent{constructor(){super(...arguments),this.relations={"../picker/picker":{type:"parent",linked(t){if("keys"in t.data){const{keys:e}=t.data;if(null===e||JSON.stringify(this.data.pickerKeys)===JSON.stringify(e))return;this.setData({pickerKeys:Object.assign(Object.assign({},this.data.pickerKeys),e)})}}}},this.options={multipleSlots:!0},this.externalClasses=[`${prefix}-class`],this.properties=props,this.observers={"options, pickerKeys"(){this.update()}},this.data={prefix:prefix,classPrefix:name,offset:0,duration:0,value:"",curIndex:0,columnIndex:0,pickerKeys:{value:"value",label:"label",icon:"icon"},formatOptions:props.options.value,enableVirtualScroll:!1,visibleOptions:[],virtualStartIndex:0,virtualOffsetY:0,totalHeight:0,itemHeight:40,visibleItemCount:5,wrapperPaddingY:72},this.lifetimes={created(){this.StartY=0,this.StartOffset=0,this.startTime=0,this._moveTimer=null,this._animationTimer=null,this._lastOffset=0,this._lastMoveTime=0,this._scrollDirection=0},detached(){this._moveTimer&&(clearTimeout(this._moveTimer),this._moveTimer=null),this._animationTimer&&(clearInterval(this._animationTimer),this._animationTimer=null)}},this.methods={onClickItem(t){const{index:e}=t.currentTarget.dataset,{itemHeight:i}=this.data,a=range(e,0,this.getCount()-1);a!==this._selectedIndex&&this.setData({offset:-a*i,curIndex:a,duration:200}),this.updateSelected(a,!0)},onTouchStart(t){this.StartY=t.touches[0].clientY,this.StartOffset=this.data.offset,this.startTime=Date.now(),this.setData({duration:0})},onTouchMove(t){const{StartY:e,StartOffset:i}=this,{itemHeight:a,enableVirtualScroll:s}=this.data,n=Date.now(),o=t.touches[0].clientY-e,r=range(i+o,-this.getCount()*a,0),l=r-this._lastOffset,h=n-this._lastMoveTime||16,m=16*Math.abs(l/h);this._scrollDirection=l>0?1:l<0?-1:0;const d=m>VIRTUAL_SCROLL_CONFIG.FAST_SCROLL_THRESHOLD;this._moveTimer&&!d||(this._moveTimer&&(clearTimeout(this._moveTimer),this._moveTimer=null),this.setData({offset:r}),s&&this.updateVisibleOptions(r,d),this._moveTimer=setTimeout(()=>{this._moveTimer=null},VIRTUAL_SCROLL_CONFIG.THROTTLE_TIME)),this._lastOffset=r,this._lastMoveTime=n},onTouchEnd(t){this._moveTimer&&(clearTimeout(this._moveTimer),this._moveTimer=null);const{offset:e,itemHeight:i}=this.data,{startTime:a}=this;if(e===this.StartOffset)return;let s=0;const n=t.changedTouches[0].clientY-this.StartY,o=Date.now()-a;o<300&&Math.abs(n)>15&&(s=momentum(n,o));const r=range(e+s,-this.getCount()*i,0),l=range(Math.round(-r/i),0,this.getCount()-1),h=Math.abs(s)>3*i;if(this.data.enableVirtualScroll&&this.updateVisibleOptions(-l*i,h),this._animationTimer&&(clearInterval(this._animationTimer),this._animationTimer=null),this.data.enableVirtualScroll&&Math.abs(s)>0){const t=e,a=-l*i,s=Date.now();this._animationTimer=setInterval(()=>{const e=Date.now()-s,i=Math.min(e/1e3,1),n=1-Math.pow(1-i,3),o=t+(a-t)*n;this.updateVisibleOptions(o,h),i>=1&&(clearInterval(this._animationTimer),this._animationTimer=null)},16)}this.setData({offset:-l*i,duration:1e3,curIndex:l},()=>{this._animationTimer&&(clearInterval(this._animationTimer),this._animationTimer=null),this.data.enableVirtualScroll&&this.updateVisibleOptions(-l*i,!1)}),l!==this._selectedIndex&&this.updateSelected(l,!0)},formatOption:(t,e,i)=>"function"!=typeof i?t:t.map(t=>i(t,e)),updateSelected(t,e){var i,a,s;const{columnIndex:n,pickerKeys:o,formatOptions:r}=this.data;this._selectedIndex=t,this._selectedValue=null===(i=r[t])||void 0===i?void 0:i[null==o?void 0:o.value],this._selectedLabel=null===(a=r[t])||void 0===a?void 0:a[null==o?void 0:o.label],e&&(null===(s=this.$parent)||void 0===s||s.triggerColumnChange({index:t,column:n}))},update(){var t;const{options:e,value:i,pickerKeys:a,format:s,columnIndex:n,itemHeight:o,visibleItemCount:r}=this.data,l=this.formatOption(e,n,s),h=l.length,m=h>=VIRTUAL_SCROLL_CONFIG.ENABLE_THRESHOLD;let d=-1;if(h>500){d=null!==(t=new Map(l.map((t,e)=>[t[null==a?void 0:a.value],e])).get(i))&&void 0!==t?t:-1}else d=l.findIndex(t=>t[null==a?void 0:a.value]===i);const u=d>0?d:0,c={formatOptions:l,offset:-u*o,curIndex:u,enableVirtualScroll:m,totalHeight:h*o,wrapperPaddingY:(r-1)/2*o};if(m){const t=this.computeVirtualRange(-u*o,h,o);c.visibleOptions=l.slice(t.startIndex,t.endIndex),c.virtualStartIndex=t.startIndex,c.virtualOffsetY=t.startIndex*o}else c.visibleOptions=l,c.virtualStartIndex=0,c.virtualOffsetY=0;this.setData(c,()=>{this.updateSelected(u,!1)})},computeVirtualRange(t,e,i,a=!1){const s=Math.abs(t),{BUFFER_COUNT:n,FAST_SCROLL_BUFFER:o}=VIRTUAL_SCROLL_CONFIG,{visibleItemCount:r}=this.data,l=a?o:n,h=-1===this._scrollDirection?l+2:l,m=1===this._scrollDirection?l+2:l,d=Math.floor(s/i);return{startIndex:Math.max(0,d-h),endIndex:Math.min(e,d+r+m)}},updateVisibleOptions(t,e=!1){const{formatOptions:i,itemHeight:a,enableVirtualScroll:s}=this.data;if(!s)return;const n=void 0!==t?t:this.data.offset,o=this.computeVirtualRange(n,i.length,a,e);o.startIndex===this.data.virtualStartIndex&&o.endIndex===this.data.virtualStartIndex+this.data.visibleOptions.length||this.setData({visibleOptions:i.slice(o.startIndex,o.endIndex),virtualStartIndex:o.startIndex,virtualOffsetY:o.startIndex*a})},getCount(){var t,e;return null===(e=null===(t=this.data)||void 0===t?void 0:t.options)||void 0===e?void 0:e.length},getCurrentSelected(){var t,e;const{offset:i,itemHeight:a,formatOptions:s,pickerKeys:n}=this.data,o=Math.max(0,Math.min(Math.round(-i/a),this.getCount()-1));return{index:o,value:null===(t=s[o])||void 0===t?void 0:t[null==n?void 0:n.value],label:null===(e=s[o])||void 0===e?void 0:e[null==n?void 0:n.label]}}}}};PickerItem=__decorate([wxComponent()],PickerItem);export default PickerItem;
\ No newline at end of file
+import{__decorate}from"tslib";import{SuperComponent,wxComponent}from"../common/src/index";import config from"../common/config";import props from"./props";const{prefix:prefix}=config,name=`${prefix}-picker-item`,ANIMATION_DURATION_BASE=300,ANIMATION_DURATION_MAX=600,INERTIA_TIME=300,INERTIA_DISTANCE=15,VIRTUAL_SCROLL_CONFIG={ENABLE_THRESHOLD:100,BUFFER_COUNT:8,THROTTLE_TIME:16,FAST_SCROLL_BUFFER:12,FAST_SCROLL_THRESHOLD:50},range=function(t,e,i){return Math.min(Math.max(t,e),i)},momentum=(t,e)=>{let i=t;return i=Math.abs(i/e)/.005*(i<0?-1:1),i};let PickerItem=class extends SuperComponent{constructor(){super(...arguments),this.relations={"../picker/picker":{type:"parent"}},this.options={multipleSlots:!0},this.externalClasses=[`${prefix}-class`],this.properties=Object.assign(Object.assign({},props),{useSlots:{type:Boolean,value:!0}}),this.observers={"options, keys"(){this.update()}},this.data={prefix:prefix,classPrefix:name,offset:0,duration:0,value:"",curIndex:0,columnIndex:0,keys:{},formatOptions:props.options.value,enableVirtualScroll:!1,visibleOptions:[],virtualStartIndex:0,virtualOffsetY:0,totalHeight:0,itemHeight:40,visibleItemCount:5,wrapperPaddingY:72},this.lifetimes={created(){this.StartY=0,this.StartOffset=0,this.startTime=0,this._animationTimer=null},detached(){this._animationTimer&&(clearInterval(this._animationTimer),this._animationTimer=null)}},this.methods={onClickItem(t){const{index:e}=t.currentTarget.dataset,{itemHeight:i}=this.data,a=range(e,0,this.getCount()-1);a!==this._selectedIndex&&this.setData({offset:-a*i,curIndex:a,duration:200}),this.updateSelected(a,!0)},onTouchStart(t){this.StartY=t.touches[0].clientY,this.StartOffset=this.data.offset,this.startTime=Date.now(),this.setData({duration:0})},onTouchMove(t){const{StartY:e,StartOffset:i}=this,{itemHeight:a}=this.data,n=t.touches[0].clientY-e,s=range(i+n,-(this.getCount()-1)*a,0);this.setData({offset:s})},onTouchEnd(t){const{offset:e,itemHeight:i,enableVirtualScroll:a,formatOptions:n}=this.data,{startTime:s}=this;if(e===this.StartOffset)return;let o=0;const r=t.changedTouches[0].clientY-this.StartY,l=Date.now()-s;l<300&&Math.abs(r)>15&&(o=momentum(r,l));const d=range(e+o,-this.getCount()*i,0),h=range(Math.round(-d/i),0,this.getCount()-1),u=-h*i,m=Math.abs(u-e)/i,c=Math.min(600,300+30*m),p=Math.abs(o)>3*i?VIRTUAL_SCROLL_CONFIG.FAST_SCROLL_BUFFER:VIRTUAL_SCROLL_CONFIG.BUFFER_COUNT;this._animationTimer&&(clearInterval(this._animationTimer),this._animationTimer=null);const f={offset:u,duration:c,curIndex:h};if(a){const t=Math.floor(Math.abs(e)/i),a=h,s=Math.min(t,a),o=Math.max(t,a),r=Math.max(0,s-p),l=Math.min(n.length,o+this.data.visibleItemCount+p);f.visibleOptions=n.slice(r,l),f.virtualStartIndex=r,f.virtualOffsetY=r*i}this.setData(f,()=>{if(a){const t=this.computeVirtualRange(u,n.length,i,!1);this.setData({visibleOptions:n.slice(t.startIndex,t.endIndex),virtualStartIndex:t.startIndex,virtualOffsetY:t.startIndex*i})}}),h!==this._selectedIndex&&this.updateSelected(h,!0)},formatOption:(t,e,i)=>"function"!=typeof i?t:t.map(t=>i(t,e)),updateSelected(t,e){var i,a,n;const{columnIndex:s,keys:o,formatOptions:r}=this.data;this._selectedIndex=t,this._selectedValue=null===(i=r[t])||void 0===i?void 0:i[null==o?void 0:o.value],this._selectedLabel=null===(a=r[t])||void 0===a?void 0:a[null==o?void 0:o.label],e&&(null===(n=this.$parent)||void 0===n||n.triggerColumnChange({index:t,column:s}))},update(){var t;const{options:e,value:i,keys:a,format:n,columnIndex:s,itemHeight:o,visibleItemCount:r}=this.data,l=this.formatOption(e,s,n),d=l.length,h=d>=VIRTUAL_SCROLL_CONFIG.ENABLE_THRESHOLD;let u=-1;if(d>500){u=null!==(t=new Map(l.map((t,e)=>[t[null==a?void 0:a.value],e])).get(i))&&void 0!==t?t:-1}else u=l.findIndex(t=>t[null==a?void 0:a.value]===i);const m=u>0?u:0,c={formatOptions:l,offset:-m*o,curIndex:m,enableVirtualScroll:h,totalHeight:d*o,wrapperPaddingY:(r-1)/2*o};if(h){const t=this.computeVirtualRange(-m*o,d,o);c.visibleOptions=l.slice(t.startIndex,t.endIndex),c.virtualStartIndex=t.startIndex,c.virtualOffsetY=t.startIndex*o}else c.visibleOptions=l,c.virtualStartIndex=0,c.virtualOffsetY=0;this.setData(c,()=>{this.updateSelected(m,!1)})},computeVirtualRange(t,e,i,a=!1){const n=Math.abs(t),{BUFFER_COUNT:s,FAST_SCROLL_BUFFER:o}=VIRTUAL_SCROLL_CONFIG,{visibleItemCount:r}=this.data,l=a?o:s,d=Math.floor(n/i);return{startIndex:Math.max(0,d-l),endIndex:Math.min(e,d+r+l)}},updateVisibleOptions(t,e=!1){const{formatOptions:i,itemHeight:a,enableVirtualScroll:n}=this.data;if(!n)return;const s=void 0!==t?t:this.data.offset,o=this.computeVirtualRange(s,i.length,a,e);o.startIndex===this.data.virtualStartIndex&&o.endIndex===this.data.virtualStartIndex+this.data.visibleOptions.length||this.setData({visibleOptions:i.slice(o.startIndex,o.endIndex),virtualStartIndex:o.startIndex,virtualOffsetY:o.startIndex*a})},getCount(){var t,e;return null===(e=null===(t=this.data)||void 0===t?void 0:t.options)||void 0===e?void 0:e.length},getCurrentSelected(){var t,e;const{offset:i,itemHeight:a,formatOptions:n,keys:s}=this.data,o=Math.max(0,Math.min(Math.round(-i/a),this.getCount()-1));return{index:o,value:null===(t=n[o])||void 0===t?void 0:t[null==s?void 0:s.value],label:null===(e=n[o])||void 0===e?void 0:e[null==s?void 0:s.label]}}}}};PickerItem=__decorate([wxComponent()],PickerItem);export default PickerItem;
\ No newline at end of file
diff --git a/miniprogram/miniprogram_npm/tdesign-miniprogram/picker-item/picker-item.wxml b/miniprogram/miniprogram_npm/tdesign-miniprogram/picker-item/picker-item.wxml
index ff276c2..4f9178f 100644
--- a/miniprogram/miniprogram_npm/tdesign-miniprogram/picker-item/picker-item.wxml
+++ b/miniprogram/miniprogram_npm/tdesign-miniprogram/picker-item/picker-item.wxml
@@ -1 +1 @@
-{{option[pickerKeys.label]}} {{option[pickerKeys.label]}}
\ No newline at end of file
+{{option[keys.label]}} {{option[keys.label]}}
\ No newline at end of file
diff --git a/miniprogram/miniprogram_npm/tdesign-miniprogram/picker/picker.js b/miniprogram/miniprogram_npm/tdesign-miniprogram/picker/picker.js
index ed8ce8c..8374a92 100644
--- a/miniprogram/miniprogram_npm/tdesign-miniprogram/picker/picker.js
+++ b/miniprogram/miniprogram_npm/tdesign-miniprogram/picker/picker.js
@@ -1 +1 @@
-import{__decorate}from"tslib";import{SuperComponent,wxComponent}from"../common/src/index";import config from"../common/config";import props from"./props";import useCustomNavbar from"../mixins/using-custom-navbar";const{prefix:prefix}=config,name=`${prefix}-picker`;let Picker=class extends SuperComponent{constructor(){super(...arguments),this.behaviors=[useCustomNavbar],this.properties=props,this.externalClasses=[`${prefix}-class`,`${prefix}-class-confirm`,`${prefix}-class-cancel`,`${prefix}-class-title`],this.options={multipleSlots:!0},this.relations={"../picker-item/picker-item":{type:"child",linked(){this.updateChildren()}}},this.observers={"value, visible"(e,t){t&&(this.updateChildren(),this.updateIndicatorPosition())},"itemHeight, visibleItemCount"(){this.updateIndicatorPosition()}},this.data={prefix:prefix,classPrefix:name,defaultPopUpProps:{},defaultPopUpzIndex:11500,indicatorTop:72},this.methods={updateChildren(){const{value:e,defaultValue:t,itemHeight:i,visibleItemCount:s}=this.properties;this.$children.forEach((o,n)=>{var r,l;o.setData({value:null!==(l=null!==(r=null==e?void 0:e[n])&&void 0!==r?r:null==t?void 0:t[n])&&void 0!==l?l:"",columnIndex:n,itemHeight:i,visibleItemCount:s}),o.update()})},getSelectedValue(){return[this.$children.map(e=>e._selectedValue),this.$children.map(e=>e._selectedLabel)]},getColumnIndexes(){return this.$children.map((e,t)=>({column:t,index:e._selectedIndex}))},onConfirm(){const e=[],t=[],i=[];this.$children.forEach((s,o)=>{const n=s.getCurrentSelected();e.push(n.value),t.push(n.label),i.push({column:o,index:n.index})}),this.close("confirm-btn"),this.triggerEvent("confirm",{value:e,label:t,columns:i}),JSON.stringify(this.data.value)!==JSON.stringify(e)&&this.triggerEvent("change",{value:e,label:t,columns:i})},triggerColumnChange({column:e,index:t}){const[i,s]=this.getSelectedValue();this.triggerEvent("pick",{value:i,label:s,column:e,index:t})},onCancel(){this.close("cancel-btn"),this.triggerEvent("cancel")},onPopupChange(e){const{visible:t}=e.detail;this.close("overlay"),this.triggerEvent("visible-change",{visible:t})},close(e){this.data.autoClose&&this.setData({visible:!1}),this.triggerEvent("close",{trigger:e})},updateIndicatorPosition(){const{itemHeight:e,visibleItemCount:t}=this.properties,i=(t-1)/2*e;this.setData({indicatorTop:i})}}}ready(){this.$children.map((e,t)=>e.columnIndex=t),this.updateIndicatorPosition()}};Picker=__decorate([wxComponent()],Picker);export default Picker;
\ No newline at end of file
+import{__decorate}from"tslib";import{SuperComponent,wxComponent}from"../common/src/index";import config from"../common/config";import props from"./props";import useCustomNavbar from"../mixins/using-custom-navbar";const{prefix:prefix}=config,name=`${prefix}-picker`,DEFAULT_KEYS={value:"value",label:"label",icon:"icon"};let Picker=class extends SuperComponent{constructor(){super(...arguments),this.behaviors=[useCustomNavbar],this.properties=props,this.externalClasses=[`${prefix}-class`,`${prefix}-class-confirm`,`${prefix}-class-cancel`,`${prefix}-class-title`],this.options={multipleSlots:!0},this.relations={"../picker-item/picker-item":{type:"child",linked(){this.updateChildren()}}},this.observers={"value, visible"(e,i){const{usePopup:t}=this.properties;t&&!i||(this.updateChildren(),this.updateIndicatorPosition())},"itemHeight, visibleItemCount"(){this.updateIndicatorPosition()}},this.data={prefix:prefix,classPrefix:name,defaultPopUpProps:{},defaultPopUpzIndex:11500,indicatorTop:72},this.methods={updateChildren(){const{value:e,defaultValue:i,itemHeight:t,visibleItemCount:s,keys:o}=this.properties;this.$children.forEach((n,r)=>{var l,a;n.setData({value:null!==(a=null!==(l=null==e?void 0:e[r])&&void 0!==l?l:null==i?void 0:i[r])&&void 0!==a?a:"",columnIndex:r,itemHeight:t,visibleItemCount:s,keys:Object.assign(Object.assign({},DEFAULT_KEYS),o||{})}),n.update()})},getSelectedValue(){return[this.$children.map(e=>e._selectedValue),this.$children.map(e=>e._selectedLabel)]},getColumnIndexes(){return this.$children.map((e,i)=>({column:i,index:e._selectedIndex}))},onConfirm(){const e=[],i=[],t=[];this.$children.forEach((s,o)=>{const n=s.getCurrentSelected();e.push(n.value),i.push(n.label),t.push({column:o,index:n.index})}),this.close("confirm-btn"),this.triggerEvent("confirm",{value:e,label:i,columns:t}),JSON.stringify(this.data.value)!==JSON.stringify(e)&&this.triggerEvent("change",{value:e,label:i,columns:t})},triggerColumnChange({column:e,index:i}){const[t,s]=this.getSelectedValue();this.triggerEvent("pick",{value:t,label:s,column:e,index:i})},onCancel(){this.close("cancel-btn"),this.triggerEvent("cancel")},onPopupChange(e){const{visible:i}=e.detail;this.close("overlay"),this.triggerEvent("visible-change",{visible:i})},close(e){this.data.autoClose&&this.setData({visible:!1}),this.triggerEvent("close",{trigger:e})},updateIndicatorPosition(){const{itemHeight:e,visibleItemCount:i}=this.properties,t=(i-1)/2*e;this.setData({indicatorTop:t})}}}ready(){this.$children.map((e,i)=>e.columnIndex=i),this.updateIndicatorPosition()}};Picker=__decorate([wxComponent()],Picker);export default Picker;
\ No newline at end of file
diff --git a/miniprogram/miniprogram_npm/tdesign-miniprogram/picker/picker.wxss b/miniprogram/miniprogram_npm/tdesign-miniprogram/picker/picker.wxss
index bbd7b84..582a111 100644
--- a/miniprogram/miniprogram_npm/tdesign-miniprogram/picker/picker.wxss
+++ b/miniprogram/miniprogram_npm/tdesign-miniprogram/picker/picker.wxss
@@ -1,7 +1,7 @@
@import '../common/style/index.wxss';.t-picker{position:relative;background-color:var(--td-picker-bg-color,var(--td-bg-color-container,var(--td-font-white-1,#fff)));border-top-left-radius:var(--td-picker-border-radius,24rpx);border-top-right-radius:var(--td-picker-border-radius,24rpx);}
.t-picker__toolbar{display:flex;align-items:center;justify-content:space-between;overflow:hidden;height:var(--td-picker-toolbar-height,116rpx);}
-.t-picker__title{flex:1;text-align:center;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;color:var(--td-picker-title-color,var(--td-text-color-primary,var(--td-font-gray-1,rgba(0,0,0,.9))));line-height:var(--td-picker-title-line-height,52rpx);font-weight:var(--td-picker-title-font-weight,600);font-size:var(--td-picker-title-font-size,36rpx);}
-.t-picker__cancel,.t-picker__confirm{display:flex;align-items:center;justify-content:center;user-select:none;font-size:var(--td-picker-button-font-size,32rpx);height:100%;padding:0 32rpx;}
+.t-picker__title{flex:1;text-align:center;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;color:var(--td-picker-title-color,var(--td-text-color-primary,var(--td-font-gray-1,rgba(0,0,0,.9))));font:var(--td-picker-title-font,var(--td-font-title-large,600 36rpx / 52rpx var(--td-font-family,PingFang SC,Microsoft YaHei,Arial Regular)));}
+.t-picker__cancel,.t-picker__confirm{display:flex;align-items:center;justify-content:center;user-select:none;font:var(--td-picker-button-font,var(--td-font-body-large,32rpx / 48rpx var(--td-font-family,PingFang SC,Microsoft YaHei,Arial Regular)));height:100%;padding:0 32rpx;}
.t-picker__cancel{color:var(--td-picker-cancel-color,var(--td-text-color-secondary,var(--td-font-gray-2,rgba(0,0,0,.6))));}
.t-picker__confirm{color:var(--td-picker-confirm-color,var(--td-brand-color,var(--td-primary-color-7,#0052d9)));}
.t-picker__main{position:relative;display:flex;justify-content:center;padding-left:64rpx;padding-right:64rpx;}
diff --git a/miniprogram/miniprogram_npm/tdesign-miniprogram/popover/index.d.ts b/miniprogram/miniprogram_npm/tdesign-miniprogram/popover/index.d.ts
new file mode 100644
index 0000000..07c7860
--- /dev/null
+++ b/miniprogram/miniprogram_npm/tdesign-miniprogram/popover/index.d.ts
@@ -0,0 +1,3 @@
+export * from './props';
+export * from './type';
+export * from './popover';
diff --git a/miniprogram/miniprogram_npm/tdesign-miniprogram/popover/index.js b/miniprogram/miniprogram_npm/tdesign-miniprogram/popover/index.js
new file mode 100644
index 0000000..1d16d58
--- /dev/null
+++ b/miniprogram/miniprogram_npm/tdesign-miniprogram/popover/index.js
@@ -0,0 +1 @@
+export*from"./props";export*from"./type";export*from"./popover";
\ No newline at end of file
diff --git a/miniprogram/miniprogram_npm/tdesign-miniprogram/popover/popover.d.ts b/miniprogram/miniprogram_npm/tdesign-miniprogram/popover/popover.d.ts
new file mode 100644
index 0000000..3c4dd44
--- /dev/null
+++ b/miniprogram/miniprogram_npm/tdesign-miniprogram/popover/popover.d.ts
@@ -0,0 +1,50 @@
+import { TdPopoverProps } from './type';
+import { SuperComponent } from '../common/src/index';
+export interface PopoverProps extends TdPopoverProps {
+}
+export default class Popover extends SuperComponent {
+ behaviors: string[];
+ externalClasses: string[];
+ options: {
+ multipleSlots: boolean;
+ };
+ properties: TdPopoverProps;
+ data: {
+ prefix: string;
+ classPrefix: string;
+ _placement: string;
+ contentStyle: string;
+ arrowStyle: string;
+ };
+ controlledProps: {
+ key: string;
+ event: string;
+ }[];
+ observers: {
+ visible(val: boolean): void;
+ 'placement, realVisible'(v: boolean): void;
+ };
+ methods: {
+ onScroll(): void;
+ updateVisible(visible: boolean): void;
+ onOverlayTap(): void;
+ getToward(placement: string): {
+ isHorizontal: string;
+ isVertical: string;
+ isBase: string;
+ isEnd: boolean;
+ };
+ calcArrowStyle(placement: string, contentDom: any, popoverDom: any): string;
+ calcContentPosition(placement: string, triggerRect: any, contentRect: any): {
+ top: number;
+ left: number;
+ };
+ alignCrossAxis(start: number, triggerSize: number, contentSize: number, align: 'start' | 'end' | 'center'): number;
+ calcPlacement(isFixed: boolean, placement: string, triggerRect: any, contentRect: any): Promise<{
+ placement: string;
+ top: number;
+ left: number;
+ }>;
+ computePosition(): Promise;
+ };
+}
diff --git a/miniprogram/miniprogram_npm/tdesign-miniprogram/popover/popover.js b/miniprogram/miniprogram_npm/tdesign-miniprogram/popover/popover.js
new file mode 100644
index 0000000..8885926
--- /dev/null
+++ b/miniprogram/miniprogram_npm/tdesign-miniprogram/popover/popover.js
@@ -0,0 +1 @@
+import{__awaiter,__decorate,__rest}from"tslib";import{getWindowInfo}from"../common/wechat";import{SuperComponent,wxComponent}from"../common/src/index";import config from"../common/config";import props from"./props";import{debounce}from"../common/utils";import transition from"../mixins/transition";import pageScrollMixin from"../mixins/page-scroll";delete props.visible;const{prefix:prefix}=config,name=`${prefix}-popover`;let Popover=class extends SuperComponent{constructor(){super(...arguments),this.behaviors=[transition(),pageScrollMixin()],this.externalClasses=[`${prefix}-class`,`${prefix}-class-content`,`${prefix}-class-trigger`],this.options={multipleSlots:!0},this.properties=props,this.data={prefix:prefix,classPrefix:name,_placement:"top",contentStyle:"",arrowStyle:""},this.controlledProps=[{key:"visible",event:"visible-change"}],this.observers={visible(t){null!=t&&this.updateVisible(t)},"placement, realVisible"(t){t&&this.computePosition()}},this.methods={onScroll(){this.data.realVisible&&debounce(()=>this.computePosition(),100)},updateVisible(t){t!==this.data.visible&&this.setData({visible:t},()=>{this._trigger("visible-change",{visible:t})})},onOverlayTap(){this.properties.closeOnClickOutside&&this.updateVisible(!1)},getToward(t){const e=["top","bottom"],i=["left","right"];return{isHorizontal:e.find(e=>t.includes(e)),isVertical:i.find(e=>t.includes(e)),isBase:[...e,...i].find(e=>e===t),isEnd:t.includes("end")}},calcArrowStyle(t,e,i){const{isHorizontal:o,isVertical:s,isBase:r,isEnd:n}=this.getToward(t);if(r)return"";const{width:l,left:a}=e,{width:c,height:p}=i,{windowWidth:h}=getWindowInfo();if(o){const t=n?Math.min(l+a,c):Math.min(h-a,c);return n?`left:${t-28}px;`:`right:${t-28}px;`}if(s){const t=p-28;return n?`top:${t}px;`:`bottom:${t}px;top:unset;`}return""},calcContentPosition(t,e,i){let o=0,s=0;const r=t.startsWith("top"),n=t.startsWith("bottom"),l=t.startsWith("left"),a=t.startsWith("right");r?o=e.top-i.height:n?o=e.top+e.height:l?s=e.left-i.width:a?s=e.left+e.width:o=e.top-i.height;const c=t.includes("start"),p=t.includes("end");let h;return h=c?"start":p?"end":"center",(r||n)&&(s=this.alignCrossAxis(e.left,e.width,i.width,h)),(l||a)&&(o=this.alignCrossAxis(e.top,e.height,i.height,h)),{top:o,left:s}},alignCrossAxis:(t,e,i,o)=>"start"===o?t:"end"===o?t+e-i:t+e/2-i/2,calcPlacement(t,e,i,o){return new Promise(s=>{const r=this.selectOwnerComponent().createSelectorQuery();r.select(`.${name}-wrapper--fixed`).boundingClientRect(),r.exec(r=>{const[n]=r;n&&t&&(i=n);const{isHorizontal:l,isVertical:a}=this.getToward(e),{width:c,height:p}=o,{left:h,top:m,right:d,bottom:f}=i;let g=!0;const{windowWidth:u,windowHeight:w}=getWindowInfo();let x=e;l?e.startsWith("top")?g=m-p>=0:e.startsWith("bottom")&&(g=f+p<=w):a&&(e.startsWith("left")?g=h-c>=0:e.startsWith("right")&&(g=d+c<=u)),g||(l?x=e.startsWith("top")?e.replace("top","bottom"):e.replace("bottom","top"):a&&(x=e.startsWith("left")?e.replace("left","right"):e.replace("right","left")));const b=this.calcContentPosition(x,i,o);s(Object.assign({placement:x},b))})})},computePosition(){return __awaiter(this,void 0,void 0,function*(){const{placement:t}=this.data,e=t.replace(/-(left|top)$/,"-start").replace(/-(right|bottom)$/,"-end");this.setData({_placement:e});const i=this.createSelectorQuery();i.select(`#${name}-wrapper`).boundingClientRect(),i.select(`#${name}-content`).boundingClientRect(),i.selectViewport().scrollOffset(),i.exec(t=>__awaiter(this,void 0,void 0,function*(){const[i,o,s]=t;if(!i||!o)return;const r=this.properties.fixed,n=yield this.calcPlacement(r,e,i,o),{placement:l}=n,a=__rest(n,["placement"]);this.setData({_placement:l});const{scrollTop:c=0,scrollLeft:p=0}=s||{},h=r?a.top:a.top+c,m=r?a.left:a.left+p,d=`top:${Math.max(h,0)}px;left:${Math.max(m,0)}px;`,f=this.calcArrowStyle(e,i,o);this.setData({contentStyle:d,arrowStyle:f})}))})}}}};Popover=__decorate([wxComponent()],Popover);export default Popover;
\ No newline at end of file
diff --git a/miniprogram/miniprogram_npm/tdesign-miniprogram/popover/popover.json b/miniprogram/miniprogram_npm/tdesign-miniprogram/popover/popover.json
new file mode 100644
index 0000000..707b666
--- /dev/null
+++ b/miniprogram/miniprogram_npm/tdesign-miniprogram/popover/popover.json
@@ -0,0 +1 @@
+{"component":true,"styleIsolation":"apply-shared","usingComponents":{"t-overlay":"../overlay/overlay"}}
\ No newline at end of file
diff --git a/miniprogram/miniprogram_npm/tdesign-miniprogram/popover/popover.wxml b/miniprogram/miniprogram_npm/tdesign-miniprogram/popover/popover.wxml
new file mode 100644
index 0000000..b8ee47f
--- /dev/null
+++ b/miniprogram/miniprogram_npm/tdesign-miniprogram/popover/popover.wxml
@@ -0,0 +1 @@
+{{content}}
\ No newline at end of file
diff --git a/miniprogram/miniprogram_npm/tdesign-miniprogram/popover/popover.wxss b/miniprogram/miniprogram_npm/tdesign-miniprogram/popover/popover.wxss
new file mode 100644
index 0000000..9654081
--- /dev/null
+++ b/miniprogram/miniprogram_npm/tdesign-miniprogram/popover/popover.wxss
@@ -0,0 +1,63 @@
+@import '../common/style/index.wxss';.t-popover__wrapper{display:inline-block;}
+.t-popover{position:absolute;z-index:11500;overflow:visible;transition:.2s ease-in-out all;}
+.t-popover--fixed{position:fixed;}
+.t-popover__content{position:relative;padding:var(--td-popover-padding,24rpx);border-radius:12rpx;box-shadow:var(--td-shadow-3,0 6px 30px 5px rgba(0,0,0,.05),0 16px 24px 2px rgba(0,0,0,.04),0 8px 10px -5px rgba(0,0,0,.08));font-size:var(--td-font-size-m,32rpx);line-height:48rpx;border-radius:6px;-webkit-box-sizing:border-box;box-sizing:border-box;word-break:break-all;}
+.t-popover__arrow{position:absolute;width:0;height:0;border-style:solid;border-color:transparent;border-width:16rpx;}
+.t-popover .t-popover--dark{color:#fff;background:var(--td-font-gray-1,rgba(0,0,0,.9));}
+.t-popover .t-popover--dark .t-popover__arrow{color:var(--td-font-gray-1,rgba(0,0,0,.9));}
+.t-popover .t-popover--light{color:var(--td-text-color-primary,var(--td-font-gray-1,rgba(0,0,0,.9)));background:var(--td-bg-color-container,var(--td-font-white-1,#fff));}
+.t-popover .t-popover--light .t-popover__arrow{color:var(--td-bg-color-container,var(--td-font-white-1,#fff));}
+.t-popover .t-popover--brand{color:var(--td-primary-color-7,#0052d9);background:var(--td-primary-color-1,#f2f3ff);}
+.t-popover .t-popover--brand .t-popover__arrow{color:var(--td-primary-color-1,#f2f3ff);}
+.t-popover .t-popover--success{color:var(--td-success-color-5,#2ba471);background:var(--td-success-color-1,#e3f9e9);}
+.t-popover .t-popover--success .t-popover__arrow{color:var(--td-success-color-1,#e3f9e9);}
+.t-popover .t-popover--warning{color:var(--td-warning-color-5,#e37318);background:var(--td-warning-color-1,#fff1e9);}
+.t-popover .t-popover--warning .t-popover__arrow{color:var(--td-warning-color-1,#fff1e9);}
+.t-popover .t-popover--error{color:var(--td-error-color-6,#d54941);background:var(--td-error-color-1,#fff0ed);}
+.t-popover .t-popover--error .t-popover__arrow{color:var(--td-error-color-1,#fff0ed);}
+.t-popover.t-fade-enter-to{opacity:1;visibility:visible;}
+.t-popover.t-fade-enter,.t-popover.t-fade-leave-to{opacity:0;visibility:hidden;}
+.t-popover[data-placement^=top] .t-popover__content{margin-bottom:16rpx;}
+.t-popover[data-placement^=top] .t-popover__content--arrow{margin-bottom:24rpx;}
+.t-popover[data-placement^=bottom] .t-popover__content{margin-top:16rpx;}
+.t-popover[data-placement^=bottom] .t-popover__content--arrow{margin-top:24rpx;}
+.t-popover[data-placement^=left] .t-popover__content{margin-right:16rpx;}
+.t-popover[data-placement^=left] .t-popover__content--arrow{margin-right:24rpx;}
+.t-popover[data-placement^=right] .t-popover__content{margin-left:16rpx;}
+.t-popover[data-placement^=right] .t-popover__content--arrow{margin-left:24rpx;}
+.t-popover[data-placement^=top] .t-popover__arrow{bottom:0;border-top-color:currentColor;border-bottom-width:0;margin-bottom:calc(16rpx * -1);}
+.t-popover[data-placement=top]{transform-origin:50% 100%;}
+.t-popover[data-placement=top] .t-popover__arrow{left:50%;transform:translateX(-50%);}
+.t-popover[data-placement=top-start]{transform-origin:0 100%;}
+.t-popover[data-placement=top-start] .t-popover__arrow{left:var(--td-popover-padding,24rpx);}
+.t-popover[data-placement=top-end]{transform-origin:100% 100%;}
+.t-popover[data-placement=top-end] .t-popover__arrow{right:var(--td-popover-padding,24rpx);}
+.t-popover[data-placement^=bottom] .t-popover__arrow{top:0;border-top-width:0;border-bottom-color:currentColor;margin-top:calc(16rpx * -1);}
+.t-popover[data-placement=bottom]{transform-origin:50% 0;}
+.t-popover[data-placement=bottom] .t-popover__arrow{left:50%;transform:translateX(-50%);}
+.t-popover[data-placement=bottom-start]{transform-origin:0 0;}
+.t-popover[data-placement=bottom-start] .t-popover__arrow{left:var(--td-popover-padding,24rpx);}
+.t-popover[data-placement=bottom-end]{transform-origin:100% 0;}
+.t-popover[data-placement=bottom-end] .t-popover__arrow{right:var(--td-popover-padding,24rpx);}
+.t-popover[data-placement^=left] .t-popover__arrow{right:0;border-right-width:0;border-left-color:currentColor;margin-right:calc(16rpx * -1);}
+.t-popover[data-placement=left]{transform-origin:100% 50%;}
+.t-popover[data-placement=left] .t-popover__arrow{top:50%;transform:translateY(-50%);}
+.t-popover[data-placement=left-start]{transform-origin:100% 0;}
+.t-popover[data-placement=left-start] .t-popover__arrow{top:var(--td-popover-padding,24rpx);}
+.t-popover[data-placement=left-end]{transform-origin:100% 100%;}
+.t-popover[data-placement=left-end] .t-popover__arrow{bottom:var(--td-popover-padding,24rpx);}
+.t-popover[data-placement^=right] .t-popover__arrow{left:0;border-right-color:currentColor;border-left-width:0;margin-left:calc(16rpx * -1);}
+.t-popover[data-placement=right]{transform-origin:0 50%;}
+.t-popover[data-placement=right] .t-popover__arrow{top:50%;transform:translateY(-50%);}
+.t-popover[data-placement=right-start]{transform-origin:0 0;}
+.t-popover[data-placement=right-start] .t-popover__arrow{top:var(--td-popover-padding,24rpx);}
+.t-popover[data-placement=right-end]{transform-origin:0 100%;}
+.t-popover[data-placement=right-end] .t-popover__arrow{bottom:var(--td-popover-padding,24rpx);}
+.content-placement-top .t-popover[data-placement^=top] .t-popover__content{margin-bottom:16rpx;}
+.content-placement-top .t-popover[data-placement^=top] .t-popover__content--arrow{margin-bottom:24rpx;}
+.content-placement-bottom .t-popover[data-placement^=bottom] .t-popover__content{margin-top:16rpx;}
+.content-placement-bottom .t-popover[data-placement^=bottom] .t-popover__content--arrow{margin-top:24rpx;}
+.content-placement-left .t-popover[data-placement^=left] .t-popover__content{margin-right:16rpx;}
+.content-placement-left .t-popover[data-placement^=left] .t-popover__content--arrow{margin-right:24rpx;}
+.content-placement-right .t-popover[data-placement^=right] .t-popover__content{margin-left:16rpx;}
+.content-placement-right .t-popover[data-placement^=right] .t-popover__content--arrow{margin-left:24rpx;}
\ No newline at end of file
diff --git a/miniprogram/miniprogram_npm/tdesign-miniprogram/popover/props.d.ts b/miniprogram/miniprogram_npm/tdesign-miniprogram/popover/props.d.ts
new file mode 100644
index 0000000..74dfef8
--- /dev/null
+++ b/miniprogram/miniprogram_npm/tdesign-miniprogram/popover/props.d.ts
@@ -0,0 +1,3 @@
+import { TdPopoverProps } from './type';
+declare const props: TdPopoverProps;
+export default props;
diff --git a/miniprogram/miniprogram_npm/tdesign-miniprogram/popover/props.js b/miniprogram/miniprogram_npm/tdesign-miniprogram/popover/props.js
new file mode 100644
index 0000000..4a40d1e
--- /dev/null
+++ b/miniprogram/miniprogram_npm/tdesign-miniprogram/popover/props.js
@@ -0,0 +1 @@
+const props={closeOnClickOutside:{type:Boolean,value:!0},content:{type:String},fixed:{type:Boolean,value:!1},placement:{type:String,value:"top"},showArrow:{type:Boolean,value:!0},theme:{type:String,value:"dark"},visible:{type:Boolean,value:null},defaultVisible:{type:Boolean}};export default props;
\ No newline at end of file
diff --git a/miniprogram/miniprogram_npm/tdesign-miniprogram/popover/type.d.ts b/miniprogram/miniprogram_npm/tdesign-miniprogram/popover/type.d.ts
new file mode 100644
index 0000000..093c8f4
--- /dev/null
+++ b/miniprogram/miniprogram_npm/tdesign-miniprogram/popover/type.d.ts
@@ -0,0 +1,34 @@
+export interface TdPopoverProps {
+ closeOnClickOutside?: {
+ type: BooleanConstructor;
+ value?: boolean;
+ };
+ content?: {
+ type: StringConstructor;
+ value?: string;
+ };
+ fixed?: {
+ type: BooleanConstructor;
+ value?: boolean;
+ };
+ placement?: {
+ type: StringConstructor;
+ value?: 'top' | 'left' | 'right' | 'bottom' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'left-top' | 'left-bottom' | 'right-top' | 'right-bottom';
+ };
+ showArrow?: {
+ type: BooleanConstructor;
+ value?: boolean;
+ };
+ theme?: {
+ type: StringConstructor;
+ value?: 'dark' | 'light' | 'brand' | 'success' | 'warning' | 'error';
+ };
+ visible?: {
+ type: BooleanConstructor;
+ value?: boolean;
+ };
+ defaultVisible?: {
+ type: BooleanConstructor;
+ value?: boolean;
+ };
+}
diff --git a/miniprogram/miniprogram_npm/tdesign-miniprogram/popover/type.js b/miniprogram/miniprogram_npm/tdesign-miniprogram/popover/type.js
new file mode 100644
index 0000000..17bca46
--- /dev/null
+++ b/miniprogram/miniprogram_npm/tdesign-miniprogram/popover/type.js
@@ -0,0 +1 @@
+export{};
\ No newline at end of file
diff --git a/miniprogram/miniprogram_npm/tdesign-miniprogram/progress/progress.wxml b/miniprogram/miniprogram_npm/tdesign-miniprogram/progress/progress.wxml
index 7a504e3..aec4e30 100644
--- a/miniprogram/miniprogram_npm/tdesign-miniprogram/progress/progress.wxml
+++ b/miniprogram/miniprogram_npm/tdesign-miniprogram/progress/progress.wxml
@@ -1 +1 @@
-{{ _.isString(label)? label: computedProgress + '%' }} {{ _.isString(label)? label: computedProgress + '%' }} {{ _.isString(label)? label: computedProgress + '%' }} {{ _.isString(label)? label: computedProgress + '%' }}
\ No newline at end of file
+{{ _.isString(label)? label: computedProgress + '%' }} {{ _.isString(label)? label: computedProgress + '%' }} {{ _.isString(label)? label: computedProgress + '%' }} {{ _.isString(label)? label: computedProgress + '%' }}
\ No newline at end of file
diff --git a/miniprogram/miniprogram_npm/tdesign-miniprogram/progress/progress.wxss b/miniprogram/miniprogram_npm/tdesign-miniprogram/progress/progress.wxss
index 14b8f6b..874f3a9 100644
--- a/miniprogram/miniprogram_npm/tdesign-miniprogram/progress/progress.wxss
+++ b/miniprogram/miniprogram_npm/tdesign-miniprogram/progress/progress.wxss
@@ -5,14 +5,14 @@
.t-progress--thin{display:flex;justify-content:space-between;align-items:center;}
.t-progress--thin .t-progress__icon{font-size:calc(var(--td-font-size-base,28rpx) + 2px);}
.t-progress--plump{height:var(--td-progress-stroke-plump-width,40rpx);border-radius:calc(var(--td-progress-stroke-plump-width,40rpx)/ 2);display:flex;align-items:center;}
-.t-progress--plump .t-progress__info{font-size:var(--td-font-size-s,24rpx);}
+.t-progress--plump .t-progress__info{font:var(--td-font-body-small,24rpx / 40rpx var(--td-font-family,PingFang SC,Microsoft YaHei,Arial Regular));}
.t-progress--over-ten .t-progress__info{position:absolute;top:50%;right:var(--td-spacer,16rpx);color:var(--td-progress-info-light-color,var(--td-text-color-anti,var(--td-font-white-1,#fff)));transform:translateY(-50%);}
.t-progress--under-ten .t-progress__info,.t-progress--under-ten .t-progress__inner{display:inline-block;}
.t-progress--under-ten .t-progress__info{vertical-align:top;}
.t-progress__canvas--circle{position:relative;width:var(--td-progress-circle-width,224rpx);height:var(--td-progress-circle-width,224rpx);border-radius:var(--td-radius-circle,50%);}
-.t-progress__canvas--circle .t-progress__canvas--inner{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:calc(100% - var(--td-progress-stroke-circle-width,12rpx)*2);height:calc(100% - var(--td-progress-stroke-circle-width,12rpx)*2);border-radius:var(--td-radius-circle,50%);display:flex;flex-direction:row;justify-content:center;align-items:center;background-color:var(--td-progress-circle-inner-bg-color,var(--td-text-color-anti,var(--td-font-white-1,#fff)));}
-.t-progress__canvas--circle .t-progress__info{margin:0;font-size:var(--td-progress-circle-label-font-size,40rpx);font-weight:var(--td-progress-circle-label-font-weight,700);line-height:var(--td-progress-circle-label-line-height,56rpx);overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;}
-.t-progress__canvas--circle--micro{--td-progress-circle-width:48rpx;--td-progress-stroke-circle-width:4rpx;--td-progress-circle-icon-font-size:40rpx;}
+.t-progress__canvas--circle .t-progress__canvas--inner{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:calc(100% - var(--td-progress-stroke-circle-width,12rpx)*2);height:calc(100% - var(--td-progress-stroke-circle-width,12rpx)*2);border-radius:var(--td-radius-circle,50%);display:flex;flex-direction:row;justify-content:center;align-items:center;background-color:var(--td-progress-circle-inner-bg-color,var(--td-bg-color-container,var(--td-font-white-1,#fff)));}
+.t-progress__canvas--circle .t-progress__info{margin:0;padding:0;font:var(--td-progress-circle-label-font,var(--td-font-title-extraLarge,600 40rpx / 56rpx var(--td-font-family,PingFang SC,Microsoft YaHei,Arial Regular)));overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;}
+.t-progress__canvas--circle--micro{--td-progress-circle-width:48rpx;--td-progress-stroke-circle-width:4rpx;--td-progress-circle-icon-size:40rpx;}
.t-progress--status--active .t-progress__inner::before{position:absolute;top:0;right:0;bottom:0;left:0;z-index:1;content:'';animation:progress-active-animation 2s cubic-bezier(.23,.99,.86,.2) infinite;background:var(--td-progress-inner-bg-color-active,var(--td-bg-color-container,var(--td-font-white-1,#fff)));opacity:.2;}
.t-progress--status--success .t-progress__inner{background:var(--td-progress-inner-bg-color-success,var(--td-success-color,var(--td-success-color-5,#2ba471)));}
.t-progress--status--success .t-progress__icon{color:var(--td-success-color,var(--td-success-color-5,#2ba471));}
diff --git a/miniprogram/miniprogram_npm/tdesign-miniprogram/qrcode/components/qrcode-status/qrcode-status.wxss b/miniprogram/miniprogram_npm/tdesign-miniprogram/qrcode/components/qrcode-status/qrcode-status.wxss
index 5a62826..924f4e9 100644
--- a/miniprogram/miniprogram_npm/tdesign-miniprogram/qrcode/components/qrcode-status/qrcode-status.wxss
+++ b/miniprogram/miniprogram_npm/tdesign-miniprogram/qrcode/components/qrcode-status/qrcode-status.wxss
@@ -1,5 +1,5 @@
@import '../../../common/style/index.wxss';.t-expired__text{color:var(--td-text-color-primary,var(--td-font-gray-1,rgba(0,0,0,.9)));font-weight:600;}
.t-expired__button{display:flex;color:var(--td-brand-color,var(--td-primary-color-7,#0052d9));box-shadow:none;cursor:pointer;column-gap:8px;align-items:center;height:32px;transition:all .2s cubic-bezier(.215,.61,.355,1);}
-.t-expired__button:hover{color:var(--td-brand-color-hover);}
+.t-expired__button:hover{color:var(--td-brand-color-active,var(--td-primary-color-8,#003cab));}
.t-scanned{display:flex;column-gap:8px;align-items:center;}
-.t-scanned__icon{color:var(--td-success-color);}
\ No newline at end of file
+.t-scanned__icon{color:var(--td-success-color,var(--td-success-color-5,#2ba471));}
\ No newline at end of file
diff --git a/miniprogram/miniprogram_npm/tdesign-miniprogram/qrcode/qrcode.wxss b/miniprogram/miniprogram_npm/tdesign-miniprogram/qrcode/qrcode.wxss
index 4fc4ec7..45d495f 100644
--- a/miniprogram/miniprogram_npm/tdesign-miniprogram/qrcode/qrcode.wxss
+++ b/miniprogram/miniprogram_npm/tdesign-miniprogram/qrcode/qrcode.wxss
@@ -1,3 +1,3 @@
-@import '../common/style/index.wxss';.t-qrcode{position:relative;display:flex;box-sizing:border-box;background-color:var(--td-bg-color-container,var(--td-font-white-1,#fff));padding:12px;border-radius:6px;border:1px solid var(--td-component-border,var(--td-gray-color-4,#dcdcdc));}
+@import '../common/style/index.wxss';.t-qrcode{position:relative;display:flex;box-sizing:border-box;background-color:var(--td-bg-color-container,var(--td-font-white-1,#fff));padding:24rpx;border-radius:12rpx;border:1px solid var(--td-component-border,var(--td-gray-color-4,#dcdcdc));}
.t-qrcode.t-borderless{border-color:transparent;}
-.t-qrcode .t-mask{left:0;top:0;position:absolute;inset-block-start:0;inset-inline-start:0;z-index:300;display:flex;flex-direction:column;justify-content:center;align-items:center;width:100%;height:100%;color:var(--td-text-color-primary,var(--td-font-gray-1,rgba(0,0,0,.9)));line-height:22px;background-color:var(--td-mask-background,rgba(255,255,255,.96));text-align:center;border-radius:6px;font-size:var(--td-font-size-title-small);}
\ No newline at end of file
+.t-qrcode .t-mask{left:0;top:0;position:absolute;inset-block-start:0;inset-inline-start:0;z-index:300;display:flex;flex-direction:column;justify-content:center;align-items:center;width:100%;height:100%;color:var(--td-text-color-primary,var(--td-font-gray-1,rgba(0,0,0,.9)));background-color:var(--td-mask-background,rgba(255,255,255,.96));text-align:center;border-radius:12rpx;font:var(--td-font-body-medium,28rpx / 44rpx var(--td-font-family,PingFang SC,Microsoft YaHei,Arial Regular));}
\ No newline at end of file
diff --git a/miniprogram/miniprogram_npm/tdesign-miniprogram/radio/radio.wxss b/miniprogram/miniprogram_npm/tdesign-miniprogram/radio/radio.wxss
index bd9adae..4798808 100644
--- a/miniprogram/miniprogram_npm/tdesign-miniprogram/radio/radio.wxss
+++ b/miniprogram/miniprogram_npm/tdesign-miniprogram/radio/radio.wxss
@@ -1,5 +1,5 @@
@import '../common/style/index.wxss';.limit-title-row{display:-webkit-box;-webkit-box-orient:vertical;overflow:hidden;}
-.t-radio{position:relative;display:inline-flex;vertical-align:middle;font-size:var(--td-radio-font-size,32rpx);background:var(--td-radio-bg-color,var(--td-bg-color-container,var(--td-font-white-1,#fff)));}
+.t-radio{position:relative;display:inline-flex;vertical-align:middle;background:var(--td-radio-bg-color,var(--td-bg-color-container,var(--td-font-white-1,#fff)));}
.t-radio:focus{outline:0;}
.t-radio--block{display:flex;padding:var(--td-radio-vertical-padding,32rpx);}
.t-radio--right{flex-direction:row-reverse;}
@@ -23,10 +23,10 @@
.t-radio-icon__image{height:var(--td-radio-icon-size,48rpx);width:var(--td-radio-icon-size,48rpx);vertical-align:sub;}
.t-radio__content{flex:1;}
.t-radio__content:empty{display:none;}
-.t-radio__title{display:-webkit-box;-webkit-box-orient:vertical;overflow:hidden;color:var(--td-radio-label-color,var(--td-text-color-primary,var(--td-font-gray-1,rgba(0,0,0,.9))));line-height:var(--td-radio-label-line-height,48rpx);}
+.t-radio__title{display:-webkit-box;-webkit-box-orient:vertical;overflow:hidden;color:var(--td-radio-label-color,var(--td-text-color-primary,var(--td-font-gray-1,rgba(0,0,0,.9))));font:var(--td-radio-font,var(--td-font-body-large,32rpx / 48rpx var(--td-font-family,PingFang SC,Microsoft YaHei,Arial Regular)));}
.t-radio__title--checked{color:var(--td-radio-label-checked-color,var(--td-text-color-primary,var(--td-font-gray-1,rgba(0,0,0,.9))));}
.t-radio__title--disabled{cursor:not-allowed;color:var(--td-radio-label-disabled-color,var(--td-text-color-disabled,var(--td-font-gray-4,rgba(0,0,0,.26))));}
-.t-radio__description{display:-webkit-box;-webkit-box-orient:vertical;overflow:hidden;color:var(--td-radio-content-color,var(--td-text-color-secondary,var(--td-font-gray-2,rgba(0,0,0,.6))));font-size:var(--td-radio-content-font-size,28rpx);line-height:var(--td-radio-content-line-height,44rpx);}
+.t-radio__description{display:-webkit-box;-webkit-box-orient:vertical;overflow:hidden;color:var(--td-radio-content-color,var(--td-text-color-secondary,var(--td-font-gray-2,rgba(0,0,0,.6))));font:var(--td-radio-content-font,var(--td-font-body-medium,28rpx / 44rpx var(--td-font-family,PingFang SC,Microsoft YaHei,Arial Regular)));}
.t-radio__description--checked{color:var(--td-radio-content-checked-color,var(--td-text-color-secondary,var(--td-font-gray-2,rgba(0,0,0,.6))));}
.t-radio__description--disabled{cursor:not-allowed;color:var(--td-radio-content-disabled-color,var(--td-text-color-disabled,var(--td-font-gray-4,rgba(0,0,0,.26))));}
.t-radio__description:empty{display:none;}
diff --git a/miniprogram/miniprogram_npm/tdesign-miniprogram/rate/rate.wxss b/miniprogram/miniprogram_npm/tdesign-miniprogram/rate/rate.wxss
index f391fc2..62e537f 100644
--- a/miniprogram/miniprogram_npm/tdesign-miniprogram/rate/rate.wxss
+++ b/miniprogram/miniprogram_npm/tdesign-miniprogram/rate/rate.wxss
@@ -12,4 +12,4 @@
.t-rate__tips--bottom{top:calc(100% + 16rpx);bottom:auto;}
.t-rate__tips-item{display:flex;flex-direction:column;align-items:center;width:64rpx;border-radius:6rpx;}
.t-rate__tips-item--active{background-color:var(--td-bg-color-component,var(--td-gray-color-3,#e7e7e7));}
-.t-rate__tips-text{text-align:center;font-size:24rpx;line-height:40rpx;}
\ No newline at end of file
+.t-rate__tips-text{text-align:center;font:var(--td-font-body-medium,28rpx / 44rpx var(--td-font-family,PingFang SC,Microsoft YaHei,Arial Regular));}
\ No newline at end of file
diff --git a/miniprogram/miniprogram_npm/tdesign-miniprogram/result/result.wxss b/miniprogram/miniprogram_npm/tdesign-miniprogram/result/result.wxss
index 6996101..d7db991 100644
--- a/miniprogram/miniprogram_npm/tdesign-miniprogram/result/result.wxss
+++ b/miniprogram/miniprogram_npm/tdesign-miniprogram/result/result.wxss
@@ -1,8 +1,8 @@
@import '../common/style/index.wxss';.t-result{display:flex;flex-direction:column;align-items:center;}
.t-result__icon{font-size:160rpx;}
-.t-result__title{line-height:var(--td-result-title-line-height,56rpx);font-size:var(--td-result-title-font-size,var(--td-font-size-xl,40rpx));font-weight:700;color:var(--td-result-title-color,var(--td-text-color-primary,var(--td-font-gray-1,rgba(0,0,0,.9))));}
+.t-result__title{font:var(--td-result-title-font,var(--td-font-title-extraLarge,600 40rpx / 56rpx var(--td-font-family,PingFang SC,Microsoft YaHei,Arial Regular)));color:var(--td-result-title-color,var(--td-text-color-primary,var(--td-font-gray-1,rgba(0,0,0,.9))));}
.t-result__thumb:not(:empty)+.t-result__title:not(:empty){margin-top:var(--td-result-title-margin-top,var(--td-spacer-1,24rpx));}
-.t-result__description{text-align:center;color:var(--td-result-description-color,var(--td-text-color-secondary,var(--td-font-gray-2,rgba(0,0,0,.6))));font-size:var(--td-result-description-font-size,var(--td-font-size-base,28rpx));line-height:var(--td-result-description-line-height,44rpx);}
+.t-result__description{text-align:center;color:var(--td-result-description-color,var(--td-text-color-secondary,var(--td-font-gray-2,rgba(0,0,0,.6))));font:var(--td-result-description-font,var(--td-font-body-medium,28rpx / 44rpx var(--td-font-family,PingFang SC,Microsoft YaHei,Arial Regular)));}
.t-result__title+.t-result__description:not(:empty){margin-top:var(--td-result-description-margin-top,var(--td-spacer,16rpx));}
.t-result--theme-default{color:var(--td-result-icon-default-color,var(--td-brand-color,var(--td-primary-color-7,#0052d9)));}
.t-result--theme-success{color:var(--td-result-icon-success-color,var(--td-success-color,var(--td-success-color-5,#2ba471)));}
diff --git a/miniprogram/miniprogram_npm/tdesign-miniprogram/search/props.js b/miniprogram/miniprogram_npm/tdesign-miniprogram/search/props.js
index 372e8a7..4ce7f9a 100644
--- a/miniprogram/miniprogram_npm/tdesign-miniprogram/search/props.js
+++ b/miniprogram/miniprogram_npm/tdesign-miniprogram/search/props.js
@@ -1 +1 @@
-const props={action:{type:String,value:""},adjustPosition:{type:Boolean,value:!0},alwaysEmbed:{type:Boolean,value:!1},center:{type:Boolean,value:!1},clearTrigger:{type:String,value:"always"},clearable:{type:Boolean,value:!0},confirmHold:{type:Boolean,value:!1},confirmType:{type:String,value:"search"},cursor:{type:Number,value:-1,required:!0},cursorSpacing:{type:Number,value:0},disabled:{type:Boolean,value:!1},focus:{type:Boolean,value:!1},holdKeyboard:{type:Boolean,value:!1},leftIcon:{type:String,value:"search"},maxcharacter:{type:Number},maxlength:{type:Number,value:-1},placeholder:{type:String,value:""},placeholderClass:{type:String,value:"input-placeholder"},placeholderStyle:{type:String,value:"",required:!0},readonly:{type:null,value:void 0},resultList:{type:Array,value:[]},selectionEnd:{type:Number,value:-1},selectionStart:{type:Number,value:-1},shape:{type:String,value:"square"},type:{type:String,value:"text"},value:{type:String,value:""}};export default props;
\ No newline at end of file
+const props={action:{type:String,value:""},adjustPosition:{type:Boolean,value:!0},alwaysEmbed:{type:Boolean,value:!1},center:{type:Boolean,value:!1},clearTrigger:{type:String,value:"always"},clearable:{type:Boolean,value:!0},confirmHold:{type:Boolean,value:!1},confirmType:{type:String,value:"search"},cursor:{type:Number,value:-1,required:!0},cursorColor:{type:String,value:"#0052d9"},cursorSpacing:{type:Number,value:0},disabled:{type:Boolean,value:!1},focus:{type:Boolean,value:!1},holdKeyboard:{type:Boolean,value:!1},leftIcon:{type:String,value:"search"},maxcharacter:{type:Number},maxlength:{type:Number,value:-1},placeholder:{type:String,value:""},placeholderClass:{type:String,value:"input-placeholder"},placeholderStyle:{type:String,value:"",required:!0},readonly:{type:null,value:void 0},resultList:{type:Array,value:[]},selectionEnd:{type:Number,value:-1},selectionStart:{type:Number,value:-1},shape:{type:String,value:"square"},type:{type:String,value:"text"},value:{type:String,value:""}};export default props;
\ No newline at end of file
diff --git a/miniprogram/miniprogram_npm/tdesign-miniprogram/search/search.wxml b/miniprogram/miniprogram_npm/tdesign-miniprogram/search/search.wxml
index 5118c56..5771ba4 100644
--- a/miniprogram/miniprogram_npm/tdesign-miniprogram/search/search.wxml
+++ b/miniprogram/miniprogram_npm/tdesign-miniprogram/search/search.wxml
@@ -1 +1 @@
-{{action}}
\ No newline at end of file
+{{action}}
\ No newline at end of file
diff --git a/miniprogram/miniprogram_npm/tdesign-miniprogram/search/search.wxss b/miniprogram/miniprogram_npm/tdesign-miniprogram/search/search.wxss
index 5b69177..d8c916c 100644
--- a/miniprogram/miniprogram_npm/tdesign-miniprogram/search/search.wxss
+++ b/miniprogram/miniprogram_npm/tdesign-miniprogram/search/search.wxss
@@ -5,11 +5,11 @@
.t-search__input-box--round{border-radius:calc(var(--td-search-height,80rpx)/ 2);}
.t-search__input-box--square{border-radius:var(--td-search-square-radius,var(--td-radius-default,12rpx));}
.t-search__input-box--center{text-align:center;}
-.t-search__input-box .t-input__keyword{display:inline-block;flex:1;color:var(--td-search-text-color,var(--td-text-color-primary,var(--td-font-gray-1,rgba(0,0,0,.9))));font-size:var(--td-search-font-size,var(--td-font-size-m,32rpx));padding-left:10rpx;min-height:48rpx;line-height:48rpx;}
+.t-search__input-box .t-input__keyword{display:inline-block;flex:1;color:var(--td-search-text-color,var(--td-text-color-primary,var(--td-font-gray-1,rgba(0,0,0,.9))));font:var(--td-search-font,var(--td-font-body-large,32rpx / 48rpx var(--td-font-family,PingFang SC,Microsoft YaHei,Arial Regular)));padding-left:10rpx;min-height:48rpx;}
.t-search__input-box .t-input--disabled{color:var(--td-search-disabled-text-color,var(--td-text-color-disabled,var(--td-font-gray-4,rgba(0,0,0,.26))));cursor:not-allowed;opacity:1;-webkit-text-fill-color:currentColor;}
-.t-search__input-box .t-icon{color:var(--td-search-icon-color,var(--td-text-color-placeholder,var(--td-font-gray-3,rgba(0,0,0,.4))));font-size:var(--td-search-icon-font-size,48rpx);}
-.t-search__clear{position:relative;margin-left:10px;font-size:var(--td-search-clear-icon-font-size,48rpx);color:var(--td-search-clear-icon-color,var(--td-text-color-placeholder,var(--td-font-gray-3,rgba(0,0,0,.4))));}
-.t-search__search-action{margin-left:30rpx;font-size:var(--td-search-font-size,var(--td-font-size-m,32rpx));color:var(--td-search-action-color,var(--td-brand-color,var(--td-primary-color-7,#0052d9)));}
+.t-search__input-box .t-icon{color:var(--td-search-icon-color,var(--td-text-color-placeholder,var(--td-font-gray-3,rgba(0,0,0,.4))));font-size:var(--td-search-icon-size,48rpx);}
+.t-search__clear{position:relative;margin-left:10px;font-size:var(--td-search-clear-icon-size,48rpx);color:var(--td-search-clear-icon-color,var(--td-text-color-placeholder,var(--td-font-gray-3,rgba(0,0,0,.4))));}
+.t-search__search-action{margin-left:30rpx;font:var(--td-search-font,var(--td-font-body-large,32rpx / 48rpx var(--td-font-family,PingFang SC,Microsoft YaHei,Arial Regular)));color:var(--td-search-action-color,var(--td-brand-color,var(--td-primary-color-7,#0052d9)));}
.t-search__placeholder{color:var(--td-search-placeholder-color,var(--td-text-color-placeholder,var(--td-font-gray-3,rgba(0,0,0,.4))));}
.t-search__placeholder--center{text-align:center;}
.t-search__result-item--highLight{color:var(--td-search-result-high-light-color,var(--td-brand-color,var(--td-primary-color-7,#0052d9)));}
diff --git a/miniprogram/miniprogram_npm/tdesign-miniprogram/search/type.d.ts b/miniprogram/miniprogram_npm/tdesign-miniprogram/search/type.d.ts
index c7f2370..7b589d0 100644
--- a/miniprogram/miniprogram_npm/tdesign-miniprogram/search/type.d.ts
+++ b/miniprogram/miniprogram_npm/tdesign-miniprogram/search/type.d.ts
@@ -36,6 +36,10 @@ export interface TdSearchProps {
value?: number;
required?: boolean;
};
+ cursorColor?: {
+ type: StringConstructor;
+ value?: string;
+ };
cursorSpacing?: {
type: NumberConstructor;
value?: number;
diff --git a/miniprogram/miniprogram_npm/tdesign-miniprogram/side-bar-item/side-bar-item.wxss b/miniprogram/miniprogram_npm/tdesign-miniprogram/side-bar-item/side-bar-item.wxss
index a70d937..973c2c6 100644
--- a/miniprogram/miniprogram_npm/tdesign-miniprogram/side-bar-item/side-bar-item.wxss
+++ b/miniprogram/miniprogram_npm/tdesign-miniprogram/side-bar-item/side-bar-item.wxss
@@ -1,4 +1,4 @@
-@import '../common/style/index.wxss';.t-side-bar-item{display:flex;align-items:center;position:relative;padding:32rpx;font-size:var(--td-side-bar-font-size,32rpx);color:var(--td-side-bar-color,var(--td-text-color-primary,var(--td-font-gray-1,rgba(0,0,0,.9))));background:var(--td-side-bar-bg-color,var(--td-bg-color-secondarycontainer,var(--td-gray-color-1,#f3f3f3)));min-height:var(--td-side-bar-item-height,auto);box-sizing:border-box;white-space:wrap;line-height:var(--td-side-bar-item-line-height,48rpx);}
+@import '../common/style/index.wxss';.t-side-bar-item{display:flex;align-items:center;position:relative;padding:32rpx;font:var(--td-side-bar-font,var(--td-font-body-large,32rpx / 48rpx var(--td-font-family,PingFang SC,Microsoft YaHei,Arial Regular)));color:var(--td-side-bar-color,var(--td-text-color-primary,var(--td-font-gray-1,rgba(0,0,0,.9))));background:var(--td-side-bar-bg-color,var(--td-bg-color-secondarycontainer,var(--td-gray-color-1,#f3f3f3)));min-height:var(--td-side-bar-item-height,auto);box-sizing:border-box;white-space:wrap;}
.t-side-bar-item--active{font-weight:600;background:var(--td-bg-color-container,var(--td-font-white-1,#fff));color:var(--td-side-bar-active-color,var(--td-brand-color,var(--td-primary-color-7,#0052d9)));--td-badge-content-text-color:var(--td-side-bar-active-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)));}
.t-side-bar-item__icon{font-size:var(--td-side-bar-icon-size,40rpx);margin-right:4rpx;}
.t-side-bar-item__prefix,.t-side-bar-item__suffix{z-index:1;position:absolute;right:0;width:100%;height:calc(var(--td-side-bar-border-radius,18rpx) * 2);background:var(--td-bg-color-container,var(--td-font-white-1,#fff));pointer-events:none;}
diff --git a/miniprogram/miniprogram_npm/tdesign-miniprogram/skeleton/skeleton.js b/miniprogram/miniprogram_npm/tdesign-miniprogram/skeleton/skeleton.js
index fdcd2b2..a9ae0ca 100644
--- a/miniprogram/miniprogram_npm/tdesign-miniprogram/skeleton/skeleton.js
+++ b/miniprogram/miniprogram_npm/tdesign-miniprogram/skeleton/skeleton.js
@@ -1 +1 @@
-import{__decorate}from"tslib";import{SuperComponent,wxComponent}from"../common/src/index";import config from"../common/config";import props from"./props";import{classNames}from"../common/utils";import{isNumber}from"../common/validator";const{prefix:prefix}=config,name=`${prefix}-skeleton`,ThemeMap={avatar:[{type:"circle",size:"96rpx"}],image:[{type:"rect",size:"144rpx"}],text:[[{width:"24%",height:"32rpx",marginRight:"32rpx"},{width:"76%",height:"32rpx"}],1],paragraph:[1,1,1,{width:"55%"}]};let Skeleton=class extends SuperComponent{constructor(){super(...arguments),this.externalClasses=[`${prefix}-class`,`${prefix}-class-col`,`${prefix}-class-row`],this.properties=props,this.timer=void 0,this.data={prefix:prefix,classPrefix:name,parsedRowCols:[]},this.observers={rowCol(){this.init()},"loading, delay"(){this.isShowSkeleton()}},this.lifetimes={attached(){this.init(),this.isShowSkeleton()},detached(){this.clearTimer()}},this.methods={init(){const{theme:e,rowCol:t}=this.properties,s=[];t.length?s.push(...t):s.push(...ThemeMap[e||"text"]);const i=s.map(e=>{if(isNumber(e))return new Array(e).fill({class:this.getColItemClass({type:"text"}),style:{}});if(Array.isArray(e))return e.map(e=>Object.assign(Object.assign({},e),{class:this.getColItemClass(e),style:this.getColItemStyle(e)}));const t=e;return[Object.assign(Object.assign({},t),{class:this.getColItemClass(t),style:this.getColItemStyle(t)})]});this.setData({parsedRowCols:i})},getColItemClass(e){return classNames([`${name}__col`,`${name}--type-${e.type||"text"}`,`${name}--animation-${this.properties.animation}`])},getColItemStyle(e){const t={};return["width","height","marginRight","marginLeft","margin","size","background","backgroundColor","borderRadius"].forEach(s=>{if(s in e){const i=isNumber(e[s])?`${e[s]}px`:e[s];"size"===s?[t.width,t.height]=[i,i]:t[s]=i}}),t},clearTimer(){this.timer&&(clearTimeout(this.timer),this.timer=null)},isShowSkeleton(){this.clearTimer();const{loading:e,delay:t}=this.properties;e&&0!==t?this.timer=setTimeout(()=>{this.setData({isShow:this.properties.loading})},t):this.setData({isShow:e})}}}};Skeleton=__decorate([wxComponent()],Skeleton);export default Skeleton;
\ No newline at end of file
+import{__decorate}from"tslib";import{SuperComponent,wxComponent}from"../common/src/index";import config from"../common/config";import props from"./props";import{classNames}from"../common/utils";import{isInteger,isNumeric}from"../common/validator";const{prefix:prefix}=config,name=`${prefix}-skeleton`,ThemeMap={avatar:[{type:"circle",size:"96rpx"}],image:[{type:"rect",size:"144rpx"}],text:[[{width:"24%",height:"32rpx",marginRight:"32rpx"},{width:"76%",height:"32rpx"}],1],paragraph:[1,1,1,{width:"55%"}]};let Skeleton=class extends SuperComponent{constructor(){super(...arguments),this.externalClasses=[`${prefix}-class`,`${prefix}-class-col`,`${prefix}-class-row`],this.properties=props,this.timer=void 0,this.data={prefix:prefix,classPrefix:name,parsedRowCols:[]},this.observers={rowCol(){this.init()},"loading, delay"(){this.isShowSkeleton()}},this.lifetimes={attached(){this.init(),this.isShowSkeleton()},detached(){this.clearTimer()}},this.methods={init(){const{theme:e,rowCol:t}=this.properties,i=[];t.length?i.push(...t):i.push(...ThemeMap[e||"text"]);const s=i.map(e=>{if(isInteger(e)&&e>=0)return new Array(e).fill({class:this.getColItemClass({type:"text"}),style:{}});if(Array.isArray(e))return e.map(e=>Object.assign(Object.assign({},e),{class:this.getColItemClass(e),style:this.getColItemStyle(e)}));const t=e;return[Object.assign(Object.assign({},t),{class:this.getColItemClass(t),style:this.getColItemStyle(t)})]});this.setData({parsedRowCols:s})},getColItemClass(e){return classNames([`${name}__col`,`${name}--type-${e.type||"text"}`,`${name}--animation-${this.properties.animation}`])},getColItemStyle(e){const t={};return["width","height","marginRight","marginLeft","margin","size","background","backgroundColor","borderRadius"].forEach(i=>{if(i in e){const s=isNumeric(e[i])?`${e[i]}px`:e[i];"size"===i?[t.width,t.height]=[s,s]:t[i]=s}}),t},clearTimer(){this.timer&&(clearTimeout(this.timer),this.timer=null)},isShowSkeleton(){this.clearTimer();const{loading:e,delay:t}=this.properties;e&&0!==t?this.timer=setTimeout(()=>{this.setData({isShow:this.properties.loading})},t):this.setData({isShow:e})}}}};Skeleton=__decorate([wxComponent()],Skeleton);export default Skeleton;
\ No newline at end of file
diff --git a/miniprogram/miniprogram_npm/tdesign-miniprogram/slider/slider.wxss b/miniprogram/miniprogram_npm/tdesign-miniprogram/slider/slider.wxss
index 23067f0..5a95460 100644
--- a/miniprogram/miniprogram_npm/tdesign-miniprogram/slider/slider.wxss
+++ b/miniprogram/miniprogram_npm/tdesign-miniprogram/slider/slider.wxss
@@ -1,4 +1,4 @@
-@import '../common/style/index.wxss';.t-slider{width:100%;font-size:14px;display:flex;align-items:center;}
+@import '../common/style/index.wxss';.t-slider{width:100%;font:var(--td-font-body-medium,28rpx / 44rpx var(--td-font-family,PingFang SC,Microsoft YaHei,Arial Regular));display:flex;align-items:center;}
.t-slider--disabled .t-slider__dot-value,.t-slider--disabled .t-slider__range-extreme,.t-slider--disabled .t-slider__scale-desc,.t-slider--disabled .t-slider__value{color:var(--td-slider-disabled-text-color,var(--td-text-color-disabled,var(--td-font-gray-4,rgba(0,0,0,.26))));}
.t-slider--disabled .t-slider__dot{background-color:var(--td-slider-dot-disabled-bg-color,#fff);border-color:var(--td-slider-dot-disabled-border-color,#f3f3f3);}
.t-slider--top{padding-top:40rpx;}
@@ -8,7 +8,7 @@
.t-slider__line--capsule.t-slider__line--single{border-top-left-radius:calc(var(--td-slider-capsule-line-heihgt,36rpx)/ 2);border-bottom-left-radius:calc(var(--td-slider-capsule-line-heihgt,36rpx)/ 2);}
.t-slider__dot{border-radius:50%;border:2rpx solid var(--td-slider-dot-color,var(--td-component-border,var(--td-gray-color-4,#dcdcdc)));position:absolute;top:50%;right:0;transform:translate3d(50%,-50%,0);z-index:2;background-color:var(--td-slider-dot-bg-color,#fff);width:var(--td-slider-dot-size,40rpx);height:var(--td-slider-dot-size,40rpx);box-shadow:var(--td-shadow-1,0 1px 10px rgba(0,0,0,.05),0 4px 5px rgba(0,0,0,.08),0 2px 4px -1px rgba(0,0,0,.12));box-sizing:border-box;}
.t-slider__dot--left{left:0;transform:translate3d(-50%,-50%,0);}
-.t-slider__dot-value{position:relative;left:50%;transform:translateX(-50%);top:-52rpx;text-align:center;width:96rpx;height:44rpx;line-height:44rpx;}
+.t-slider__dot-value{position:relative;left:50%;transform:translateX(-50%);top:-52rpx;text-align:center;width:96rpx;height:44rpx;}
.t-slider__dot-value,.t-slider__range-extreme,.t-slider__value{color:var(--td-slider-text-color,var(--td-text-color-primary,var(--td-font-gray-1,rgba(0,0,0,.9))));}
.t-slider__dot-value--sr-only,.t-slider__range-extreme--sr-only,.t-slider__value--sr-only{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;clip-path:inset(50%);border:0;}
.t-slider__dot-slider{width:100%;height:100%;position:absolute;left:0;top:0;}
diff --git a/miniprogram/miniprogram_npm/tdesign-miniprogram/step-item/step-item.wxss b/miniprogram/miniprogram_npm/tdesign-miniprogram/step-item/step-item.wxss
index 3f8ac92..66f83bb 100644
--- a/miniprogram/miniprogram_npm/tdesign-miniprogram/step-item/step-item.wxss
+++ b/miniprogram/miniprogram_npm/tdesign-miniprogram/step-item/step-item.wxss
@@ -19,18 +19,18 @@
.t-steps-item--vertical{margin-bottom:16rpx;}
.t-steps-item__anchor{display:flex;align-items:center;justify-content:center;}
.t-steps-item__anchor--vertical{width:var(--td-step-item-circle-size,44rpx);height:var(--td-step-item-circle-size,44rpx);}
-.t-steps-item__circle{display:flex;justify-content:center;align-items:center;width:var(--td-step-item-circle-size,44rpx);height:var(--td-step-item-circle-size,44rpx);text-align:center;border-radius:50%;font-size:var(--td-step-item-circle-font-size,28rpx);}
+.t-steps-item__circle{display:flex;justify-content:center;align-items:center;width:var(--td-step-item-circle-size,44rpx);height:var(--td-step-item-circle-size,44rpx);text-align:center;border-radius:50%;font:var(--td-step-item-circle-text-font,var(--td-font-body-medium,28rpx / 44rpx var(--td-font-family,PingFang SC,Microsoft YaHei,Arial Regular)));}
.t-steps-item__icon{z-index:1;vertical-align:top;font-size:var(--td-font-size-base,28rpx);position:relative;}
.t-steps-item__dot{width:var(--td-step-item-dot-size,16rpx);height:var(--td-step-item-dot-size,16rpx);border-radius:50%;border-width:1px;border-style:solid;box-sizing:border-box;}
.t-steps-item__content{text-align:center;}
.t-steps-item__content--horizontal{max-width:80px;margin-top:16rpx;}
.t-steps-item__content--vertical{margin-left:16rpx;flex:1;padding-bottom:32rpx;}
.t-steps-item__content--vertical.t-steps-item__content--last{padding-bottom:0;}
-.t-steps-item__title{position:relative;line-height:var(--td-step-item-circle-size,44rpx);font-size:var(--td-font-size-base,28rpx);}
+.t-steps-item__title{position:relative;font:var(--td-font-body-medium,28rpx / 44rpx var(--td-font-family,PingFang SC,Microsoft YaHei,Arial Regular));}
.t-steps-item__title--process{font-weight:600;}
.t-steps-item__title--vertical{text-align:left;display:flex;align-items:center;justify-content:space-between;}
.t-steps-item__title+.t-steps-item__description:not(:empty){margin-top:8rpx;}
-.t-steps-item__description{color:var(--td-step-item-description-color,var(--td-text-color-placeholder,var(--td-font-gray-3,rgba(0,0,0,.4))));line-height:40rpx;font-size:var(--td-font-size-s,24rpx);}
+.t-steps-item__description{color:var(--td-step-item-description-color,var(--td-text-color-placeholder,var(--td-font-gray-3,rgba(0,0,0,.4))));font:var(--td-font-body-small,24rpx / 40rpx var(--td-font-family,PingFang SC,Microsoft YaHei,Arial Regular));}
.t-steps-item__description--vertical{text-align:left;}
.t-steps-item__extra:not(:empty){margin-top:16rpx;}
.t-steps-item__line{background-color:var(--td-step-item-line-color,var(--td-component-border,var(--td-gray-color-4,#dcdcdc)));content:'';display:block;position:absolute;}
diff --git a/miniprogram/miniprogram_npm/tdesign-miniprogram/swipe-cell/swipe-cell.wxss b/miniprogram/miniprogram_npm/tdesign-miniprogram/swipe-cell/swipe-cell.wxss
index 5698bf7..51d2b9a 100644
--- a/miniprogram/miniprogram_npm/tdesign-miniprogram/swipe-cell/swipe-cell.wxss
+++ b/miniprogram/miniprogram_npm/tdesign-miniprogram/swipe-cell/swipe-cell.wxss
@@ -4,4 +4,4 @@
.t-swipe-cell__right{right:0;transform:translate3d(100%,0,0);}
.t-swipe-cell__content{display:inline-flex;justify-content:center;align-items:center;padding:0 var(--td-spacer-2,32rpx);}
.t-swipe-cell__icon{font-size:var(--td-font-size-xl,40rpx);}
-.t-swipe-cell__icon+.t-swipe-cell__text:not(:empty){margin-left:var(--td-spacer,16rpx);font-size:var(--td-font-size-base,28rpx);line-height:44rpx;}
\ No newline at end of file
+.t-swipe-cell__icon+.t-swipe-cell__text:not(:empty){margin-left:var(--td-spacer,16rpx);font:var(--td-font-body-medium,28rpx / 44rpx var(--td-font-family,PingFang SC,Microsoft YaHei,Arial Regular));}
\ No newline at end of file
diff --git a/miniprogram/miniprogram_npm/tdesign-miniprogram/swiper-nav/swiper-nav.wxss b/miniprogram/miniprogram_npm/tdesign-miniprogram/swiper-nav/swiper-nav.wxss
index 8eb8745..724b078 100644
--- a/miniprogram/miniprogram_npm/tdesign-miniprogram/swiper-nav/swiper-nav.wxss
+++ b/miniprogram/miniprogram_npm/tdesign-miniprogram/swiper-nav/swiper-nav.wxss
@@ -13,7 +13,7 @@
.t-swiper-nav--bottom{position:absolute;left:50%;bottom:24rpx;transform:translateX(-50%);}
.t-swiper-nav--bottom-right{position:absolute;right:24rpx;bottom:24rpx;}
.t-swiper-nav--vertical{flex-direction:column;}
-.t-swiper-nav__fraction{padding:0 16rpx;height:var(--td-swiper-nav-fraction-height,48rpx);line-height:var(--td-swiper-nav-fraction-height,48rpx);border-radius:calc(var(--td-swiper-nav-fraction-height,48rpx)/ 2);background:var(--td-swiper-nav-fraction-bg-color,var(--td-font-gray-3,rgba(0,0,0,.4)));color:var(--td-swiper-nav-fraction-color,var(--td-text-color-anti,var(--td-font-white-1,#fff)));font-size:var(--td-swiper-nav-fraction-font-size,24rpx);}
+.t-swiper-nav__fraction{padding:0 16rpx;height:var(--td-swiper-nav-fraction-height,48rpx);border-radius:calc(var(--td-swiper-nav-fraction-height,48rpx)/ 2);background:var(--td-swiper-nav-fraction-bg-color,var(--td-font-gray-3,rgba(0,0,0,.4)));color:var(--td-swiper-nav-fraction-color,var(--td-text-color-anti,var(--td-font-white-1,#fff)));font:var(--td-swiper-nav-fraction-font,var(--td-font-body-small,24rpx / 40rpx var(--td-font-family,PingFang SC,Microsoft YaHei,Arial Regular)));}
.t-swiper-nav__btn{width:100%;position:absolute;top:50%;transform:translateY(-50%);}
.t-swiper-nav__btn--next,.t-swiper-nav__btn--prev{position:absolute;top:50%;transform:translateY(-50%);width:var(--td-swiper-nav-btn-size,48rpx);height:var(--td-swiper-nav-btn-size,48rpx);border-radius:50%;background:var(--td-swiper-nav-btn-bg-color,var(--td-font-gray-3,rgba(0,0,0,.4)));}
.t-swiper-nav__btn--next::after,.t-swiper-nav__btn--prev::after{position:absolute;left:50%;top:50%;display:block;content:'';width:12rpx;height:12rpx;border-color:var(--td-swiper-nav-btn-color,var(--td-text-color-anti,var(--td-font-white-1,#fff)));border-style:solid;}
diff --git a/miniprogram/miniprogram_npm/tdesign-miniprogram/tab-bar-item/tab-bar-item.wxml b/miniprogram/miniprogram_npm/tdesign-miniprogram/tab-bar-item/tab-bar-item.wxml
index 6c9715d..68340cf 100644
--- a/miniprogram/miniprogram_npm/tdesign-miniprogram/tab-bar-item/tab-bar-item.wxml
+++ b/miniprogram/miniprogram_npm/tdesign-miniprogram/tab-bar-item/tab-bar-item.wxml
@@ -1 +1 @@
-{{ child.label }}
\ No newline at end of file
+{{ child.label }}
\ No newline at end of file
diff --git a/miniprogram/miniprogram_npm/tdesign-miniprogram/tab-bar-item/tab-bar-item.wxss b/miniprogram/miniprogram_npm/tdesign-miniprogram/tab-bar-item/tab-bar-item.wxss
index 2786739..6869105 100644
--- a/miniprogram/miniprogram_npm/tdesign-miniprogram/tab-bar-item/tab-bar-item.wxss
+++ b/miniprogram/miniprogram_npm/tdesign-miniprogram/tab-bar-item/tab-bar-item.wxss
@@ -1,17 +1,16 @@
@import '../common/style/index.wxss';:host{flex:1;}
.t-tab-bar-item{flex:1;height:var(--td-tab-bar-height,80rpx);box-sizing:border-box;user-select:none;position:relative;margin:16rpx 0;padding:0 24rpx;}
-.t-tab-bar-item--text-only{font-size:32rpx;}
.t-tab-bar-item--split+.t-tab-bar-item--split::before{position:absolute;box-sizing:border-box;content:' ';pointer-events:none;top:0;bottom:0;left:0;border-left:1px solid var(--td-tab-bar-border-color,var(--td-border-color,var(--td-gray-color-3,#e7e7e7)));transform:scaleX(.5);top:16rpx;bottom:16rpx;}
.t-tab-bar-item--crowded{padding:0 16rpx;}
.t-tab-bar-item--round{border-radius:99px;}
.t-tab-bar-item__content{width:100%;height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;border-radius:16rpx;color:var(--td-tab-bar-color,var(--td-text-color-primary,var(--td-font-gray-1,rgba(0,0,0,.9))));}
-.t-tab-bar-item__content--checked{color:var(--td-tab-bar-active-color,var(--td-brand-color,var(--td-primary-color-7,#0052d9)));font-weight:600;}
+.t-tab-bar-item__content--checked .t-tab-bar-item__icon,.t-tab-bar-item__content--checked .t-tab-bar-item__text{color:var(--td-tab-bar-active-color,var(--td-brand-color,var(--td-primary-color-7,#0052d9)));font-weight:600;}
.t-tab-bar-item__content--tag{border-radius:99px;}
.t-tab-bar-item__content--tag.t-tab-bar-item__content--checked{background-color:var(--td-tab-bar-active-bg,var(--td-brand-color-light,var(--td-primary-color-1,#f2f3ff)));}
.t-tab-bar-item__icon{display:contents;}
.t-tab-bar-item__icon:empty{display:none;}
-.t-tab-bar-item__text{display:flex;align-items:center;}
-.t-tab-bar-item__text--small{font-size:20rpx;line-height:32rpx;}
+.t-tab-bar-item__text{display:flex;align-items:center;font:var(--td-font-body-large,32rpx / 48rpx var(--td-font-family,PingFang SC,Microsoft YaHei,Arial Regular));}
+.t-tab-bar-item__text--small{font:var(--td-font-body-extraSmall,20rpx / 32rpx var(--td-font-family,PingFang SC,Microsoft YaHei,Arial Regular));}
.t-tab-bar-item__icon-menu{margin-right:8rpx;}
.t-tab-bar-item__spread{position:absolute;top:0;left:7%;width:86%;background-color:var(--td-tab-bar-bg-color,var(--td-bg-color-container,var(--td-font-white-1,#fff)));transform:translate3d(0,calc(-100% - 32rpx),0);z-index:1;border-radius:12rpx;color:var(--td-tab-bar-color,var(--td-text-color-primary,var(--td-font-gray-1,rgba(0,0,0,.9))));box-shadow:var(--td-tab-bar-spread-shadow,var(--td-shadow-3,0 6px 30px 5px rgba(0,0,0,.05),0 16px 24px 2px rgba(0,0,0,.04),0 8px 10px -5px rgba(0,0,0,.08)));}
.t-tab-bar-item__spread::before{display:block;content:'';position:absolute;bottom:0;left:50%;width:0;height:0;border:16rpx solid transparent;border-top:16rpx solid var(--td-tab-bar-bg-color,var(--td-bg-color-container,var(--td-font-white-1,#fff)));transform:translate3d(-50%,32rpx,0);}
diff --git a/miniprogram/miniprogram_npm/tdesign-miniprogram/tab-bar/props.js b/miniprogram/miniprogram_npm/tdesign-miniprogram/tab-bar/props.js
index 0a883f5..ab00ffc 100644
--- a/miniprogram/miniprogram_npm/tdesign-miniprogram/tab-bar/props.js
+++ b/miniprogram/miniprogram_npm/tdesign-miniprogram/tab-bar/props.js
@@ -1 +1 @@
-const props={bordered:{type:Boolean,value:!0},fixed:{type:Boolean,value:!0},safeAreaInsetBottom:{type:Boolean,value:!0},shape:{type:String,value:"normal"},split:{type:Boolean,value:!0},theme:{type:String,value:"normal"},value:{type:null,value:null},defaultValue:{type:null}};export default props;
\ No newline at end of file
+const props={bordered:{type:Boolean,value:!0},fixed:{type:Boolean,value:!0},placeholder:{type:Boolean,value:!1},safeAreaInsetBottom:{type:Boolean,value:!0},shape:{type:String,value:"normal"},split:{type:Boolean,value:!0},theme:{type:String,value:"normal"},value:{type:null,value:null},defaultValue:{type:null},zIndex:{type:Number,value:1}};export default props;
\ No newline at end of file
diff --git a/miniprogram/miniprogram_npm/tdesign-miniprogram/tab-bar/tab-bar.d.ts b/miniprogram/miniprogram_npm/tdesign-miniprogram/tab-bar/tab-bar.d.ts
index 13e2da6..f357e4e 100644
--- a/miniprogram/miniprogram_npm/tdesign-miniprogram/tab-bar/tab-bar.d.ts
+++ b/miniprogram/miniprogram_npm/tdesign-miniprogram/tab-bar/tab-bar.d.ts
@@ -6,6 +6,7 @@ export default class Tabbar extends SuperComponent {
data: {
prefix: string;
classPrefix: string;
+ placeholderHeight: number;
};
properties: import("./type").TdTabBarProps;
controlledProps: {
@@ -14,11 +15,13 @@ export default class Tabbar extends SuperComponent {
}[];
observers: {
value(): void;
+ 'fixed, placeholder'(): void;
};
lifetimes: {
ready(): void;
};
methods: {
+ setPlaceholderHeight(): void;
showChildren(): void;
updateChildren(): void;
updateValue(value: any): void;
diff --git a/miniprogram/miniprogram_npm/tdesign-miniprogram/tab-bar/tab-bar.js b/miniprogram/miniprogram_npm/tdesign-miniprogram/tab-bar/tab-bar.js
index 4985b5b..59a5fef 100644
--- a/miniprogram/miniprogram_npm/tdesign-miniprogram/tab-bar/tab-bar.js
+++ b/miniprogram/miniprogram_npm/tdesign-miniprogram/tab-bar/tab-bar.js
@@ -1 +1 @@
-import{__decorate}from"tslib";import{wxComponent,SuperComponent}from"../common/src/index";import config from"../common/config";import props from"./props";const{prefix:prefix}=config,classPrefix=`${prefix}-tab-bar`;let Tabbar=class extends SuperComponent{constructor(){super(...arguments),this.relations={"../tab-bar-item/tab-bar-item":{type:"descendant"}},this.externalClasses=[`${prefix}-class`],this.backupValue=-1,this.data={prefix:prefix,classPrefix:classPrefix},this.properties=props,this.controlledProps=[{key:"value",event:"change"}],this.observers={value(){this.updateChildren()}},this.lifetimes={ready(){this.showChildren()}},this.methods={showChildren(){const{value:e}=this.data;this.$children.forEach(r=>{r.setData({crowded:this.$children.length>3}),r.properties.value===e&&r.showSpread()})},updateChildren(){const{value:e}=this.data;this.$children.forEach(r=>{r.checkActive(e)})},updateValue(e){this._trigger("change",{value:e})},changeOtherSpread(e){this.$children.forEach(r=>{r.properties.value!==e&&r.closeSpread()})},initName(){return this.backupValue+=1}}}};Tabbar=__decorate([wxComponent()],Tabbar);export default Tabbar;
\ No newline at end of file
+import{__decorate}from"tslib";import{wxComponent,SuperComponent}from"../common/src/index";import config from"../common/config";import props from"./props";import{getRect}from"../common/utils";const{prefix:prefix}=config,classPrefix=`${prefix}-tab-bar`;let Tabbar=class extends SuperComponent{constructor(){super(...arguments),this.relations={"../tab-bar-item/tab-bar-item":{type:"descendant"}},this.externalClasses=[`${prefix}-class`],this.backupValue=-1,this.data={prefix:prefix,classPrefix:classPrefix,placeholderHeight:56},this.properties=props,this.controlledProps=[{key:"value",event:"change"}],this.observers={value(){this.updateChildren()},"fixed, placeholder"(){this.setPlaceholderHeight()}},this.lifetimes={ready(){this.showChildren()}},this.methods={setPlaceholderHeight(){this.properties.fixed&&this.properties.placeholder&&wx.nextTick(()=>{getRect(this,`.${classPrefix}`).then(e=>{this.setData({placeholderHeight:e.height})})})},showChildren(){const{value:e}=this.data;this.$children.forEach(t=>{t.setData({crowded:this.$children.length>3}),t.properties.value===e&&t.showSpread()})},updateChildren(){const{value:e}=this.data;this.$children.forEach(t=>{t.checkActive(e)})},updateValue(e){this._trigger("change",{value:e})},changeOtherSpread(e){this.$children.forEach(t=>{t.properties.value!==e&&t.closeSpread()})},initName(){return this.backupValue+=1}}}};Tabbar=__decorate([wxComponent()],Tabbar);export default Tabbar;
\ No newline at end of file
diff --git a/miniprogram/miniprogram_npm/tdesign-miniprogram/tab-bar/tab-bar.wxml b/miniprogram/miniprogram_npm/tdesign-miniprogram/tab-bar/tab-bar.wxml
index 0f9e9c0..ee18503 100644
--- a/miniprogram/miniprogram_npm/tdesign-miniprogram/tab-bar/tab-bar.wxml
+++ b/miniprogram/miniprogram_npm/tdesign-miniprogram/tab-bar/tab-bar.wxml
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/miniprogram/miniprogram_npm/tdesign-miniprogram/tab-bar/tab-bar.wxss b/miniprogram/miniprogram_npm/tdesign-miniprogram/tab-bar/tab-bar.wxss
index 2833f31..2d750f5 100644
--- a/miniprogram/miniprogram_npm/tdesign-miniprogram/tab-bar/tab-bar.wxss
+++ b/miniprogram/miniprogram_npm/tdesign-miniprogram/tab-bar/tab-bar.wxss
@@ -1,4 +1,4 @@
-@import '../common/style/index.wxss';.t-tab-bar{display:flex;flex-wrap:nowrap;align-items:center;position:relative;font-size:16px;background-color:var(--td-tab-bar-bg-color,var(--td-bg-color-container,var(--td-font-white-1,#fff)));box-sizing:border-box;pointer-events:auto;}
+@import '../common/style/index.wxss';.t-tab-bar{display:flex;flex-wrap:nowrap;align-items:center;position:relative;background-color:var(--td-tab-bar-bg-color,var(--td-bg-color-container,var(--td-font-white-1,#fff)));box-sizing:border-box;pointer-events:auto;}
.t-tab-bar--normal.t-tab-bar--border::before{z-index:1;position:absolute;box-sizing:border-box;content:' ';pointer-events:none;right:0;left:0;top:0;border-top:1px solid var(--td-tab-bar-border-color,var(--td-border-level-1-color,var(--td-gray-color-3,#e7e7e7)));transform:scaleY(.5);transform-origin:0 0;}
.t-tab-bar--fixed{position:fixed;left:0;bottom:0;right:0;}
.t-tab-bar--normal.t-tab-bar--safe{padding-bottom:constant(safe-area-inset-bottom);padding-bottom:env(safe-area-inset-bottom);}
diff --git a/miniprogram/miniprogram_npm/tdesign-miniprogram/tab-bar/type.d.ts b/miniprogram/miniprogram_npm/tdesign-miniprogram/tab-bar/type.d.ts
index 58ec2d5..ddda67c 100644
--- a/miniprogram/miniprogram_npm/tdesign-miniprogram/tab-bar/type.d.ts
+++ b/miniprogram/miniprogram_npm/tdesign-miniprogram/tab-bar/type.d.ts
@@ -7,6 +7,10 @@ export interface TdTabBarProps {
type: BooleanConstructor;
value?: boolean;
};
+ placeholder?: {
+ type: BooleanConstructor;
+ value?: boolean;
+ };
safeAreaInsetBottom?: {
type: BooleanConstructor;
value?: boolean;
@@ -31,4 +35,8 @@ export interface TdTabBarProps {
type: null;
value?: string | number | Array;
};
+ zIndex?: {
+ type: NumberConstructor;
+ value?: number;
+ };
}
diff --git a/miniprogram/miniprogram_npm/tdesign-miniprogram/tab-panel/tab-panel.wxml b/miniprogram/miniprogram_npm/tdesign-miniprogram/tab-panel/tab-panel.wxml
index d8acb0b..2b95c7d 100644
--- a/miniprogram/miniprogram_npm/tdesign-miniprogram/tab-panel/tab-panel.wxml
+++ b/miniprogram/miniprogram_npm/tdesign-miniprogram/tab-panel/tab-panel.wxml
@@ -1 +1 @@
-{{panel}}
\ No newline at end of file
+{{panel}}
\ No newline at end of file
diff --git a/miniprogram/miniprogram_npm/tdesign-miniprogram/tabs/tabs.wxss b/miniprogram/miniprogram_npm/tdesign-miniprogram/tabs/tabs.wxss
index b0211c1..c38a07c 100644
--- a/miniprogram/miniprogram_npm/tdesign-miniprogram/tabs/tabs.wxss
+++ b/miniprogram/miniprogram_npm/tdesign-miniprogram/tabs/tabs.wxss
@@ -1,4 +1,4 @@
-@import '../common/style/index.wxss';.t-tabs{position:relative;font-size:var(--td-tab-font-size,28rpx);background:var(--td-tab-nav-bg-color,var(--td-bg-color-container,var(--td-font-white-1,#fff)));flex-wrap:wrap;}
+@import '../common/style/index.wxss';.t-tabs{position:relative;font:var(--td-tab-font,var(--td-font-body-medium,28rpx / 44rpx var(--td-font-family,PingFang SC,Microsoft YaHei,Arial Regular)));background:var(--td-tab-nav-bg-color,var(--td-bg-color-container,var(--td-font-white-1,#fff)));flex-wrap:wrap;}
.t-tabs__wrapper{display:flex;overflow:hidden;background:var(--td-tab-nav-bg-color,var(--td-bg-color-container,var(--td-font-white-1,#fff)));}
.t-tabs__wrapper--card{background:var(--td-tab-item-tag-bg,var(--td-bg-color-secondarycontainer,var(--td-gray-color-1,#f3f3f3)));--td-tab-border-color:transparent;}
.t-tabs__item{position:relative;display:flex;flex:none;align-items:center;justify-content:center;font-weight:400;color:var(--td-tab-item-color,var(--td-text-color-primary,var(--td-font-gray-1,rgba(0,0,0,.9))));padding:0 var(--td-spacer-2,32rpx);box-sizing:border-box;white-space:nowrap;overflow:hidden;height:var(--td-tab-item-height,96rpx);}
diff --git a/miniprogram/miniprogram_npm/tdesign-miniprogram/tag/tag.js b/miniprogram/miniprogram_npm/tdesign-miniprogram/tag/tag.js
index 086df92..3c37f34 100644
--- a/miniprogram/miniprogram_npm/tdesign-miniprogram/tag/tag.js
+++ b/miniprogram/miniprogram_npm/tdesign-miniprogram/tag/tag.js
@@ -1 +1 @@
-import{__decorate}from"tslib";import{wxComponent,SuperComponent}from"../common/src/index";import config from"../common/config";import props from"./props";import{classNames,calcIcon}from"../common/utils";import{isNumber}from"../common/validator";const{prefix:prefix}=config,name=`${prefix}-tag`;let Tag=class extends SuperComponent{constructor(){super(...arguments),this.data={prefix:prefix,classPrefix:name,className:"",tagStyle:""},this.properties=props,this.externalClasses=[`${prefix}-class`],this.options={multipleSlots:!0},this.lifetimes={attached(){this.setClass(),this.setTagStyle()}},this.observers={"size, shape, theme, variant, closable, disabled"(){this.setClass()},maxWidth(){this.setTagStyle()},icon(s){this.setData({_icon:calcIcon(s)})},closable(s){this.setData({_closable:calcIcon(s,"close")})}},this.methods={setClass(){const{prefix:s,classPrefix:t}=this.data,{size:e,shape:a,theme:i,variant:o,closable:l,disabled:r}=this.properties,c=classNames([t,`${t}--${i||"default"}`,`${t}--${o}`,l?`${t}--closable ${s}-is-closable`:"",r?`${t}--disabled ${s}-is-disabled`:"",`${t}--${e}`,`${t}--${a}`]);this.setData({className:c})},setTagStyle(){const{maxWidth:s}=this.properties;if(!s)return"";const t=isNumber(s)?`${s}px`:s;this.setData({tagStyle:`max-width:${t};`})},handleClick(s){this.data.disabled||this.triggerEvent("click",s)},handleClose(s){this.data.disabled||this.triggerEvent("close",s)}}}};Tag=__decorate([wxComponent()],Tag);export default Tag;
\ No newline at end of file
+import{__decorate}from"tslib";import{wxComponent,SuperComponent}from"../common/src/index";import config from"../common/config";import props from"./props";import{classNames,calcIcon}from"../common/utils";import{isNumeric}from"../common/validator";const{prefix:prefix}=config,name=`${prefix}-tag`;let Tag=class extends SuperComponent{constructor(){super(...arguments),this.data={prefix:prefix,classPrefix:name,className:"",tagStyle:""},this.properties=props,this.externalClasses=[`${prefix}-class`],this.options={multipleSlots:!0},this.lifetimes={attached(){this.setClass(),this.setTagStyle()}},this.observers={"size, shape, theme, variant, closable, disabled"(){this.setClass()},maxWidth(){this.setTagStyle()},icon(s){this.setData({_icon:calcIcon(s)})},closable(s){this.setData({_closable:calcIcon(s,"close")})}},this.methods={setClass(){const{prefix:s,classPrefix:t}=this.data,{size:e,shape:a,theme:i,variant:o,closable:l,disabled:r}=this.properties,c=classNames([t,`${t}--${i||"default"}`,`${t}--${o}`,l?`${t}--closable ${s}-is-closable`:"",r?`${t}--disabled ${s}-is-disabled`:"",`${t}--${e}`,`${t}--${a}`]);this.setData({className:c})},setTagStyle(){const{maxWidth:s}=this.properties;if(!s)return"";const t=isNumeric(s)?`${s}px`:s;this.setData({tagStyle:`max-width:${t};`})},handleClick(s){this.data.disabled||this.triggerEvent("click",s)},handleClose(s){this.data.disabled||this.triggerEvent("close",s)}}}};Tag=__decorate([wxComponent()],Tag);export default Tag;
\ No newline at end of file
diff --git a/miniprogram/miniprogram_npm/tdesign-miniprogram/tag/tag.wxss b/miniprogram/miniprogram_npm/tdesign-miniprogram/tag/tag.wxss
index 9a3274b..3381b37 100644
--- a/miniprogram/miniprogram_npm/tdesign-miniprogram/tag/tag.wxss
+++ b/miniprogram/miniprogram_npm/tdesign-miniprogram/tag/tag.wxss
@@ -1,16 +1,16 @@
-@import '../common/style/index.wxss';.t-tag{display:inline-flex;align-items:center;border:2rpx solid transparent;box-sizing:border-box;border-radius:var(--td-tag-square-border-radius,8rpx);font-size:var(--td-tag-medium-font-size,var(--td-font-size-s,24rpx));user-select:none;vertical-align:middle;}
+@import '../common/style/index.wxss';.t-tag{display:inline-flex;align-items:center;border:2rpx solid transparent;box-sizing:border-box;border-radius:var(--td-tag-square-border-radius,8rpx);user-select:none;vertical-align:middle;}
.t-tag__text{word-wrap:normal;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.t-tag__icon,.t-tag__icon-close{display:flex;align-items:center;}
.t-tag__icon-close{color:var(--td-tag-close-icon-color,var(--td-text-color-placeholder,var(--td-font-gray-3,rgba(0,0,0,.4))));}
.t-tag__icon:not(:empty)+.t-tag__text:not(:empty),.t-tag__text:not(:empty)+.t-tag__icon-close:not(:empty){margin-left:8rpx;}
-.t-tag.t-tag--small{height:var(--td-tag-small-height,40rpx);line-height:var(--td-tag-small-height,40rpx);padding:0 var(--td-tag-small-padding,11rpx);font-size:var(--td-tag-small-font-size,var(--td-font-size,20rpx));}
+.t-tag.t-tag--small{padding:var(--td-tag-small-padding,2rpx 10rpx);font:var(--td-tag-small-font,var(--td-font-body-extraSmall,20rpx / 32rpx var(--td-font-family,PingFang SC,Microsoft YaHei,Arial Regular)));}
.t-tag.t-tag--small .t-icon,.t-tag.t-tag--small .t-icon-close{font-size:var(--td-tag-small-icon-size,24rpx);}
.t-tag.t-tag--small .t-tag__icon:not(:empty)+.t-tag__text:not(:empty),.t-tag.t-tag--small .t-tag__text:not(:empty)+.t-tag__icon-close:not(:empty){margin-left:4rpx;}
-.t-tag.t-tag--medium{height:var(--td-tag-medium-height,48rpx);line-height:var(--td-tag-medium-height,48rpx);padding:0 var(--td-tag-medium-padding,15rpx);font-size:var(--td-tag-medium-font-size,var(--td-font-size-s,24rpx));}
+.t-tag.t-tag--medium{padding:var(--td-tag-medium-padding,2rpx 14rpx);font:var(--td-tag-medium-font,var(--td-font-body-small,24rpx / 40rpx var(--td-font-family,PingFang SC,Microsoft YaHei,Arial Regular)));}
.t-tag.t-tag--medium .t-icon,.t-tag.t-tag--medium .t-icon-close{font-size:var(--td-tag-medium-icon-size,28rpx);}
-.t-tag.t-tag--large{height:var(--td-tag-large-height,56rpx);line-height:var(--td-tag-large-height,56rpx);padding:0 var(--td-tag-large-padding,15rpx);font-size:var(--td-tag-large-font-size,var(--td-font-size-base,28rpx));}
+.t-tag.t-tag--large{padding:var(--td-tag-large-padding,4rpx 14rpx);font:var(--td-tag-large-font,var(--td-font-body-medium,28rpx / 44rpx var(--td-font-family,PingFang SC,Microsoft YaHei,Arial Regular)));}
.t-tag.t-tag--large .t-icon,.t-tag.t-tag--large .t-icon-close{font-size:var(--td-tag-large-icon-size,32rpx);}
-.t-tag.t-tag--extra-large{height:var(--td-tag-extra-large-height,80rpx);line-height:var(--td-tag-extra-large-height,80rpx);padding:0 var(--td-tag-extra-large-padding,31rpx);font-size:var(--td-tag-extra-large-font-size,var(--td-font-size-base,28rpx));}
+.t-tag.t-tag--extra-large{padding:var(--td-tag-extra-large-padding,16rpx 30rpx);font:var(--td-tag-extra-large-font,var(--td-font-body-medium,28rpx / 44rpx var(--td-font-family,PingFang SC,Microsoft YaHei,Arial Regular)));}
.t-tag.t-tag--extra-large .t-icon,.t-tag.t-tag--extra-large .t-icon-close{font-size:var(--td-tag-extra-large-icon-size,32rpx);}
.t-tag.t-tag--square{border-radius:var(--td-tag-square-border-radius,8rpx);}
.t-tag.t-tag--round{border-radius:var(--td-tag-round-border-radius,999px);}
diff --git a/miniprogram/miniprogram_npm/tdesign-miniprogram/textarea/textarea.wxss b/miniprogram/miniprogram_npm/tdesign-miniprogram/textarea/textarea.wxss
index f3d23b2..02bbf6f 100644
--- a/miniprogram/miniprogram_npm/tdesign-miniprogram/textarea/textarea.wxss
+++ b/miniprogram/miniprogram_npm/tdesign-miniprogram/textarea/textarea.wxss
@@ -1,9 +1,9 @@
@import '../common/style/index.wxss';.t-textarea{display:flex;flex-direction:column;box-sizing:border-box;padding:var(--td-textarea-padding,32rpx);background-color:var(--td-textarea-background-color,var(--td-bg-color-container,var(--td-font-white-1,#fff)));}
-.t-textarea__label:not(:empty){font-size:var(--td-font-size-base,28rpx);color:var(--td-textarea-label-color,var(--td-text-color-primary,var(--td-font-gray-1,rgba(0,0,0,.9))));flex-shrink:0;line-height:44rpx;padding-bottom:var(--td-spacer,16rpx);overflow:hidden;white-space:nowrap;text-overflow:ellipsis;}
+.t-textarea__label:not(:empty){font:var(--td-font-body-medium,28rpx / 44rpx var(--td-font-family,PingFang SC,Microsoft YaHei,Arial Regular));color:var(--td-textarea-label-color,var(--td-text-color-primary,var(--td-font-gray-1,rgba(0,0,0,.9))));flex-shrink:0;padding-bottom:var(--td-spacer,16rpx);overflow:hidden;white-space:nowrap;text-overflow:ellipsis;}
.t-textarea__wrapper{display:flex;flex-direction:column;width:100%;flex:1 1 auto;overflow:hidden;}
-.t-textarea__wrapper-inner{flex:1 1 auto;box-sizing:border-box;width:inherit;min-width:0;min-height:20px;margin:0;padding:0;text-align:left;background-color:transparent;border:0;resize:none;font-size:var(--td-font-size-m,32rpx);color:var(--td-textarea-text-color,var(--td-text-color-primary,var(--td-font-gray-1,rgba(0,0,0,.9))));line-height:48rpx;}
-.t-textarea__placeholder{color:var(--td-textarea-placeholder-color,var(--td-text-color-placeholder,var(--td-font-gray-3,rgba(0,0,0,.4))));font-size:var(--td-font-size-m,32rpx);}
-.t-textarea__indicator:not(:empty){flex-shrink:0;color:var(--td-textarea-indicator-text-color,var(--td-text-color-placeholder,var(--td-font-gray-3,rgba(0,0,0,.4))));font-size:var(--td-spacer-1,24rpx);text-align:right;line-height:40rpx;padding-top:var(--td-spacer,16rpx);}
+.t-textarea__wrapper-inner{flex:1 1 auto;box-sizing:border-box;width:inherit;min-width:0;min-height:20px;margin:0;padding:0;text-align:left;background-color:transparent;border:0;resize:none;font:var(--td-font-body-large,32rpx / 48rpx var(--td-font-family,PingFang SC,Microsoft YaHei,Arial Regular));color:var(--td-textarea-text-color,var(--td-text-color-primary,var(--td-font-gray-1,rgba(0,0,0,.9))));}
+.t-textarea__placeholder{color:var(--td-textarea-placeholder-color,var(--td-text-color-placeholder,var(--td-font-gray-3,rgba(0,0,0,.4))));font:var(--td-font-body-medium,28rpx / 44rpx var(--td-font-family,PingFang SC,Microsoft YaHei,Arial Regular));}
+.t-textarea__indicator:not(:empty){flex-shrink:0;color:var(--td-textarea-indicator-text-color,var(--td-text-color-placeholder,var(--td-font-gray-3,rgba(0,0,0,.4))));font:var(--td-font-body-small,24rpx / 40rpx var(--td-font-family,PingFang SC,Microsoft YaHei,Arial Regular));text-align:right;padding-top:var(--td-spacer,16rpx);}
.t-textarea--border{border-radius:var(--td-textarea-border-radius,var(--td-radius-default,12rpx));position:relative;}
.t-textarea--border::after{content:'';position:absolute;top:0;left:0;right:0;bottom:0;border:2rpx solid var(--td-textarea-border-color,var(--td-component-border,var(--td-gray-color-4,#dcdcdc)));border-radius:inherit;pointer-events:none;}
.t-textarea .t-is-disabled{color:var(--td-textarea-disabled-text-color,var(--td-text-color-disabled,var(--td-font-gray-4,rgba(0,0,0,.26))));}
\ No newline at end of file
diff --git a/miniprogram/miniprogram_npm/tdesign-miniprogram/toast/toast.js b/miniprogram/miniprogram_npm/tdesign-miniprogram/toast/toast.js
index 4393c86..5548b8e 100644
--- a/miniprogram/miniprogram_npm/tdesign-miniprogram/toast/toast.js
+++ b/miniprogram/miniprogram_npm/tdesign-miniprogram/toast/toast.js
@@ -1 +1 @@
-import{__decorate}from"tslib";import{SuperComponent,wxComponent}from"../common/src/index";import config from"../common/config";import props from"./props";import transition from"../mixins/transition";import{calcIcon}from"../common/utils";import useCustomNavbar from"../mixins/using-custom-navbar";const{prefix:prefix}=config,name=`${prefix}-toast`;let Toast=class extends SuperComponent{constructor(){super(...arguments),this.externalClasses=[`${prefix}-class`],this.options={multipleSlots:!0},this.behaviors=[transition(),useCustomNavbar],this.hideTimer=null,this.data={prefix:prefix,classPrefix:name,typeMapIcon:""},this.properties=props,this.lifetimes={detached(){this.destroyed()}},this.pageLifetimes={hide(){this.hide()}},this.methods={show(e){this.hideTimer&&clearTimeout(this.hideTimer);const i={loading:"loading",success:"check-circle",warning:"error-circle",error:"close-circle"}[null==e?void 0:e.theme],t={direction:props.direction.value,duration:props.duration.value,icon:props.icon.value,message:props.message.value,placement:props.placement.value,preventScrollThrough:props.preventScrollThrough.value,theme:props.theme.value},o=Object.assign(Object.assign(Object.assign({},t),e),{visible:!0,isLoading:"loading"===(null==e?void 0:e.theme),_icon:calcIcon(null!=i?i:e.icon)}),{duration:s}=o;this.setData(o),s>0&&(this.hideTimer=setTimeout(()=>{this.hide()},s))},hide(){var e,i;this.data.visible&&(this.setData({visible:!1}),null===(i=null===(e=this.data)||void 0===e?void 0:e.close)||void 0===i||i.call(e),this.triggerEvent("close"))},destroyed(){this.hideTimer&&(clearTimeout(this.hideTimer),this.hideTimer=null),this.triggerEvent("destory")},loop(){}}}};Toast=__decorate([wxComponent()],Toast);export default Toast;
\ No newline at end of file
+import{__decorate}from"tslib";import{SuperComponent,wxComponent}from"../common/src/index";import config from"../common/config";import props from"./props";import transition from"../mixins/transition";import{calcIcon}from"../common/utils";import useCustomNavbar from"../mixins/using-custom-navbar";const{prefix:prefix}=config,name=`${prefix}-toast`;let Toast=class extends SuperComponent{constructor(){super(...arguments),this.externalClasses=[`${prefix}-class`],this.options={multipleSlots:!0},this.behaviors=[transition(),useCustomNavbar],this.hideTimer=null,this.data={prefix:prefix,classPrefix:name,typeMapIcon:""},this.properties=props,this.lifetimes={detached(){this.destroyed()}},this.pageLifetimes={hide(){this.hide()}},this.methods={show(e){this.hideTimer&&clearTimeout(this.hideTimer);const i={loading:"loading",success:"check-circle",warning:"error-circle",error:"close-circle"}[null==e?void 0:e.theme],t={direction:props.direction.value,duration:props.duration.value,icon:props.icon.value,message:props.message.value,placement:props.placement.value,preventScrollThrough:props.preventScrollThrough.value,theme:props.theme.value,close:null},o=Object.assign(Object.assign(Object.assign({},t),e),{visible:!0,isLoading:"loading"===(null==e?void 0:e.theme),_icon:calcIcon(null!=i?i:e.icon)}),{duration:s}=o;this.setData(o),s>0&&(this.hideTimer=setTimeout(()=>{this.hide()},s))},hide(){var e,i;this.data.visible&&(this.setData({visible:!1}),null===(i=null===(e=this.data)||void 0===e?void 0:e.close)||void 0===i||i.call(e),this.triggerEvent("close"))},destroyed(){this.hideTimer&&(clearTimeout(this.hideTimer),this.hideTimer=null),this.triggerEvent("destory")},loop(){}}}};Toast=__decorate([wxComponent()],Toast);export default Toast;
\ No newline at end of file
diff --git a/miniprogram/miniprogram_npm/tdesign-miniprogram/toast/toast.wxml b/miniprogram/miniprogram_npm/tdesign-miniprogram/toast/toast.wxml
index c1ec2cd..14e8917 100644
--- a/miniprogram/miniprogram_npm/tdesign-miniprogram/toast/toast.wxml
+++ b/miniprogram/miniprogram_npm/tdesign-miniprogram/toast/toast.wxml
@@ -1 +1 @@
-{{message}}
\ No newline at end of file
+{{message}}
\ No newline at end of file
diff --git a/miniprogram/miniprogram_npm/tdesign-miniprogram/toast/toast.wxss b/miniprogram/miniprogram_npm/tdesign-miniprogram/toast/toast.wxss
index ee78585..c6d2443 100644
--- a/miniprogram/miniprogram_npm/tdesign-miniprogram/toast/toast.wxss
+++ b/miniprogram/miniprogram_npm/tdesign-miniprogram/toast/toast.wxss
@@ -1,7 +1,7 @@
-@import '../common/style/index.wxss';.t-toast{position:fixed;left:50%;transform:translate(-50%,-50%);z-index:12001;opacity:1;transition:opacity .3s ease;background-color:var(--td-toast-bg-color,var(--td-mask-active,rgba(0,0,0,.6)));border-radius:var(--td-toast-radius,var(--td-radius-default,12rpx));font-size:28rpx;color:var(--td-toast-color,var(--td-text-color-anti,var(--td-font-white-1,#fff)));max-width:var(--td-toast-max-width,370rpx);min-height:0;width:auto;display:flex;flex-direction:column;align-items:stretch;box-sizing:border-box;}
+@import '../common/style/index.wxss';.t-toast{position:fixed;left:50%;transform:translate(-50%,-50%);z-index:12001;opacity:1;transition:opacity .3s ease;background-color:var(--td-toast-bg-color,var(--td-mask-active,rgba(0,0,0,.6)));border-radius:var(--td-toast-radius,var(--td-radius-default,12rpx));color:var(--td-toast-color,var(--td-text-color-anti,var(--td-font-white-1,#fff)));max-width:var(--td-toast-max-width,370rpx);min-height:0;width:auto;display:flex;flex-direction:column;align-items:stretch;box-sizing:border-box;}
.t-toast--column{padding:48rpx;min-width:160rpx;min-height:160rpx;border-radius:16rpx;display:flex;align-items:center;justify-content:center;}
.t-toast--loading.t-toast--with-text{min-width:204rpx;min-height:204rpx;padding-top:0;padding-bottom:0;}
-.t-toast__content{align-items:center;line-height:44rpx;}
+.t-toast__content{align-items:center;font:var(--td-font-body-medium,28rpx / 44rpx var(--td-font-family,PingFang SC,Microsoft YaHei,Arial Regular));}
.t-toast__content--row{display:flex;text-align:left;padding:28rpx 44rpx;}
.t-toast__content--column{display:flex;flex-direction:column;justify-content:center;align-items:center;}
.t-toast__icon--row{display:flex;font-size:var(--td-toast-row-icon-size,48rpx);}
diff --git a/miniprogram/miniprogram_npm/tdesign-miniprogram/upload/upload.d.ts b/miniprogram/miniprogram_npm/tdesign-miniprogram/upload/upload.d.ts
index 8efaebf..71e66f8 100644
--- a/miniprogram/miniprogram_npm/tdesign-miniprogram/upload/upload.d.ts
+++ b/miniprogram/miniprogram_npm/tdesign-miniprogram/upload/upload.d.ts
@@ -1,6 +1,6 @@
///
import { SuperComponent } from '../common/src/index';
-import { UploadFile } from './type';
+import { UploadFile, SizeLimitObj } from './type';
export default class Upload extends SuperComponent {
externalClasses: string[];
options: {
@@ -39,6 +39,7 @@ export default class Upload extends SuperComponent {
onFileClick(e: WechatMiniprogram.BaseEvent): void;
getFileType(mediaType: string[], tempFilePath: string, fileType?: string): string;
getRandFileName(filePath: any): string;
+ checkFileSize(size: number, sizeLimit: SizeLimitObj | number, fileType?: string): boolean;
onDelete(e: any): void;
deleteHandle(index: number): void;
updateGrid(): void;
@@ -51,7 +52,7 @@ export default class Upload extends SuperComponent {
onPreview(e: WechatMiniprogram.BaseEvent): void;
onPreviewImage(e: WechatMiniprogram.BaseEvent): void;
onPreviewMedia(e: WechatMiniprogram.BaseEvent): void;
- uploadFiles(files: UploadFile[]): Promise;
+ uploadFiles(files: UploadFile[]): Promise;
startUpload(files: UploadFile[]): any;
onAddTap(): void;
chooseMedia(mediaType: any): void;
diff --git a/miniprogram/miniprogram_npm/tdesign-miniprogram/upload/upload.js b/miniprogram/miniprogram_npm/tdesign-miniprogram/upload/upload.js
index 61bc135..156d80d 100644
--- a/miniprogram/miniprogram_npm/tdesign-miniprogram/upload/upload.js
+++ b/miniprogram/miniprogram_npm/tdesign-miniprogram/upload/upload.js
@@ -1 +1 @@
-import{__decorate,__rest}from"tslib";import{SuperComponent,wxComponent}from"../common/src/index";import props from"./props";import config from"../common/config";import{isOverSize}from"../common/utils";import{isObject}from"../common/validator";const{prefix:prefix}=config,name=`${prefix}-upload`;let Upload=class extends SuperComponent{constructor(){super(...arguments),this.externalClasses=[`${prefix}-class`],this.options={multipleSlots:!0},this.data={classPrefix:name,prefix:prefix,current:!1,proofs:[],customFiles:[],customLimit:0,column:4,dragBaseData:{},rows:0,dragWrapStyle:"",dragList:[],dragging:!0,dragLayout:!1},this.properties=props,this.controlledProps=[{key:"files",event:"success"}],this.observers={"files, max, draggable"(t,e){this.handleLimit(t,e)},gridConfig(){this.updateGrid()}},this.lifetimes={ready(){this.handleLimit(this.data.customFiles,this.data.max),this.updateGrid()}},this.methods={getPreviewMediaSources(){const t=[];return this.data.customFiles.forEach(e=>{const i={url:e.url,type:e.type,poster:e.thumb||void 0};t.push(i)}),t},onPreview(t){this.onFileClick(t);const{preview:e}=this.properties;if(!e)return;this.data.customFiles.some(t=>"video"===t.type)?this.onPreviewMedia(t):this.onPreviewImage(t)},onPreviewImage(t){var e;const{index:i}=t.currentTarget.dataset,s=this.data.customFiles.filter(t=>-1!==t.percent).map(t=>t.url),r=null===(e=this.data.customFiles[i])||void 0===e?void 0:e.url;wx.previewImage({urls:s,current:r,fail(){wx.showToast({title:"预览图片失败",icon:"none"})}})},onPreviewMedia(t){const{index:e}=t.currentTarget.dataset,i=this.getPreviewMediaSources();wx.previewMedia({sources:i,current:e,fail(){wx.showToast({title:"预览视频失败",icon:"none"})}})},uploadFiles(t){return new Promise(e=>{const i=this.data.requestMethod(t);if(i instanceof Promise)return i;e({})})},startUpload(t){return"function"==typeof this.data.requestMethod?this.uploadFiles(t).then(()=>{t.forEach(t=>{t.percent=100}),this.triggerSuccessEvent(t)}).catch(t=>{this.triggerFailEvent(t)}):(this.triggerSuccessEvent(t),this.handleLimit(this.data.customFiles,this.data.max),Promise.resolve())},onAddTap(){const{disabled:t,mediaType:e,source:i}=this.properties;t||("media"===i?this.chooseMedia(e):this.chooseMessageFile(e))},chooseMedia(t){const{customLimit:e}=this.data,{config:i,sizeLimit:s}=this.properties;wx.chooseMedia(Object.assign(Object.assign({count:Math.min(20,e),mediaType:t},i),{success:e=>{const i=[];e.tempFiles.forEach(e=>{const{size:r,fileType:a,tempFilePath:o,width:n,height:l,duration:c,thumbTempFilePath:h}=e,d=__rest(e,["size","fileType","tempFilePath","width","height","duration","thumbTempFilePath"]);if(isOverSize(r,s)){let t=("image"===a?"图片":"视频")+"大小超过限制";return"number"!=typeof s&&(t=s.message.replace("{sizeLimit}",null==s?void 0:s.size)),void wx.showToast({icon:"none",title:t})}const g=this.getRandFileName(o);i.push(Object.assign({name:g,type:this.getFileType(t,o,a),url:o,size:r,width:n,height:l,duration:c,thumb:h,percent:0},d))}),this.afterSelect(i)},fail:t=>{this.triggerFailEvent(t)},complete:t=>{this.triggerEvent("complete",t)}}))},chooseMessageFile(t){const{customLimit:e}=this.data,{config:i,sizeLimit:s}=this.properties;wx.chooseMessageFile(Object.assign(Object.assign({count:Math.min(100,e),type:Array.isArray(t)?"all":t},i),{success:e=>{const i=[];e.tempFiles.forEach(e=>{const{size:r,type:a,path:o}=e,n=__rest(e,["size","type","path"]);if(isOverSize(r,s)){let t=("image"===a?"图片":"视频")+"大小超过限制";return"number"!=typeof s&&(t=s.message.replace("{sizeLimit}",null==s?void 0:s.size)),void wx.showToast({icon:"none",title:t})}const l=this.getRandFileName(o);i.push(Object.assign({name:l,type:this.getFileType(t,o,a),url:o,size:r,percent:0},n))}),this.afterSelect(i)},fail:t=>this.triggerFailEvent(t),complete:t=>this.triggerEvent("complete",t)}))},afterSelect(t){this._trigger("select-change",{files:[...this.data.customFiles],currentSelectedFiles:[t]}),this._trigger("add",{files:t}),this.startUpload(t)},dragVibrate(t){var e;const{vibrateType:i}=t,{draggable:s}=this.data,r=null===(e=null==s?void 0:s.vibrate)||void 0===e||e,a=null==s?void 0:s.collisionVibrate;(r&&"longPress"===i||a&&"touchMove"===i)&&wx.vibrateShort({type:"light"})},dragStatusChange(t){const{dragging:e}=t;this.setData({dragging:e})},dragEnd(t){const{dragCollisionList:e}=t;let i=[];i=0===e.length?this.data.customFiles:e.reduce((t,e)=>{const{realKey:i,data:s,fixed:r}=e;return r||(t[i]=Object.assign({},s)),t},[]),this.triggerDropEvent(i)},triggerDropEvent(t){const{transition:e}=this.properties;if(e.backTransition){const i=setTimeout(()=>{this.triggerEvent("drop",{files:t}),clearTimeout(i)},e.duration)}else this.triggerEvent("drop",{files:t})}}}handleLimit(t,e){0===e&&(e=Number.MAX_SAFE_INTEGER),this.setData({customFiles:t.length>e?t.slice(0,e):t,customLimit:e-t.length,dragging:!0}),this.initDragLayout()}triggerSuccessEvent(t){this._trigger("success",{files:[...this.data.customFiles,...t]})}triggerFailEvent(t){this.triggerEvent("fail",t)}onFileClick(t){const{file:e,index:i}=t.currentTarget.dataset;this.triggerEvent("click",{index:i,file:e})}getFileType(t,e,i){if(i)return i;if(1===t.length)return t[0];const s=e.split("."),r=s[s.length-1];return["avi","wmv","mkv","mp4","mov","rm","3gp","flv","mpg","rmvb"].includes(r.toLocaleLowerCase())?"video":"image"}getRandFileName(t){const e=t.lastIndexOf("."),i=-1===e?"":t.substr(e);return parseInt(`${Date.now()}${Math.floor(900*Math.random()+100)}`,10).toString(36)+i}onDelete(t){const{index:e}=t.currentTarget.dataset;this.deleteHandle(e)}deleteHandle(t){const{customFiles:e}=this.data,i=e[t];this.triggerEvent("remove",{index:t,file:i})}updateGrid(){let{gridConfig:t={}}=this.properties;isObject(t)||(t={});const{column:e=4,width:i=160,height:s=160}=t;this.setData({gridItemStyle:`width:${i}rpx;height:${s}rpx`,column:e})}resetDragLayout(){this.setData({dragBaseData:{},dragWrapStyle:"",dragLayout:!1})}initDragLayout(){const{draggable:t,disabled:e}=this.properties,{customFiles:i}=this.data;t&&!e&&0!==i.length?(this.initDragList(),this.initDragBaseData()):this.resetDragLayout()}initDragList(){let t=0;const{column:e,customFiles:i,customLimit:s}=this.data,r=[];if(i.forEach((i,s)=>{r.push({realKey:t,sortKey:s,tranX:s%e*100+"%",tranY:100*Math.floor(s/e)+"%",data:Object.assign({},i)}),t+=1}),s>0){const t=r.length;r.push({realKey:t,sortKey:t,tranX:t%e*100+"%",tranY:100*Math.floor(t/e)+"%",fixed:!0})}this.data.rows=Math.ceil(r.length/e),this.setData({dragList:r})}initDragBaseData(){const{classPrefix:t,rows:e,column:i}=this.data,s=this.createSelectorQuery(),r=`.${t} >>> .t-grid-item`,a=`.${t} >>> .t-grid`;s.select(r).boundingClientRect(),s.select(a).boundingClientRect(),s.selectViewport().scrollOffset(),s.exec(s=>{const[{width:r,height:a},{left:o,top:n},{scrollTop:l}]=s,c={rows:e,classPrefix:t,itemWidth:r,itemHeight:a,wrapLeft:o,wrapTop:n+l,columns:i},h=`height: ${e*a}px`;this.setData({dragBaseData:c,dragWrapStyle:h,dragLayout:!0},()=>{const t=setTimeout(()=>{this.setData({dragging:!1}),clearTimeout(t)},0)})})}};Upload=__decorate([wxComponent()],Upload);export default Upload;
\ No newline at end of file
+import{__decorate,__rest}from"tslib";import{SuperComponent,wxComponent}from"../common/src/index";import props from"./props";import config from"../common/config";import{isOverSize,isWxWork,isPC}from"../common/utils";import{isObject}from"../common/validator";const{prefix:prefix}=config,name=`${prefix}-upload`;let Upload=class extends SuperComponent{constructor(){super(...arguments),this.externalClasses=[`${prefix}-class`],this.options={multipleSlots:!0},this.data={classPrefix:name,prefix:prefix,current:!1,proofs:[],customFiles:[],customLimit:0,column:4,dragBaseData:{},rows:0,dragWrapStyle:"",dragList:[],dragging:!0,dragLayout:!1},this.properties=props,this.controlledProps=[{key:"files",event:"success"}],this.observers={"files, max, draggable"(t,e){this.handleLimit(t,e)},gridConfig(){this.updateGrid()}},this.lifetimes={ready(){this.handleLimit(this.data.customFiles,this.data.max),this.updateGrid()}},this.methods={getPreviewMediaSources(){const t=[];return this.data.customFiles.forEach(e=>{const i={url:e.url,type:e.type,poster:e.thumb||void 0};t.push(i)}),t},onPreview(t){this.onFileClick(t);const{preview:e}=this.properties;if(!e)return;this.data.customFiles.some(t=>"video"===t.type)?this.onPreviewMedia(t):this.onPreviewImage(t)},onPreviewImage(t){var e;const{index:i}=t.currentTarget.dataset,s=this.data.customFiles.filter(t=>-1!==t.percent).map(t=>t.url),r=null===(e=this.data.customFiles[i])||void 0===e?void 0:e.url;wx.previewImage({urls:s,current:r,fail(){wx.showToast({title:"预览图片失败",icon:"none"})}})},onPreviewMedia(t){const{index:e}=t.currentTarget.dataset,i=this.getPreviewMediaSources();wx.previewMedia({sources:i,current:e,fail(){wx.showToast({title:"预览视频失败",icon:"none"})}})},uploadFiles(t){return Promise.resolve().then(()=>{const e=this.data.requestMethod(t);return e instanceof Promise?e:Promise.resolve({})})},startUpload(t){return"function"==typeof this.data.requestMethod?this.uploadFiles(t).then(()=>{t.forEach(t=>{t.percent=100}),this.triggerSuccessEvent(t)}).catch(t=>{this.triggerFailEvent(t)}):(this.triggerSuccessEvent(t),this.handleLimit(this.data.customFiles,this.data.max),Promise.resolve())},onAddTap(){const{disabled:t,mediaType:e,source:i}=this.properties;t||("media"===i?this.chooseMedia(e):this.chooseMessageFile(e))},chooseMedia(t){const{customLimit:e}=this.data,{config:i,sizeLimit:s}=this.properties;isWxWork||isPC?wx.chooseImage(Object.assign(Object.assign({count:Math.min(20,e)},i),{success:t=>{const e=[];t.tempFiles.forEach(t=>{const{path:i,size:r}=t;if(this.checkFileSize(r,s,"image"))return;const a=this.getRandFileName(i);e.push({name:a,type:"image",url:i,size:r,percent:0})}),this.afterSelect(e)},fail:t=>{this.triggerFailEvent(t)},complete:t=>{this.triggerEvent("complete",t)}})):wx.chooseMedia(Object.assign(Object.assign({count:Math.min(20,e),mediaType:t},i),{success:e=>{const i=[];e.tempFiles.forEach(e=>{const{size:r,fileType:a,tempFilePath:o,width:n,height:l,duration:c,thumbTempFilePath:h}=e,g=__rest(e,["size","fileType","tempFilePath","width","height","duration","thumbTempFilePath"]);if(this.checkFileSize(r,s,a))return;const d=this.getRandFileName(o);i.push(Object.assign({name:d,type:this.getFileType(t,o,a),url:o,size:r,width:n,height:l,duration:c,thumb:h,percent:0},g))}),this.afterSelect(i)},fail:t=>{this.triggerFailEvent(t)},complete:t=>{this.triggerEvent("complete",t)}}))},chooseMessageFile(t){const{customLimit:e}=this.data,{config:i,sizeLimit:s}=this.properties;wx.chooseMessageFile(Object.assign(Object.assign({count:Math.min(100,e),type:Array.isArray(t)?"all":t},i),{success:e=>{const i=[];e.tempFiles.forEach(e=>{const{size:r,type:a,path:o}=e,n=__rest(e,["size","type","path"]);if(this.checkFileSize(r,s,a))return;const l=this.getRandFileName(o);i.push(Object.assign({name:l,type:this.getFileType(t,o,a),url:o,size:r,percent:0},n))}),this.afterSelect(i)},fail:t=>this.triggerFailEvent(t),complete:t=>this.triggerEvent("complete",t)}))},afterSelect(t){this._trigger("select-change",{files:[...this.data.customFiles],currentSelectedFiles:[t]}),this._trigger("add",{files:t}),this.startUpload(t)},dragVibrate(t){var e;const{vibrateType:i}=t,{draggable:s}=this.data,r=null===(e=null==s?void 0:s.vibrate)||void 0===e||e,a=null==s?void 0:s.collisionVibrate;(r&&"longPress"===i||a&&"touchMove"===i)&&wx.vibrateShort({type:"light"})},dragStatusChange(t){const{dragging:e}=t;this.setData({dragging:e})},dragEnd(t){const{dragCollisionList:e}=t;let i=[];i=0===e.length?this.data.customFiles:e.reduce((t,e)=>{const{realKey:i,data:s,fixed:r}=e;return r||(t[i]=Object.assign({},s)),t},[]),this.triggerDropEvent(i)},triggerDropEvent(t){const{transition:e}=this.properties;if(e.backTransition){const i=setTimeout(()=>{this.triggerEvent("drop",{files:t}),clearTimeout(i)},e.duration)}else this.triggerEvent("drop",{files:t})}}}handleLimit(t,e){0===e&&(e=Number.MAX_SAFE_INTEGER),this.setData({customFiles:t.length>e?t.slice(0,e):t,customLimit:e-t.length,dragging:!0}),this.initDragLayout()}triggerSuccessEvent(t){this._trigger("success",{files:[...this.data.customFiles,...t]})}triggerFailEvent(t){this.triggerEvent("fail",t)}onFileClick(t){const{file:e,index:i}=t.currentTarget.dataset;this.triggerEvent("click",{index:i,file:e})}getFileType(t,e,i){if(i)return i;if(1===t.length)return t[0];const s=e.split("."),r=s[s.length-1];return["avi","wmv","mkv","mp4","mov","rm","3gp","flv","mpg","rmvb"].includes(r.toLocaleLowerCase())?"video":"image"}getRandFileName(t){const e=t.lastIndexOf("."),i=-1===e?"":t.substr(e);return parseInt(`${Date.now()}${Math.floor(900*Math.random()+100)}`,10).toString(36)+i}checkFileSize(t,e,i){if(isOverSize(t,e)){let t=("video"===i?"视频":"图片")+"大小超过限制";if(isObject(e)){const{size:i,message:s}=e;t=null==s?void 0:s.replace("{sizeLimit}",String(i))}return wx.showToast({icon:"none",title:t}),!0}return!1}onDelete(t){const{index:e}=t.currentTarget.dataset;this.deleteHandle(e)}deleteHandle(t){const{customFiles:e}=this.data,i=e[t];this.triggerEvent("remove",{index:t,file:i})}updateGrid(){let{gridConfig:t={}}=this.properties;isObject(t)||(t={});const{column:e=4,width:i=160,height:s=160}=t;this.setData({gridItemStyle:`width:${i}rpx;height:${s}rpx`,column:e})}resetDragLayout(){this.setData({dragBaseData:{},dragWrapStyle:"",dragLayout:!1})}initDragLayout(){const{draggable:t,disabled:e}=this.properties,{customFiles:i}=this.data;t&&!e&&0!==i.length?(this.initDragList(),this.initDragBaseData()):this.resetDragLayout()}initDragList(){let t=0;const{column:e,customFiles:i,customLimit:s}=this.data,r=[];if(i.forEach((i,s)=>{r.push({realKey:t,sortKey:s,tranX:s%e*100+"%",tranY:100*Math.floor(s/e)+"%",data:Object.assign({},i)}),t+=1}),s>0){const t=r.length;r.push({realKey:t,sortKey:t,tranX:t%e*100+"%",tranY:100*Math.floor(t/e)+"%",fixed:!0})}this.data.rows=Math.ceil(r.length/e),this.setData({dragList:r})}initDragBaseData(){const{classPrefix:t,rows:e,column:i}=this.data,s=this.createSelectorQuery(),r=`.${t} >>> .t-grid-item`,a=`.${t} >>> .t-grid`;s.select(r).boundingClientRect(),s.select(a).boundingClientRect(),s.selectViewport().scrollOffset(),s.exec(s=>{const[{width:r,height:a},{left:o,top:n},{scrollTop:l}]=s,c={rows:e,classPrefix:t,itemWidth:r,itemHeight:a,wrapLeft:o,wrapTop:n+l,columns:i},h=`height: ${e*a}px`;this.setData({dragBaseData:c,dragWrapStyle:h,dragLayout:!0},()=>{const t=setTimeout(()=>{this.setData({dragging:!1}),clearTimeout(t)},0)})})}};Upload=__decorate([wxComponent()],Upload);export default Upload;
\ No newline at end of file
diff --git a/miniprogram/miniprogram_npm/tdesign-miniprogram/upload/upload.wxss b/miniprogram/miniprogram_npm/tdesign-miniprogram/upload/upload.wxss
index aa8e4db..8388c6b 100644
--- a/miniprogram/miniprogram_npm/tdesign-miniprogram/upload/upload.wxss
+++ b/miniprogram/miniprogram_npm/tdesign-miniprogram/upload/upload.wxss
@@ -1,7 +1,7 @@
@import '../common/style/index.wxss';.t-upload{position:relative;}
.t-upload__grid-content{padding:0;}
.t-upload__grid-file{position:relative;}
-.t-upload__add-icon{width:100%;height:100%;display:none;align-items:center;justify-content:center;font-size:var(--td-upload-add-icon-font-size,56rpx);background-color:var(--td-upload-add-bg-color,var(--td-bg-color-secondarycontainer,var(--td-gray-color-1,#f3f3f3)));color:var(--td-upload-add-color,var(--td-text-color-placeholder,var(--td-font-gray-3,rgba(0,0,0,.4))));border-radius:var(--td-upload-radius,var(--td-radius-default,12rpx));}
+.t-upload__add-icon{width:100%;height:100%;display:none;align-items:center;justify-content:center;font-size:var(--td-upload-add-icon-size,56rpx);background-color:var(--td-upload-add-bg-color,var(--td-bg-color-secondarycontainer,var(--td-gray-color-1,#f3f3f3)));color:var(--td-upload-add-color,var(--td-text-color-placeholder,var(--td-font-gray-3,rgba(0,0,0,.4))));border-radius:var(--td-upload-radius,var(--td-radius-default,12rpx));}
.t-upload__add-icon--disabled{background-color:var(--td-upload-add-disabled-bg-color,var(--td-bg-color-component-disabled,var(--td-gray-color-2,#eee)));color:var(--td-upload-add-icon-disabled-color,var(--td-text-color-disabled,var(--td-font-gray-4,rgba(0,0,0,.26))));}
.t-upload__add-icon:only-child{display:flex;}
.t-upload__thumbnail{width:100%;height:100%;max-height:100%;overflow:hidden;}
@@ -9,7 +9,7 @@
.t-upload__wrapper--disabled::before{content:'';position:absolute;top:0;left:0;width:100%;height:100%;background-color:var(--td-upload-disabled-mask,rgba(0,.6));z-index:1;}
.t-upload__close-btn{position:absolute;top:0;right:0;display:flex;align-items:center;justify-content:center;width:40rpx;height:40rpx;border-top-right-radius:var(--td-upload-radius,var(--td-radius-default,12rpx));border-bottom-left-radius:var(--td-upload-radius,var(--td-radius-default,12rpx));background-color:var(--td-font-gray-3,rgba(0,0,0,.4));}
.t-upload__progress-mask{position:absolute;left:0;top:0;width:100%;height:100%;background-color:var(--td-font-gray-2,rgba(0,0,0,.6));display:flex;flex-direction:column;align-items:center;justify-content:center;border-radius:var(--td-upload-radius,var(--td-radius-default,12rpx));color:var(--td-text-color-anti,var(--td-font-white-1,#fff));padding:32rpx 0;box-sizing:border-box;}
-.t-upload__progress-text{font-size:24rpx;line-height:40rpx;margin-top:8rpx;}
+.t-upload__progress-text{font:var(--td-font-body-small,24rpx / 40rpx var(--td-font-family,PingFang SC,Microsoft YaHei,Arial Regular));margin-top:8rpx;}
.t-upload__progress-loading{animation:spin infinite linear .6s;}
.t-upload__drag{position:relative;width:100%;--td-grid-item-bg-color:transparent;}
.t-upload__drag-item{position:absolute;z-index:1;top:0;left:0;height:auto;width:100%;}
diff --git a/package-lock.json b/package-lock.json
index 1954067..9c46ba6 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -9,11 +9,11 @@
"version": "1.0.0",
"dependencies": {
"big.js": "v7.0.1",
- "tdesign-miniprogram": "^1.11.2"
+ "tdesign-miniprogram": "^1.12.1"
},
"devDependencies": {
"@types/big.js": "^6.2.2",
- "miniprogram-api-typings": "^4.1.0"
+ "miniprogram-api-typings": "^4.1.2"
}
},
"node_modules/@types/big.js": {
@@ -37,16 +37,16 @@
}
},
"node_modules/miniprogram-api-typings": {
- "version": "4.1.0",
- "resolved": "https://registry.npmjs.org/miniprogram-api-typings/-/miniprogram-api-typings-4.1.0.tgz",
- "integrity": "sha512-4RBsz27nBKyRkVGoNkRaPx24/KeJBw3zaaIlXDR8s/WBh2PbcUAc+q7wLLbp7Qsmb3bLzzUu7tqAti+B06kmjg==",
+ "version": "4.1.2",
+ "resolved": "https://registry.npmjs.org/miniprogram-api-typings/-/miniprogram-api-typings-4.1.2.tgz",
+ "integrity": "sha512-VmIgxal0GU3nHwsH2UNaRh8jNHG/kauG08Z4W/qiJ1Iubvme48aE+q3grpT9ZLBArMKmSuKlsTq+uPPHSGr0rA==",
"dev": true,
"license": "MIT"
},
"node_modules/tdesign-miniprogram": {
- "version": "1.11.2",
- "resolved": "https://registry.npmjs.org/tdesign-miniprogram/-/tdesign-miniprogram-1.11.2.tgz",
- "integrity": "sha512-lXcry3vRa9jHzjpOdIxuIAh7F85kImym82VwLbCqr/TkMhycOsOepx+r1S9fum7u2nsWiYRTV+HuvDHN3KlIuA==",
+ "version": "1.12.1",
+ "resolved": "https://registry.npmjs.org/tdesign-miniprogram/-/tdesign-miniprogram-1.12.1.tgz",
+ "integrity": "sha512-L2w/6lqVXSCtptvlPGlY91dutMb3dJlx9rFpmpLRtG7c7v1l89rIhvgLRgsaBcwTA5btdB8VXGXpTVj621bv5w==",
"license": "MIT"
}
}
diff --git a/package.json b/package.json
index d2314d9..a593581 100644
--- a/package.json
+++ b/package.json
@@ -7,11 +7,12 @@
"author": "",
"license": "",
"dependencies": {
- "tdesign-miniprogram": "^1.11.2",
+ "tdesign-miniprogram": "^1.12.1",
"big.js": "v7.0.1"
},
"devDependencies": {
- "miniprogram-api-typings": "^4.1.0",
+ "miniprogram-api-typings": "^4.1.2",
"@types/big.js": "^6.2.2"
}
-}
\ No newline at end of file
+}
+
diff --git a/typings/types/wx/index.d.ts b/typings/types/wx/index.d.ts
index db82722..d6deb26 100644
--- a/typings/types/wx/index.d.ts
+++ b/typings/types/wx/index.d.ts
@@ -1,5 +1,5 @@
/*! *****************************************************************************
-Copyright (c) 2021 Tencent, Inc. All rights reserved.
+Copyright (c) 2025 Tencent, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
@@ -24,9 +24,11 @@ SOFTWARE.
///
///
///
+///
///
///
///
+///
declare namespace WechatMiniprogram {
type IAnyObject = Record
@@ -38,27 +40,77 @@ declare namespace WechatMiniprogram {
type PromisifySuccessResult<
P,
T extends AsyncMethodOptionLike
- > = P extends { success: any }
+ > = P extends {
+ success: any
+ }
? void
: P extends { fail: any }
? void
: P extends { complete: any }
? void
: Promise>[0]>
+
+ // TODO: Extract real definition from `lib.dom.d.ts` to replace this
+ type IIRFilterNode = any
+ type WaveShaperNode = any
+ type ConstantSourceNode = any
+ type OscillatorNode = any
+ type GainNode = any
+ type BiquadFilterNode = any
+ type PeriodicWaveNode = any
+ type AudioNode = any
+ type ChannelSplitterNode = any
+ type ChannelMergerNode = any
+ type DelayNode = any
+ type DynamicsCompressorNode = any
+ type ScriptProcessorNode = any
+ type PannerNode = any
+ type AnalyserNode = any
+ type WebGLTexture = any
+ type WebGLRenderingContext = any
+
+ // TODO: fill worklet type
+ type WorkletFunction = (...args: any) => any
+ type AnimationObject = any
+ type SharedValue = T
+ type DerivedValue = T
}
-declare const console: WechatMiniprogram.Console
-declare const wx: WechatMiniprogram.Wx
+declare let console: WechatMiniprogram.Console
+
+declare let wx: WechatMiniprogram.Wx
/** 引入模块。返回模块通过 `module.exports` 或 `exports` 暴露的接口。 */
-declare function require(
- /** 需要引入模块文件相对于当前文件的相对路径,或 npm 模块名,或 npm 模块路径。不支持绝对路径 */
- module: string
-): any
+interface Require {
+ (
+ /** 需要引入模块文件相对于当前文件的相对路径,或 npm 模块名,或 npm 模块路径。不支持绝对路径 */
+ module: string,
+ /** 用于异步获取其他分包中的模块的引用结果,详见 [分包异步化]((subpackages/async)) */
+ callback?: (moduleExport: any) => void,
+ /** 异步获取分包失败时的回调,详见 [分包异步化]((subpackages/async)) */
+ errorCallback?: (err: any) => void
+ ): any
+ /** 以 Promise 形式异步引入模块。返回模块通过 `module.exports` 或 `exports` 暴露的接口。 */
+ async(
+ /** 需要引入模块文件相对于当前文件的相对路径,或 npm 模块名,或 npm 模块路径。不支持绝对路径 */
+ module: string
+ ): Promise
+}
+declare const require: Require
/** 引入插件。返回插件通过 `main` 暴露的接口。 */
-declare function requirePlugin(
- /** 需要引入的插件的 alias */
- module: string
-): any
+interface RequirePlugin {
+ (
+ /** 需要引入的插件的 alias */
+ module: string,
+ /** 用于异步获取其他分包中的插件的引用结果,详见 [分包异步化]((subpackages/async)) */
+ callback?: (pluginExport: any) => void
+ ): any
+ /** 以 Promise 形式异步引入插件。返回插件通过 `main` 暴露的接口。 */
+ async(
+ /** 需要引入的插件的 alias */
+ module: string
+ ): Promise
+}
+declare const requirePlugin: RequirePlugin
/** 插件引入当前使用者小程序。返回使用者小程序通过 [插件配置中 `export` 暴露的接口](https://developers.weixin.qq.com/miniprogram/dev/framework/plugin/using.html#%E5%AF%BC%E5%87%BA%E5%88%B0%E6%8F%92%E4%BB%B6)。
*
* 该接口只在插件中存在
@@ -72,3 +124,40 @@ declare let module: {
}
/** `module.exports` 的引用 */
declare let exports: any
+
+/** [clearInterval(number intervalID)](https://developers.weixin.qq.com/miniprogram/dev/api/base/timer/clearInterval.html)
+ *
+ * 取消由 setInterval 设置的定时器。 */
+declare function clearInterval(
+ /** 要取消的定时器的 ID */
+ intervalID: number
+): void
+/** [clearTimeout(number timeoutID)](https://developers.weixin.qq.com/miniprogram/dev/api/base/timer/clearTimeout.html)
+ *
+ * 取消由 setTimeout 设置的定时器。 */
+declare function clearTimeout(
+ /** 要取消的定时器的 ID */
+ timeoutID: number
+): void
+/** [number setInterval(function callback, number delay, any rest)](https://developers.weixin.qq.com/miniprogram/dev/api/base/timer/setInterval.html)
+ *
+ * 设定一个定时器。按照指定的周期(以毫秒计)来执行注册的回调函数 */
+declare function setInterval(
+ /** 回调函数 */
+ callback: (...args: any[]) => any,
+ /** 执行回调函数之间的时间间隔,单位 ms。 */
+ delay?: number,
+ /** param1, param2, ..., paramN 等附加参数,它们会作为参数传递给回调函数。 */
+ ...rest: any[]
+): number
+/** [number setTimeout(function callback, number delay, any rest)](https://developers.weixin.qq.com/miniprogram/dev/api/base/timer/setTimeout.html)
+ *
+ * 设定一个定时器。在定时到期以后执行注册的回调函数 */
+declare function setTimeout(
+ /** 回调函数 */
+ callback: (...args: any[]) => any,
+ /** 延迟的时间,函数的调用会在该延迟之后发生,单位 ms。 */
+ delay?: number,
+ /** param1, param2, ..., paramN 等附加参数,它们会作为参数传递给回调函数。 */
+ ...rest: any[]
+): number
diff --git a/typings/types/wx/lib.wx.api.d.ts b/typings/types/wx/lib.wx.api.d.ts
index 4c6047a..65d3dbd 100644
--- a/typings/types/wx/lib.wx.api.d.ts
+++ b/typings/types/wx/lib.wx.api.d.ts
@@ -1,5 +1,5 @@
/*! *****************************************************************************
-Copyright (c) 2021 Tencent, Inc. All rights reserved.
+Copyright (c) 2025 Tencent, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
@@ -20,15 +20,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
***************************************************************************** */
+///
+
declare namespace WechatMiniprogram {
- interface AccessFailCallbackResult {
- /** 错误信息
- *
- * 可选值:
- * - 'fail no such file or directory ${path}': 文件/目录不存在;
- * - 'fail sdcard not mounted': Android sdcard 挂载失败; */
- errMsg: string
- }
interface AccessOption {
/** 要判断是否存在的文件/目录路径 (本地路径) */
path: string
@@ -39,13 +33,35 @@ declare namespace WechatMiniprogram {
/** 接口调用成功的回调函数 */
success?: AccessSuccessCallback
}
- /** 帐号信息 */
+ /** 账号信息 */
interface AccountInfo {
- /** 小程序帐号信息 */
+ /** 小程序账号信息 */
miniProgram: MiniProgram
- /** 插件帐号信息(仅在插件中调用时包含这一项) */
+ /** 插件账号信息(仅在插件中调用时包含这一项) */
plugin: Plugin
}
+ interface AddArcOption {
+ /** 终点 */
+ end: MapPostion
+ /** 圆弧 id */
+ id: number
+ /** 起始点 */
+ start: MapPostion
+ /** 夹角角度 */
+ angle?: number
+ /** 线的颜色 */
+ color?: number
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: AddArcCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: AddArcFailCallback
+ /** 途经点 */
+ pass?: MapPostion
+ /** 接口调用成功的回调函数 */
+ success?: AddArcSuccessCallback
+ /** 线宽 */
+ width?: number
+ }
interface AddCardOption {
/** 需要添加的卡券列表 */
cardList: AddCardRequestInfo[]
@@ -89,11 +105,23 @@ declare namespace WechatMiniprogram {
/** 接口调用成功的回调函数 */
success?: AddCustomLayerSuccessCallback
}
+ interface AddFileToFavoritesOption {
+ /** 要收藏的文件地址,必须为本地路径或临时路径 */
+ filePath: string
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: AddFileToFavoritesCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: AddFileToFavoritesFailCallback
+ /** 自定义文件名,若留空则使用filePath中的文件名 */
+ fileName?: string
+ /** 接口调用成功的回调函数 */
+ success?: AddFileToFavoritesSuccessCallback
+ }
interface AddGroundOverlayOption {
/** 图片覆盖的经纬度范围 */
bounds: MapBounds
/** 图片图层 id */
- id: string
+ id: number
/** 图片路径,支持网络图片、临时路径、代码包路径 */
src: string
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
@@ -121,6 +149,45 @@ declare namespace WechatMiniprogram {
/** 接口调用成功的回调函数 */
success?: AddMarkersSuccessCallback
}
+ interface AddPaymentPassFinishOption {
+ /** base64格式,详见PKAddPaymentPassRequest */
+ activationData: string
+ /** base64格式,详见PKAddPaymentPassRequest */
+ encryptedPassData: string
+ /** base64格式,详见PKAddPaymentPassRequest */
+ ephemeralPublicKey: string
+ /** addPaymentPassGetCertificateData传入的id */
+ panid: string
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: AddPaymentPassFinishCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: AddPaymentPassFinishFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: AddPaymentPassFinishSuccessCallback
+ }
+ interface AddPaymentPassGetCertificateDataOption {
+ /** 0: Payment 1: Access */
+ style: number
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: AddPaymentPassGetCertificateDataCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: AddPaymentPassGetCertificateDataFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: AddPaymentPassGetCertificateDataSuccessCallback
+ }
+ interface AddPaymentPassGetCertificateDataSuccessCallbackOption {
+ /** 证书链,由PassKit生成,二进制转Base64数据 */
+ certificates: string[]
+ /** nonce,二进制转Base64数据 */
+ errnonceorMsg: string
+ /** 错误信息 */
+ errorMsg: string
+ /** 返回值 */
+ result: string
+ /** nonce签名,二进制转Base64数据 */
+ signNonce: string
+ errMsg: string
+ }
interface AddPhoneCalendarOption {
/** 开始时间的 unix 时间戳 */
startTime: number
@@ -142,6 +209,14 @@ declare namespace WechatMiniprogram {
fail?: AddPhoneCalendarFailCallback
/** 事件位置 */
location?: string
+ /** 需要基础库: `3.7.6`
+ *
+ * 跳转小程序路径,必须要和 signature 一起使用,填入后会自动生成跳转链接拼接在事件说明中 */
+ path?: string
+ /** 需要基础库: `3.7.6`
+ *
+ * 跳转小程序路径签名,必须要和 path 一起使用,用 session_key 对 path 签名得到的结果,即 `hmac_sha256(session_key, path)`。详见 [用户数据的签名验证和加解密](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html) */
+ signature?: string
/** 接口调用成功的回调函数 */
success?: AddPhoneCalendarSuccessCallback
}
@@ -238,10 +313,24 @@ declare namespace WechatMiniprogram {
fail?: AddPhoneRepeatCalendarFailCallback
/** 事件位置 */
location?: string
+ /** 需要基础库: `3.7.6`
+ *
+ * 跳转小程序路径,必须要和 signature 一起使用,填入后会自动生成跳转链接拼接在事件说明中 */
+ path?: string
/** 重复周期结束时间的 unix 时间戳,不填表示一直重复 */
repeatEndTime?: number
- /** 重复周期,默认 month 每月重复 */
- repeatInterval?: string
+ /** 重复周期,默认 month 每月重复
+ *
+ * 可选值:
+ * - 'day': 每天重复;
+ * - 'week': 每周重复;
+ * - 'month': 每月重复。该模式日期不能大于 28 日;
+ * - 'year': 每年重复; */
+ repeatInterval?: 'day' | 'week' | 'month' | 'year'
+ /** 需要基础库: `3.7.6`
+ *
+ * 跳转小程序路径签名,必须要和 path 一起使用,用 session_key 对 path 签名得到的结果,即 `hmac_sha256(session_key, path)`。详见 [用户数据的签名验证和加解密](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html) */
+ signature?: string
/** 接口调用成功的回调函数 */
success?: AddPhoneRepeatCalendarSuccessCallback
}
@@ -255,17 +344,74 @@ declare namespace WechatMiniprogram {
/** 接口调用成功的回调函数 */
success?: AddServiceSuccessCallback
}
+ interface AddVideoToFavoritesOption {
+ /** 要收藏的视频地址,必须为本地路径或临时路径 */
+ videoPath: string
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: AddVideoToFavoritesCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: AddVideoToFavoritesFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: AddVideoToFavoritesSuccessCallback
+ /** 缩略图路径,若留空则使用视频首帧 */
+ thumbPath?: string
+ }
+ interface AddVisualLayerOption {
+ /** 可视化图层id([创建图层指引](https://lbs.qq.com/dev/console/layers/layerEdit)) */
+ layerId: string
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: AddVisualLayerCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: AddVisualLayerFailCallback
+ /** 刷新周期,单位秒 */
+ interval?: number
+ /** 图层透明度 */
+ opacity?: number
+ /** 接口调用成功的回调函数 */
+ success?: AddVisualLayerSuccessCallback
+ /** 图层绘制顺序 */
+ zIndex?: number
+ }
/** 广播自定义参数 */
interface AdvertiseReqObj {
- /** 当前Service是否可连接 */
+ /** 需要基础库: `2.20.1`
+ *
+ * 以 beacon 设备形式广播的参数。 */
+ beacon?: BeaconInfoObj
+ /** 当前设备是否可连接 */
connectable?: boolean
- /** 广播中deviceName字段,默认为空 */
+ /** 广播中 deviceName 字段,默认为空 */
deviceName?: string
- /** 广播的制造商信息, 仅安卓支持 */
+ /** 广播的制造商信息。仅安卓支持,iOS 因系统限制无法定制。 */
manufacturerData?: ManufacturerData[]
- /** 要广播的serviceUuid列表 */
+ /** 要广播的服务 UUID 列表。使用 16/32 位 UUID 时请参考注意事项。 */
serviceUuids?: string[]
}
+ /** 订单金额信息。 */
+ interface Amount {
+ /** 订单总需支付金额,也即是真正下单总金额,单位为分。示例值:1300 */
+ order_amount: number
+ /** 货币类型。示例值:CNY
+ *
+ * 可选值:
+ * - 'CNY': 人民币; */
+ currency?: 'CNY'
+ /** 订单总计优惠金额,单位为分。示例值:500 */
+ discount?: number
+ /** 订单运费,单位为分。示例值:200 */
+ freight?: number
+ /** 订单其他费用总金额,单位为分。示例值:600 */
+ other_fee?: number
+ /** 订单所有商品的原价总和,单位为分。示例值:1000 */
+ product_amount?: number
+ }
+ /** 交易金额对象 */
+ interface AmountOption {
+ /** 交易币种,货币的符号采用ISO4217,3位大写字符进行表达。 */
+ currency: string
+ /** 交易金额,采用ISO4217标准中的最小货币单位进行表达,该值为整数,没有小数点。 */
+ total: number
+ }
/** animationData */
interface AnimationExportResult {
actions: IAnyObject[]
@@ -283,15 +429,58 @@ declare namespace WechatMiniprogram {
* - 'easeInOut': 动画以低速开始和结束; */
timingFunc?: 'linear' | 'easeIn' | 'easeOut' | 'easeInOut'
}
- interface AppendFileFailCallbackResult {
- /** 错误信息
+ interface AppAuthorizeSetting {
+ /** 允许微信使用相册的开关(仅 iOS 有效) */
+ albumAuthorized: 'authorized' | 'denied' | 'not determined'
+ /** 允许微信使用蓝牙的开关(安卓基础库 3.5.0 以上有效) */
+ bluetoothAuthorized: 'authorized' | 'denied' | 'not determined'
+ /** 允许微信使用摄像头的开关 */
+ cameraAuthorized: 'authorized' | 'denied' | 'not determined'
+ /** 允许微信使用定位的开关 */
+ locationAuthorized: 'authorized' | 'denied' | 'not determined'
+ /** 定位准确度。true 表示模糊定位,false 表示精确定位(仅 iOS 有效) */
+ locationReducedAccuracy: boolean
+ /** 允许微信使用麦克风的开关 */
+ microphoneAuthorized: 'authorized' | 'denied' | 'not determined'
+ /** 允许微信通知带有提醒的开关(仅 iOS 有效) */
+ notificationAlertAuthorized: 'authorized' | 'denied' | 'not determined'
+ /** 允许微信通知的开关 */
+ notificationAuthorized: 'authorized' | 'denied' | 'not determined'
+ /** 允许微信通知带有标记的开关(仅 iOS 有效) */
+ notificationBadgeAuthorized: 'authorized' | 'denied' | 'not determined'
+ /** 允许微信通知带有声音的开关(仅 iOS 有效) */
+ notificationSoundAuthorized: 'authorized' | 'denied' | 'not determined'
+ /** 允许微信读写日历的开关 */
+ phoneCalendarAuthorized: 'authorized' | 'denied' | 'not determined'
+ }
+ interface AppBaseInfo {
+ /** 客户端基础库版本 */
+ SDKVersion: string
+ /** 是否已打开调试。可通过右上角菜单或 [wx.setEnableDebug](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/wx.setEnableDebug.html) 打开调试。 */
+ enableDebug: boolean
+ /** 微信字体大小缩放比例 */
+ fontSizeScaleFactor: number
+ /** 需要基础库: `2.23.4`
+ *
+ * 微信字体大小,单位px */
+ fontSizeSetting: number
+ /** 当前小程序运行的宿主环境 */
+ host: AppBaseInfoHost
+ /** 微信设置的语言 */
+ language: string
+ /** 微信版本号 */
+ version: string
+ /** 系统当前主题,取值为`light`或`dark`,全局配置`"darkmode":true`时才能获取,否则为 undefined (不支持小游戏)
*
* 可选值:
- * - 'fail no such file or directory, open ${filePath}': 指定的 filePath 文件不存在;
- * - 'fail illegal operation on a directory, open "${filePath}"': 指定的 filePath 是一个已经存在的目录;
- * - 'fail permission denied, open ${dirPath}': 指定的 filePath 路径没有写权限;
- * - 'fail sdcard not mounted': Android sdcard 挂载失败; */
- errMsg: string
+ * - 'dark': 深色主题;
+ * - 'light': 浅色主题; */
+ theme?: 'dark' | 'light'
+ }
+ /** 当前小程序运行的宿主环境 */
+ interface AppBaseInfoHost {
+ /** 宿主 app(第三方App) 对应的 appId (当小程序运行在第三方App环境时才返回) */
+ appId: string
}
interface AppendFileOption {
/** 要追加的文本或二进制数据 */
@@ -331,8 +520,194 @@ declare namespace WechatMiniprogram {
/** 接口调用成功的回调函数 */
success?: AppendFileSuccessCallback
}
+ interface ApplyBlusherStickMakeupOption {
+ /** 上色程度 0-1 */
+ alpha: number
+ blendMode: string
+ /** 左腮红资源路径 */
+ path: string
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: ApplyBlusherStickMakeupCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: ApplyBlusherStickMakeupFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: ApplyBlusherStickMakeupSuccessCallback
+ }
+ interface ApplyEyeBrowMakeupOption {
+ /** 上色程度 0-1 */
+ alpha: number
+ blendMode: string
+ path: string
+ shrinkRate: number
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: ApplyEyeBrowMakeupCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: ApplyEyeBrowMakeupFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: ApplyEyeBrowMakeupSuccessCallback
+ }
+ interface ApplyEyeShadowMakeupOption {
+ /** 上色程度 0-1 */
+ alpha: number
+ blendMode: string
+ /** 眼影资源路径 */
+ path: string
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: ApplyEyeShadowMakeupCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: ApplyEyeShadowMakeupFailCallback
+ /** 细致效果图片资源路径 */
+ shimmerPosition?: string
+ /** 细致效果图片资源 md5 */
+ shimmerPositionMD5?: string
+ /** 接口调用成功的回调函数 */
+ success?: ApplyEyeShadowMakeupSuccessCallback
+ }
+ interface ApplyFaceContourMakeupOption {
+ alpha: number
+ /** 高光资源路径 */
+ path: string
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: ApplyFaceContourMakeupCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: ApplyFaceContourMakeupFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: ApplyFaceContourMakeupSuccessCallback
+ }
+ interface ApplyFilterOption {
+ /** 滤镜效果透明度,范围是 0-1 */
+ alpha: number
+ /** 滤镜资源路径 */
+ path: string
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: ApplyFilterCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: ApplyFilterFailCallback
+ /** 滤镜资源 md5 */
+ md5?: string
+ /** 接口调用成功的回调函数 */
+ success?: ApplyFilterSuccessCallback
+ }
+ interface ApplyLipStickMakeupOption {
+ /** 上色程度 0-1 */
+ alpha: number
+ blendMode: string
+ faceModel: string
+ path: string
+ shimmerPath: string
+ shimmerType: string
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: ApplyLipStickMakeupCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: ApplyLipStickMakeupFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: ApplyLipStickMakeupSuccessCallback
+ }
+ interface ApplyStickerOption {
+ /** 贴纸类型 */
+ stickers: Sticker[]
+ /** 贴纸类型 */
+ type: string
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: ApplyStickerCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: ApplyStickerFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: ApplyStickerSuccessCallback
+ templateTransSet?: IAnyObject
+ }
+ interface Asset {
+ src: string
+ /** 可选值:
+ * - 'font': 字体;
+ * - 'image': 图片; */
+ type: 'font' | 'image'
+ }
+ /** 需要基础库: `2.19.0`
+ *
+ * AudioBuffer接口表示存在内存里的一段短小的音频资源,利用[WebAudioContext.decodeAudioData](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.decodeAudioData.html)方法从一个音频文件构建,或者利用 [WebAudioContext.createBuffer](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createBuffer.html)从原始数据构建。把音频放入AudioBuffer后,可以传入到一个 AudioBufferSourceNode进行播放。 */
+ interface AudioBuffer {
+ /** 返回存储在缓存区的PCM数据的时长(单位为秒) */
+ duration: number
+ /** 返回存储在缓存区的PCM数据的采样帧率 */
+ length: number
+ /** 储存在缓存区的PCM数据的通道数 */
+ numberOfChannels: number
+ /** 存储在缓存区的PCM数据的采样率(单位为sample/s) */
+ sampleRate: number
+ /** [AudioBuffer.copyFromChannel()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioBuffer.copyFromChannel.html)
+ *
+ * 在插件中使用:不支持
+ *
+ * 从AudioBuffer的指定频道复制到数组终端。 */
+ copyFromChannel(): void
+ /** [AudioBuffer.copyToChannel(Float32Array source, number channelNumber, number startInChannel)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioBuffer.copyToChannel.html)
+ *
+ * 在插件中使用:不支持
+ *
+ * 从指定数组复制样本到audioBuffer的特定通道
+ *
+ * **示例代码**
+ *
+ * 示例代码参考AudioBuffer.copyFromChannel */
+ copyToChannel(
+ /** 需要复制的源数组 */
+ source: Float32Array,
+ /** 需要复制到的目的通道号 */
+ channelNumber: number,
+ /** 复制偏移数据量 */
+ startInChannel: number
+ ): void
+ /** [Float32Array AudioBuffer.getChannelData(number channel)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioBuffer.getChannelData.html)
+ *
+ * 在插件中使用:不支持
+ *
+ * 返回一个 Float32Array,包含了带有频道的PCM数据,由频道参数定义(有0代表第一个频道) */
+ getChannelData(
+ /** 要获取特定通道数据的索引 */
+ channel: number
+ ): Float32Array
+ }
+ /** 空间音频监听器,代表在一个音频场景内唯一的位置和方向信息。 */
+ interface AudioListener {
+ /** 表示监听器的前向系统在同一笛卡尔坐标系中的水平位置,作为位置(位置x,位置和位置和位置)值。 */
+ forwardX: number
+ /** 表示听众的前向方向在同一笛卡尔坐标系中作为位置(位置x,位置和位置和位置)值的垂直位置。 */
+ forwardY: number
+ /** 表示与position (positionX、positionY和positionZ)值在同一笛卡尔坐标系下的听者前进方向的纵向(前后)位置。 */
+ forwardZ: number
+ /** 右手笛卡尔坐标系中X轴的位置。 */
+ positionX: number
+ /** 右手笛卡尔坐标系中Y轴的位置。 */
+ positionY: number
+ /** 右手笛卡尔坐标系中Z轴的位置。 */
+ positionZ: number
+ /** 设置监听器的方向 */
+ setOrientation: (...args: any[]) => any
+ /** 设置监听器的位置 */
+ setPosition: (...args: any[]) => any
+ /** 表示在与position (positionX、positionY和positionZ)值相同的笛卡尔坐标系中侦听器向前方向的水平位置。 */
+ upX: number
+ /** 表示在与position (positionX、positionY和positionZ)值相同的笛卡尔坐标系中侦听器向上方向的水平位置。 */
+ upY: number
+ /** 表示在与position (positionX、positionY和positionZ)值相同的笛卡尔坐标系中侦听器向后方向的水平位置。 */
+ upZ: number
+ }
+ /** 需要基础库: `2.19.0`
+ *
+ * AudioParam 接口代表音频相关的参数,通常是 AudioNode(例如 GainNode.gain)的参数 */
+ interface AudioParam {
+ /** 代表被具体的 AudioNode 创建的 AudioParam 的属性的初始值(只读) */
+ defaultValue: number
+ /** 代表参数有效范围的最大可能值(只读) */
+ maxValue: number
+ /** 代表参数有效范围的最小可能值(只读) */
+ minValue: number
+ /** 当前属性的值(比如音量值或播放倍速值)(可读可写) */
+ value: number
+ }
interface AuthPrivateMessageOption {
- /** shareTicket。可以从 wx.onShow 中获取。详情 [shareTicket](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html) */
+ /** shareTicket。可以从 wx.getEnterOptionsSync 中获取。详情 [shareTicket](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html) */
shareTicket: string
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: AuthPrivateMessageCompleteCallback
@@ -353,19 +728,27 @@ declare namespace WechatMiniprogram {
}
/** 用户授权设置信息,详情参考[权限](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html) */
interface AuthSetting {
+ /** 是否授权系统日历,对应接口 [wx.addPhoneRepeatCalendar](https://developers.weixin.qq.com/miniprogram/dev/api/device/calendar/wx.addPhoneRepeatCalendar.html)、[wx.addPhoneCalendar](https://developers.weixin.qq.com/miniprogram/dev/api/device/calendar/wx.addPhoneCalendar.html) */
+ 'scope.addPhoneCalendar'?: boolean
+ /** 是否添加通讯录联系人,对应接口 [wx.addPhoneContact](https://developers.weixin.qq.com/miniprogram/dev/api/device/contact/wx.addPhoneContact.html) */
+ 'scope.addPhoneContact'?: boolean
/** 是否授权通讯地址,已取消此项授权,会默认返回true */
'scope.address'?: boolean
+ /** 是否授权蓝牙,对应接口 [wx.openBluetoothAdapter](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.openBluetoothAdapter.html)、[wx.createBLEPeripheralServer](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/wx.createBLEPeripheralServer.html) */
+ 'scope.bluetooth'?: boolean
/** 是否授权摄像头,对应[[camera](https://developers.weixin.qq.com/miniprogram/dev/component/camera.html)](https://developers.weixin.qq.com/miniprogram/dev/component/camera.html) 组件 */
'scope.camera'?: boolean
/** 是否授权获取发票,已取消此项授权,会默认返回true */
'scope.invoice'?: boolean
/** 是否授权发票抬头,已取消此项授权,会默认返回true */
'scope.invoiceTitle'?: boolean
- /** 是否授权录音功能,对应接口 [wx.startRecord](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/wx.startRecord.html) */
+ /** 是否授权录音功能,对应接口 [wx.getRecorderManager](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/wx.getRecorderManager.html) */
'scope.record'?: boolean
+ /** 是否授权模糊地理位置,对应接口 [wx.getFuzzyLocation](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.getFuzzyLocation.html) */
+ 'scope.userFuzzyLocation'?: boolean
/** 是否授权用户信息,对应接口 [wx.getUserInfo](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/user-info/wx.getUserInfo.html) */
'scope.userInfo'?: boolean
- /** 是否授权地理位置,对应接口 [wx.getLocation](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.getLocation.html), [wx.chooseLocation](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.chooseLocation.html) */
+ /** 是否授权精确地理位置,对应接口 [wx.getLocation](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.getLocation.html), [wx.chooseLocation](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.chooseLocation.html) */
'scope.userLocation'?: boolean
/** 是否授权微信运动步数,对应接口 [wx.getWeRunData](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/werun/wx.getWeRunData.html) */
'scope.werun'?: boolean
@@ -373,7 +756,7 @@ declare namespace WechatMiniprogram {
'scope.writePhotosAlbum'?: boolean
}
interface AuthorizeForMiniProgramOption {
- /** 需要获取权限的 scope,详见 [scope 列表]((authorize#scope-列表))
+ /** 需要获取权限的 scope,详见 [scope 列表](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html#scope-列表)
*
* 可选值:
* - 'scope.record': ;
@@ -388,7 +771,7 @@ declare namespace WechatMiniprogram {
success?: AuthorizeForMiniProgramSuccessCallback
}
interface AuthorizeOption {
- /** 需要获取权限的 scope,详见 [scope 列表]((authorize#scope-列表)) */
+ /** 需要获取权限的 scope,详见 [scope 列表](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html#scope-列表) */
scope: string
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: AuthorizeCompleteCallback
@@ -397,23 +780,27 @@ declare namespace WechatMiniprogram {
/** 接口调用成功的回调函数 */
success?: AuthorizeSuccessCallback
}
- /** 设备特征值列表 */
+ /** 设备特征列表 */
interface BLECharacteristic {
- /** 该特征值支持的操作类型 */
+ /** 该特征支持的操作类型 */
properties: BLECharacteristicProperties
- /** 蓝牙设备特征值的 uuid */
+ /** 蓝牙设备特征的 UUID */
uuid: string
}
- /** 该特征值支持的操作类型 */
+ /** 该特征支持的操作类型 */
interface BLECharacteristicProperties {
- /** 该特征值是否支持 indicate 操作 */
+ /** 该特征是否支持 indicate 操作 */
indicate: boolean
- /** 该特征值是否支持 notify 操作 */
+ /** 该特征是否支持 notify 操作 */
notify: boolean
- /** 该特征值是否支持 read 操作 */
+ /** 该特征是否支持 read 操作 */
read: boolean
- /** 该特征值是否支持 write 操作 */
+ /** 该特征是否支持 write 操作 */
write: boolean
+ /** 该特征是否支持有回复写操作 */
+ writeDefault: boolean
+ /** 该特征是否支持无回复写操作 */
+ writeNoResponse: boolean
}
interface BLEPeripheralServerCloseOption {
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
@@ -427,21 +814,20 @@ declare namespace WechatMiniprogram {
interface BLEPeripheralService {
/** characteristics列表 */
characteristics: Characteristic[]
- /** service 的 uuid */
+ /** 蓝牙服务的 UUID */
uuid: string
}
/** 设备服务列表 */
interface BLEService {
/** 该服务是否为主服务 */
isPrimary: boolean
- /** 蓝牙设备服务的 uuid */
+ /** 蓝牙设备服务的 UUID */
uuid: string
}
/** BackgroundAudioManager 实例,可通过 [wx.getBackgroundAudioManager](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.getBackgroundAudioManager.html) 获取。
*
* **示例代码**
*
-*
* ```js
const backgroundAudioManager = wx.getBackgroundAudioManager()
@@ -450,9 +836,13 @@ backgroundAudioManager.epname = '此时此刻'
backgroundAudioManager.singer = '许巍'
backgroundAudioManager.coverImgUrl = 'http://y.gtimg.cn/music/photo_new/T002R300x300M000003rsKF44GyaSk.jpg?max_age=2592000'
// 设置了 src 之后会自动播放
-backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb.mp3?guid=ffffffff82def4af4b12b3cd9337d5e7&uin=346897220&vkey=6292F51E1E384E061FF02C31F716658E5C81F5594D561F2E88B854E81CAAB7806D5E4F103E55D33C16F3FAC506D1AB172DE8600B37E43FAD&fromtag=46'
+backgroundAudioManager.src = 'https://wx_test.mp3'
``` */
interface BackgroundAudioManager {
+ /** 需要基础库: `3.4.8`
+ *
+ * 音频类型。可设置 "audio" 和 "music" 两种值,默认为 "audio"。不同音频类型对应的播放器样式不一样(实验特性,目前仅iOS和Android端支持) */
+ audioType: string
/** 音频已缓冲的时间,仅保证当前播放时间点到此时间点内容已缓冲。(只读) */
buffered: number
/** 封面图 URL,用于做原生音频播放器背景图。原生音频播放器中的分享功能,分享出去的卡片配图及背景也将使用该图。 */
@@ -465,14 +855,22 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
epname: string
/** 当前是否暂停或停止。(只读) */
paused: boolean
- /** 播放速度。范围 0.5-2.0,默认为 1。(Android 需要 6 及以上版本)
+ /** 需要基础库: `2.11.0`
*
- * 最低基础库: `2.11.0` */
+ * 播放速度。范围 0.5-2.0,默认为 1。(Android 需要 6 及以上版本) */
playbackRate: number
- /** 音频协议。默认值为 'http',设置 'hls' 可以支持播放 HLS 协议的直播音频。
+ /** 需要基础库: `1.9.94`
*
- * 最低基础库: `1.9.94` */
+ * 音频协议。默认值为 'http',设置 'hls' 可以支持播放 HLS 协议的直播音频。 */
protocol: string
+ /** 需要基础库: `3.4.8`
+ *
+ * 关联页面路径。设置后,当点击播放器上的小程序跳转链接时,将跳转到这个关联页面路径(实验特性,目前仅Android端支持) */
+ referrerPath: string
+ /** 需要基础库: `2.13.0`
+ *
+ * `origin`: 发送完整的referrer; `no-referrer`: 不发送。格式固定为 `https://servicewechat.com/{appid}/{version}/page-frame.html`,其中 {appid} 为小程序的 appid,{version} 为小程序的版本号,版本号为 0 表示为开发版、体验版以及审核版本,版本号为 devtools 表示为开发者工具,其余为正式版本; */
+ referrerPolicy: string
/** 歌手名,原生音频播放器中的分享功能,分享出去的卡片简介,也将使用该值。 */
singer: string
/** 音频的数据源([2.2.3](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 开始支持云文件ID)。默认为空字符串,**当设置了新的 src 时,会自动开始播放**,目前支持的格式有 m4a, aac, mp3, wav。 */
@@ -483,15 +881,231 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
title: string
/** 页面链接,原生音频播放器中的分享功能,分享出去的卡片简介,也将使用该值。 */
webUrl: string
+ /** [BackgroundAudioManager.onCanplay(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onCanplay.html)
+ *
+ * 在插件中使用:支持
+ *
+ * 监听背景音频进入可播放状态事件。 但不保证后面可以流畅播放 */
+ onCanplay(
+ /** 背景音频进入可播放状态事件的监听函数 */
+ listener: OnCanplayCallback
+ ): void
+ /** [BackgroundAudioManager.onEnded(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onEnded.html)
+ *
+ * 在插件中使用:支持
+ *
+ * 监听背景音频自然播放结束事件 */
+ onEnded(
+ /** 背景音频自然播放结束事件的监听函数 */
+ listener: OnEndedCallback
+ ): void
+ /** [BackgroundAudioManager.onError(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onError.html)
+ *
+ * 在插件中使用:支持
+ *
+ * 监听背景音频播放错误事件 */
+ onError(
+ /** 背景音频播放错误事件的监听函数 */
+ listener: BackgroundAudioManagerOnErrorCallback
+ ): void
+ /** [BackgroundAudioManager.onNext(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onNext.html)
+ *
+ * 在插件中使用:支持
+ *
+ * 监听用户在系统音乐播放面板点击下一曲事件 */
+ onNext(
+ /** 用户在系统音乐播放面板点击下一曲事件的监听函数 */
+ listener: OnNextCallback
+ ): void
+ /** [BackgroundAudioManager.onPause(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onPause.html)
+ *
+ * 在插件中使用:支持
+ *
+ * 监听背景音频暂停事件 */
+ onPause(
+ /** 背景音频暂停事件的监听函数 */
+ listener: OnPauseCallback
+ ): void
+ /** [BackgroundAudioManager.onPlay(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onPlay.html)
+ *
+ * 在插件中使用:支持
+ *
+ * 监听背景音频播放事件 */
+ onPlay(
+ /** 背景音频播放事件的监听函数 */
+ listener: OnPlayCallback
+ ): void
+ /** [BackgroundAudioManager.onPrev(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onPrev.html)
+ *
+ * 在插件中使用:支持
+ *
+ * 监听用户在系统音乐播放面板点击上一曲事件 */
+ onPrev(
+ /** 用户在系统音乐播放面板点击上一曲事件的监听函数 */
+ listener: OnPrevCallback
+ ): void
+ /** [BackgroundAudioManager.onSeeked(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onSeeked.html)
+ *
+ * 在插件中使用:支持
+ *
+ * 监听背景音频完成跳转操作事件 */
+ onSeeked(
+ /** 背景音频完成跳转操作事件的监听函数 */
+ listener: OnSeekedCallback
+ ): void
+ /** [BackgroundAudioManager.onSeeking(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onSeeking.html)
+ *
+ * 在插件中使用:支持
+ *
+ * 监听背景音频开始跳转操作事件 */
+ onSeeking(
+ /** 背景音频开始跳转操作事件的监听函数 */
+ listener: OnSeekingCallback
+ ): void
+ /** [BackgroundAudioManager.onStop(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onStop.html)
+ *
+ * 在插件中使用:支持
+ *
+ * 监听背景音频停止事件 */
+ onStop(
+ /** 背景音频停止事件的监听函数 */
+ listener: InnerAudioContextOnStopCallback
+ ): void
+ /** [BackgroundAudioManager.onTimeUpdate(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onTimeUpdate.html)
+ *
+ * 在插件中使用:支持
+ *
+ * 监听背景音频播放进度更新事件,只有小程序在前台时会回调。 */
+ onTimeUpdate(
+ /** 背景音频播放进度更新事件的监听函数 */
+ listener: OnTimeUpdateCallback
+ ): void
+ /** [BackgroundAudioManager.onWaiting(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onWaiting.html)
+ *
+ * 在插件中使用:支持
+ *
+ * 监听音频加载中事件。当音频因为数据不足,需要停下来加载时会触发 */
+ onWaiting(
+ /** 音频加载中事件的监听函数 */
+ listener: OnWaitingCallback
+ ): void
+ /** [BackgroundAudioManager.pause()](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.pause.html)
+ *
+ * 在插件中使用:支持
+ *
+ * 暂停音乐 */
+ pause(): void
+ /** [BackgroundAudioManager.play()](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.play.html)
+ *
+ * 在插件中使用:支持
+ *
+ * 播放音乐 */
+ play(): void
+ /** [BackgroundAudioManager.seek(number currentTime)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.seek.html)
+ *
+ * 在插件中使用:支持
+ *
+ * 跳转到指定位置 */
+ seek(
+ /** 跳转的位置,单位 s。精确到小数点后 3 位,即支持 ms 级别精确度 */
+ currentTime: number
+ ): void
+ /** [BackgroundAudioManager.stop()](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.stop.html)
+ *
+ * 在插件中使用:支持
+ *
+ * 停止音乐 */
+ stop(): void
+ }
+ interface BatchGetStorageOption {
+ /** 本地缓存中指定的 keyList */
+ keyList: string[]
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: BatchGetStorageCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: BatchGetStorageFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: BatchGetStorageSuccessCallback
+ }
+ interface BatchSetStorageOption {
+ /** [{ key, value }] */
+ kvList: any[]
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: BatchSetStorageCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: BatchSetStorageFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: BatchSetStorageSuccessCallback
+ }
+ /** Beacon 设备 */
+ interface BeaconInfo {
+ /** Beacon 设备的距离,单位 m。iOS 上,proximity 为 0 时,accuracy 为 -1。 */
+ accuracy: number
+ /** Beacon 设备的主 ID */
+ major: number
+ /** Beacon 设备的次 ID */
+ minor: number
+ /** 表示设备距离的枚举值(仅iOS)
+ *
+ * 可选值:
+ * - 0: 信号太弱不足以计算距离,或非 iOS 设备;
+ * - 1: 十分近;
+ * - 2: 比较近;
+ * - 3: 远; */
+ proximity: 0 | 1 | 2 | 3
+ /** 表示设备的信号强度,单位 dBm */
+ rssi: number
+ /** Beacon 设备广播的 UUID */
+ uuid: string
+ }
+ /** 需要基础库: `2.20.1`
+ *
+ * 以 beacon 设备形式广播的参数。 */
+ interface BeaconInfoObj {
+ /** Beacon 设备的主 ID */
+ major: number
+ /** Beacon 设备的次 ID */
+ minor: number
+ /** Beacon 设备广播的 UUID */
+ uuid: string
+ /** 用于判断距离设备 1 米时 RSSI 大小的参考值 */
+ measuredPower?: number
+ }
+ interface BindEmployeeRelationOption {
+ /** 订阅消息模板id列表,一次最多传入6条;如果传入则会在绑定成功后自动拉起订阅消息列表页面。 */
+ tmplIds: string[]
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: BindEmployeeRelationCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: BindEmployeeRelationFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: BindEmployeeRelationSuccessCallback
+ }
+ interface BindEmployeeRelationSuccessCallbackResult {
+ /** [TEMPLATE_ID]是动态的键,即模板消息id,值包括'accept'、'reject'。'accept'表示用户同意订阅该条id对应的模板消息,'reject'表示用户拒绝订阅该条id对应的模板消息。例如 { zun-LzcQyW-edafCVvzPkK4de2Rllr1fFpw2A_x0oXE: "accept"} 表示用户同意订阅zun-LzcQyW-edafCVvzPkK4de2Rllr1fFpw2A_x0oXE这条消息 */
+ [TEMPLATE_ID: string]: string
+ /** 绑定状态
+ *
+ * 可选值:
+ * - 'accept': 已绑定;
+ * - 'reject': 已拒绝; */
+ bindingStatus: 'accept' | 'reject'
+ errMsg: string
+ }
+ interface BindWifiOption {
+ /** 当前 wifi 网络的 BSSID ,可通过 wx.getConnectedWifi 获取 */
+ BSSID: string
}
interface BlueToothDevice {
- /** 当前蓝牙设备的信号强度 */
+ /** 当前蓝牙设备的信号强度,单位 dBm */
RSSI: number
/** 当前蓝牙设备的广播数据段中的 ManufacturerData 数据段。 */
advertisData: ArrayBuffer
/** 当前蓝牙设备的广播数据段中的 ServiceUUIDs 数据段 */
advertisServiceUUIDs: string[]
- /** 用于区分设备的 id */
+ /** 当前蓝牙设备是否可连接( Android 8.0 以下不支持返回该值 ) */
+ connectable: boolean
+ /** 蓝牙设备 id */
deviceId: string
/** 当前蓝牙设备的广播数据段中的 LocalName 数据段 */
localName: string
@@ -515,6 +1129,19 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
/** 接口调用成功的回调函数 */
success?: BlurSuccessCallback
}
+ /** 需要基础库: `2.28.0`
+ *
+ * 人体检测配置。用法详情[指南文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/visionkit/body.html)。 */
+ interface BodyTrack {
+ /** 需要基础库: `2.28.0`
+ *
+ * 人体检测模式
+ *
+ * 可选值:
+ * - 1: 通过摄像头实时检测;
+ * - 2: 静态图片检测; */
+ mode: 1 | 2
+ }
interface BoundingClientRectCallbackResult {
/** 节点的下边界坐标 */
bottom: number
@@ -548,14 +1175,426 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
/** 宽度 */
width: number
}
+ /** 音频源节点,通过 [WebAudioContext.createBufferSource](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createBufferSource.html)方法获得。
+*
+* **示例代码**
+*
+* ```js
+const source = audioCtx.createBufferSource()
+source.buffer = AudioBuffer
+source.connect(audioCtx.destination)
+source.start()
+``` */
+ interface BufferSourceNode {
+ /** [AudioBuffer](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioBuffer.html)
+ *
+ * 是一个 AudioBuffer, 它定义了要播放的音频,当设置它的值为 0 时,它会定义一个静默的单通道。(可读可写) */
+ buffer: AudioBuffer
+ /** 定义音频是否循环播放(可读可写) */
+ loop?: boolean
+ /** 定义音频循环播放时,结束播放的位置。单位是秒,默认值是0(可读可写) */
+ loopEnd?: number
+ /** 定义音频循环播放时,开始播放的位置。单位是秒,默认值是0(可读可写) */
+ loopStart?: number
+ /** 定义音频播放结束事件回调函数(可读可写) */
+ onended?: (...args: any[]) => any
+ /** [AudioParam](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioParam.html)
+ *
+ * 定义音频的播放倍速,数值越大速度越快,默认速度1.0,有效范围为 0 < playbackRate <= 2.0(可读可写) */
+ playbackRate?: AudioParam
+ /** [BufferSourceNode.connect(AudioNode|[AudioParam](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioParam.html) destination)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/BufferSourceNode.connect.html)
+ *
+ * 在插件中使用:不支持
+ *
+ * 连接到一个指定目标。这个指定的目标可能是另一个 AudioNode(从而将音频数据引导到下一个指定节点)或一个AudioParam, 以便上一个节点的输出数据随着时间流逝能自动地对下一个参数值进行改变 */
+ connect(
+ /** 要建立连接的目标节点 */
+ destination: AudioNode | AudioParam
+ ): void
+ /** [BufferSourceNode.disconnect()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/BufferSourceNode.disconnect.html)
+ *
+ * 在插件中使用:不支持
+ *
+ * 与已连接的目标节点断开连接 */
+ disconnect(): void
+ /** [BufferSourceNode.start(number when, number offset, number duration)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/BufferSourceNode.start.html)
+ *
+ * 在插件中使用:不支持
+ *
+ * 音频源开始播放 */
+ start(
+ /** 延迟播放的时间,单位是秒。与 AudioContext 使用相同的时间坐标系统。如果 when 小于 AudioContext.currentTime, 或者是 0,声音立即被播放。 默认值是 0 */
+ when?: number,
+ /** 音频开始播放的位置,单位是秒。默认值是 0 */
+ offset?: number,
+ /** 音频播放的持续时间,单位是秒。如果这个参数没有被指定,声音播放到自然结束或者使用stop() 方法结束。使用这个参数的功能与调用 start(when, offset) 和调用 stop(when+duration)效果完全相同 */
+ duration?: number
+ ): void
+ /** [BufferSourceNode.stop(number when)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/BufferSourceNode.stop.html)
+ *
+ * 在插件中使用:不支持
+ *
+ * 停止播放 */
+ stop(
+ /** 延迟停止播放的时间,单位是秒。与 AudioContext 使用相同的时间坐标系统。省略此参数、指定值 0 或传递负值会使声音立即停止播放。 */
+ when?: number
+ ): void
+ }
+ /** 需要基础库: `2.24.0`
+ *
+ * 缓存管理器。全局只有唯一实例,一旦被创建出来即表示接入缓存管理器。其有以下几个能力:
+ *
+ * 1. 在网络通畅时,符合一定规则的用户网络请求(目前只包括普通 wx.request 请求)会被缓存。
+ * 2. 在网络通畅时,某些 wx api 调用会被缓存。
+ * 3. 进入弱网/离线状态时,会提供事件给用户,用户可以决定是否使用缓存返回。
+ * 4. 提供进入和退出弱网/离线状态的事件。
+ *
+ * > 1. 缓存管理器中涉及的网络请求如无特指,均指普通的 wx.request 异步请求,参数和返回值中均不考虑涉及 ArrayBuffer 或 TypedArray 的情形。
+ * > 2. 缓存管理器中的缓存不会占用 storage 空间,但是有大小限制,请勿在非必要的请求上使用缓存。 */
+ interface CacheManager {
+ /** 全局缓存有效时间 */
+ maxAge: number
+ /** 当前缓存模式
+ *
+ * 可选值:
+ * - 'weakNetwork': 默认值,弱网/离线使用缓存返回;
+ * - 'always': 总是使用缓存返回;
+ * - 'none': 不开启,后续可手动开启/停止使用缓存返回; */
+ mode: 'weakNetwork' | 'always' | 'none'
+ /** 全局 origin */
+ origin: string
+ /** 当前缓存管理器状态
+ *
+ * 可选值:
+ * - 0: 不使用缓存返回;
+ * - 1: 使用缓存返回;
+ * - 2: 未知; */
+ state: 0 | 1 | 2
+ /** [Array.<string> CacheManager.addRules(Array.<(string|RegExp|Record.<string, any>)> rules)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.addRules.html)
+ *
+ * 需要基础库: `2.24.0`
+ *
+ * 在插件中使用:不支持
+ *
+ * 批量添加规则,规则写法可参考 [CacheManager.addRule](https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.addRule.html)。 */
+ addRules(
+ /** 规则列表 */
+ rules: Array>
+ ): string[]
+ /** [CacheManager.clearCaches()](https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.clearCaches.html)
+ *
+ * 需要基础库: `2.24.0`
+ *
+ * 在插件中使用:不支持
+ *
+ * 清空所有缓存。 */
+ clearCaches(): void
+ /** [CacheManager.clearRules()](https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.clearRules.html)
+ *
+ * 需要基础库: `2.24.0`
+ *
+ * 在插件中使用:不支持
+ *
+ * 清空所有规则,同时会删除对应规则下所有缓存。 */
+ clearRules(): void
+ /** [CacheManager.deleteCache(string id)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.deleteCache.html)
+ *
+ * 需要基础库: `2.24.0`
+ *
+ * 在插件中使用:不支持
+ *
+ * 删除缓存。 */
+ deleteCache(
+ /** 缓存 id */
+ id: string
+ ): void
+ /** [CacheManager.deleteCaches(Array.<string> ids)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.deleteCaches.html)
+ *
+ * 需要基础库: `2.24.0`
+ *
+ * 在插件中使用:不支持
+ *
+ * 批量删除缓存。 */
+ deleteCaches(
+ /** 缓存 id 列表 */
+ ids: string[]
+ ): void
+ /** [CacheManager.deleteRule(string id)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.deleteRule.html)
+ *
+ * 需要基础库: `2.24.0`
+ *
+ * 在插件中使用:不支持
+ *
+ * 删除规则,同时会删除对应规则下所有缓存。 */
+ deleteRule(
+ /** 规则 id */
+ id: string
+ ): void
+ /** [CacheManager.deleteRules(Array.<string> ids)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.deleteRules.html)
+ *
+ * 需要基础库: `2.24.0`
+ *
+ * 在插件中使用:不支持
+ *
+ * 批量删除规则,同时会删除对应规则下所有缓存。 */
+ deleteRules(
+ /** 规则 id 列表 */
+ ids: string[]
+ ): void
+ /** [CacheManager.off(string eventName, function handler)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.off.html)
+ *
+ * 需要基础库: `2.24.0`
+ *
+ * 在插件中使用:不支持
+ *
+ * 取消事件监听。 */
+ off(
+ /** 事件名 */
+ eventName: string,
+ /** 事件句柄 */
+ handler: (...args: any[]) => any
+ ): void
+ /** [CacheManager.on(string eventName, function handler)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.on.html)
+*
+* 需要基础库: `2.24.0`
+*
+* 在插件中使用:不支持
+*
+* 监听事件。
+*
+* ****
+*
+* 这里 request 事件会提供 request 事件对象,用于做后续的处理;在 request 事件中需要返回一个 promise,用来生成 wx.request 请求的返回内容。
+* 这次 request 所返回的请求结果默认不会写入缓存中。如需写入缓存,可以传入参数 `request({ needUpdateCache: true })`
+*
+* #### 示例代码
+*
+* ```js
+async function handler(evt) {
+ // evt.url - 请求 url
+ // evt.data - 请求参数
+ // evt.method - 请求方法
+ // evt.request - 原始 request 方法,返回一个 promise
+
+ // if (evt.url === '/xxx') {
+ // // 如果有些请求仍然希望走到网络,则可以如下处理
+ // const res = await evt.request()
+ // // res 即为网络请求返回
+ // }
+
+ return new Promsie((resolve, reject) => {
+ // do sth
+ if (data) {
+ // 这里 resolve 的 data 就会作为 wx.request 的 success 回调结果返回
+ resolve(data)
+ } else {
+ // 这里 reject 的错误信息就会作为 wx.request 的 fail 回调结果返回
+ reject('no data')
+ }
+ })
+}
+cacheManager.on('request', handler)
+``` */
+ on(
+ /** 事件名
+ *
+ * 参数 eventName 可选值:
+ * - 'request': 发生 wx.request 请求,只在缓存管理器开启阶段会触发;
+ * - 'enterWeakNetwork': 进入弱网/离线状态;
+ * - 'exitWeakNetwork': 离开弱网/离线状态; */
+ eventName: 'request' | 'enterWeakNetwork' | 'exitWeakNetwork',
+ /** 事件句柄 */
+ handler: (...args: any[]) => any
+ ): void
+ /** [CacheManager.start()](https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.start.html)
+ *
+ * 需要基础库: `2.24.0`
+ *
+ * 在插件中使用:不支持
+ *
+ * 开启缓存,仅在 mode 为 none 时生效,调用后缓存管理器的 state 会置为 1。 */
+ start(): void
+ /** [CacheManager.stop()](https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.stop.html)
+ *
+ * 需要基础库: `2.24.0`
+ *
+ * 在插件中使用:不支持
+ *
+ * 关闭缓存,仅在 mode 为 none 时生效,调用后缓存管理器的 state 会置为 0。 */
+ stop(): void
+ /** [Object CacheManager.match(Object evt)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.match.html)
+*
+* 需要基础库: `2.24.0`
+*
+* 在插件中使用:不支持
+*
+* 匹配命中的缓存规则,一般需要和 request 事件搭配使用。
+*
+* **示例代码**
+*
+* ```js
+function handler(evt) {
+ const cache = cacheManager.match(evt)
+ // 若有重复监听,则取第一个 handler 返回的 promise
+ return new Promise((resolve, reject) => {
+ if (cache.data) {
+ resolve(cache.data)
+ } else {
+ reject('no cache')
+ }
+ })
+}
+cacheManager.on('request', handler)
+``` */
+ match(
+ /** request 事件对象 */
+ evt: IAnyObject
+ ): MatchCache
+ /** [string CacheManager.addRule(string|RegExp|Record.<string, any> rule)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.addRule.html)
+*
+* 需要基础库: `2.24.0`
+*
+* 在插件中使用:不支持
+*
+* 添加规则。
+*
+* **规则说明**
+*
+* 支持的规则写法有字符串、正则和对象三种:
+*
+* ### 字符串写法
+*
+* 1. `addRule('/abc')`:纯 uri 串。
+* 2. `addRule('GET /abc'):带方法的 uri 串,除了匹配 uri 外,还会匹配请求方法。如例子中必须是 GET 方法请求才会被匹配。
+* 3. `addRule('/abc/:id'):带可变部分的 uri 串,id 可以是任意符合标准的字符串,表示这一段可以动态变化。比如 `/abc/123` 和 `/abc/321` 都会被匹配,而 `/abc/123/xxx` 因为多了一段,就不会被匹配。
+* 4. `addRule('/abc?aa'):带 query 参数的 uri 串,包含 aa 参数,值可以为任意值。比如 `/abc?aa=haha` 会被匹配,但是 `/abc` 就不会被匹配,因为缺少规则中声明的 aa 参数;不过如果请求是 `/abc?aa=haha&bb=123`,虽然多带了 bb 参数,但是因为包含了 aa 参数,所以也可以被匹配。
+* 5. `addRule('/abc?dd=haha'):带 query 参数的 uri 串,包含 dd 参数且值为 haha。比如 `/abc?dd=haha` 和 `/abc?dd=haha&bb=123` 会被匹配,而 `/abc?dd=123` 就不会被匹配,因为规则要求了 dd 参数的值。
+*
+* > 以上写法中的 uri 串如果只有 path 部分,则会取全局 origin 进行补全。比如全局 origin 是 `https://weixin.qq.com`,而规则是 `/abc`,则会补全为 `https://weixin.qq.com/abc`。因此在前面例子中 `addRule('/abc')` 和 `addRule('https://weixin.qq.com/abc')` 的写法效果一致。所以一般情况下如果需要匹配的请求 origin 和全局 origin 一致,则规则中可忽略不写 orign。
+*
+* ### 正则写法
+*
+* 1. `addRule(/\/(abc|cba)$/ig)`:直接正则匹配请求的 uri,同时会比对请求 origin 和全局 origin 是否一致。
+* 2. `addRule(/^https:\/\/weixin.qq.com\/(abc|cba)$/ig)`:带有 orign 部分的正则表达式,则只匹配 uri,不再比对 origin。
+*
+* ### 对象写法
+*
+* 使用规则对象,可以更为详细的描述规则内容。(一般使用规则对象,是为了匹配请求参数)
+*
+* #### 规则对象:
+*
+* | 属性名 | 类型 | 默认值 | 备注 |
+* |---|---|---|---|
+* | id | string | | 规则 id,如果不填则会由基础库生成 |
+* | method | string | | 请求方法,可选值 GET/POST/PATCH/PUT/DELETE,如果为空则表示前面提到的所有方法都能被匹配到 |
+* | url | any | 必填 | uri 匹配规则,可参考规则字符串写法和正则写法 |
+* | maxAge | number | 7 * 24 * 60 * 60 * 1000 | 缓存有效时间,单位为 ms,不填则默认取缓存管理器全局的缓存有效时间 |
+* | dataSchema | Array\ | | 匹配请求参数 |
+*
+* 其中,dataSchema 用来匹配对象类型的请求参数(比如 wx.request 的 data),默认可以不填,即不做参数匹配。
+*
+* dataSchema 的类型是一个 DataRule 对象数组,一个 DataRule 对象描述一个参数,比如一个 wx.request 请求的 data 是 `{a: 123, b: 'haha', c: true}`,你想要用一条规则来匹配其中的 a 和 b 参数,如果 a 是数字且 b 是字符串就能命中该规则,那么就需要在 dataSchema 中补充两个 DataRule 对象,即 `[{name: 'a', schema: {type: 'number'}}, {name: 'b', schema: {type: 'string'}}]`。
+*
+* #### DataRule 对象:
+*
+* | 属性名 | 类型 | 默认值 | 备注 |
+* |---|---|---|---|
+* | name | string | | 需要匹配的参数名 |
+* | schema | DataSchema/Array\ | 需要匹配的参数模式,支持数组,表示该参数值有多种模式 |
+*
+* name 表示要匹配的参数名,schema 为 DataSchema 对象,用来描述该参数的类型和值。
+*
+* 一个 DataRule 对象也可以匹配可能拥有多种类型的参数,所以 schema 也支持为 DataSchema 对象数组。比如上述例子中,希望匹配的 a 参数必须是数值或者字符串,那么可以这么写:`{name: 'a', schema: [{type: 'number'}, {type: 'string'}]}`。
+*
+* #### DataSchema 对象:
+*
+* | 属性名 | 类型 | 默认值 | 备注 |
+* |---|---|---|---|
+* | type | string | | 需要匹配的 data 对象的参数类型,string、number、boolean、null、object、any(表示任意类型),同时支持数组模式(数组模式则在类型后面加 [],如 string[] 表示字符串数组) |
+* | value | string/regexp/function/Array\ | | 需要匹配的 data 对象的参数值,当 type 为基本类型时,可以用 string/regexp 来匹配固定的值,也可以通过 function 来确定值是否匹配,如果传入的 type 是 object,那么表示需要嵌套匹配值是否正确,可以传入 Array |
+*
+* type 参数表示要匹配的参数类型,value 表示要匹配的参数值。其中 value 支持多种写法,不同写法有如下匹配方式:
+*
+* 1. 字符串写法:直接判值的字符串形式是否和给定字符串一样,比如 value 值为 `123`,就要求参数值必须为 123 才能与之匹配。
+* 2. 正则写法:直接判值的字符串形式是否能被正则匹配,比如 value 值为 `/\d+/ig`,就要求参数值必须为数字,如果参数值为 `abc` 则不会被匹配。
+* 3. 函数写法:在匹配时会调用用户传入的函数,交由用户判断是否匹配。
+* 4. DataRule 数组写法:当参数类型为对象时,那么字符串写法和正则写法就无法使用,需要传入 DataRule 数组来进行匹配,即通过嵌套 DataRule 数组的方式来匹配嵌套的对象。
+*
+* ### 示例代码
+*
+* ```js
+const ruleId = cacheManager.addRule({
+ id: 'haha-rule',
+ method: 'GET',
+ url: '/haha',
+ maxAge: 123455,
+ dataSchema: [
+ // data 字段的匹配,默认为空,表示不匹配
+ // 类型可以是:string、number、boolean、null、object、any(表示任意类型均可),以及这些类型的数组表示方式
+ {name: 'aaa', schema: {type: 'string'}}, // 类型为 string
+ {name: 'bbb', schema: [{type: 'number'}, {type: 'string'}]}, // 类型为 number, string
+ {name: 'ccc', schema: {type: 'string', value: 'abc'}}, // 值为 abc
+ {name: 'ddd', schema: {type: 'string', value: /(abc|cba)/ig}}, // 值符合该正则匹配,如果该值不是字符串类型,则会被尝试转成字符串后再进行比较
+ {name: 'ddd', schema: {type: 'string', value: val => val === '123'}}, // 传入函数来校验值
+ {name: 'eee', schema: {type: 'object', value: [{ // 类型为对象,则通过嵌套的方式来逐层校验
+ name: 'aaa', schema: {type: 'string'},
+ // ...
+ // 嵌套 dataSchema,同上面的方式一样来匹配嵌套的对象
+ }]}},
+ {name: 'fff', schema: {type: 'string[]'}}, // 类型为 string 数组
+ {name: 'ggg', schema: {type: 'any'}}, // 类型为任意类型
+ {name: 'hhh', schema: {type: 'any[]'}}, // 类型为任意类型的数组
+ }],
+})
+```
+*
+* ### 补充说明
+*
+* 用户可以添加多条规则,每条规则都会去解析网络请求,然后判断是否命中规则。假设有多条规则命中,则取第一条命中的规则。
+*
+* ### 缓存覆盖
+*
+* 不同的网络请求也可能命中同一条规则,所以每条规则可能对应多个缓存。每条规则会有一个规则 id,每个缓存会有一个缓存 id,一个规则 id 可能对应多个缓存 id,而缓存管理器的缓存存储是基于缓存 id 标识的,如果两个不同的请求生成了同样的缓存 id,那么后发生的请求结果缓存会覆盖前者。因此使用时需要思考缓存的覆盖情况,目前缓存 id 生成方式如下:
+*
+* 1. 规则使用字符串写法:那么按 method + url + 规则中声明的 query 参数来生成缓存 id。
+*
+* > 需要注意的是这里不使用真实请求中的 query 参数来生成缓存 id,而是使用规则中匹配到的 query 来生成缓存 id。比如规则是 `/abc?aa=123`,请求是 GET 方法的 `/abc?aa=123&bb=123`,那么就会基于 `GET /abc?aa=123` 来生成缓存 id。而规则里没有声明 `bb=123`,所以 bb 参数不会被纳入缓存 id 的生成基准。
+*
+* 2. 规则使用正则写法:那么只按 method + url 生成缓存 id,不考虑 query 参数。
+* 3. 规则使用对象写法:如果规则对象中的 url 是字符串写法,那么按 method + url + 规则中声明的 query 参数 + 规则中 dataSchema 声明的请求参数来生成缓存 id;如果规则对象中的 url 是正则写法,那么按 method + url + 规则中 dataSchema 声明的请求参数来生成缓存 id。
+*
+* > 生成缓存 id 时没有使用请求中完整的 query 参数或者请求参数来作为基准,是考虑到很多请求可能会带上 token 或时间戳等参数。因为此参数存在不确定性,会导致每次请求生成的缓存 id 都不同,进而导致缓存命中率下降,故采取规则中声明的 query 参数和 dataSchema 声明的请求参数来作为生成缓存 id 的基准。 */
+ addRule(
+ /** 规则 */
+ rule: string | RegExp | Record
+ ): string
+ }
+ interface CameraContextSetZoomOption {
+ /** 缩放级别,范围[1, maxZoom]。zoom 可取小数,精确到小数后一位。maxZoom 可在 bindinitdone 返回值中获取。 */
+ zoom: number
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: SetZoomCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: SetZoomFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: CameraContextSetZoomSuccessCallback
+ }
interface CameraContextStartRecordOption {
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: StartRecordCompleteCallback
/** 接口调用失败的回调函数 */
fail?: StartRecordFailCallback
+ /** 需要基础库: `2.22.0`
+ *
+ * 是否开启镜像 */
+ selfieMirror?: boolean
/** 接口调用成功的回调函数 */
success?: CameraContextStartRecordSuccessCallback
- /** 超过30s或页面 `onHide` 时会结束录像 */
+ /** 需要基础库: `2.22.0`
+ *
+ * 录制时长上限,单位为秒,最长不能超过 5 分钟 */
+ timeout?: number
+ /** 超过录制时长上限时会结束录像并触发此回调,录像异常退出时也会触发此回调 */
timeoutCallback?: StartRecordTimeoutCallback
}
interface CameraContextStopRecordOption {
@@ -575,91 +1614,1842 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
fail?: StartFailCallback
/** 接口调用成功的回调函数 */
success?: StartSuccessCallback
+ /** [Worker](https://developers.weixin.qq.com/miniprogram/dev/api/worker/Worker.html)
+ *
+ * 需要基础库: `2.25.1`
+ *
+ * 可选参数。如果需要在 iOS ExperimentalWorker 内监听摄像头帧数据,则需要传入对应 Worker 对象。详情 [Worker.getCameraFrameData](https://developers.weixin.qq.com/miniprogram/dev/api/worker/Worker.getCameraFrameData.html) */
+ worker?: Worker
}
- /** Canvas 实例,可通过 [SelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html) 获取。
+ interface CanAddSecureElementPassOption {
+ /** 支付的panid(PrimaryAccountIdentifier) */
+ panid: string
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: CanAddSecureElementPassCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: CanAddSecureElementPassFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: CanAddSecureElementPassSuccessCallback
+ }
+ interface CanAddSecureElementPassSuccessCallbackOption {
+ /** 错误信息 */
+ errorMsg: string
+ /** 返回值 */
+ result: string
+ errMsg: string
+ }
+ /** 需要基础库: `2.7.0`
+ *
+ * Canvas 实例,可通过 [SelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html) 获取。
*
* **示例代码**
*
- *
- *
* 2D Canvas 示例
* [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/SHfgCmmq7UcM)
*
* WebGL 示例
- * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/qEGUOqmf7T8z)
- *
- * 最低基础库: `2.7.0` */
+ * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/qEGUOqmf7T8z) */
interface Canvas {
/** 画布高度 */
height: number
/** 画布宽度 */
width: number
+ /** [Canvas.cancelAnimationFrame(number requestID)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.cancelAnimationFrame.html)
+ *
+ * 需要基础库: `2.7.0`
+ *
+ * 在插件中使用:支持
+ *
+ * 取消由 requestAnimationFrame 添加到计划中的动画帧请求。支持在 2D Canvas 和 WebGL Canvas 下使用, 但不支持混用 2D 和 WebGL 的方法。 */
+ cancelAnimationFrame(requestID: number): void
+ /** [[ImageData](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/ImageData.html) Canvas.createImageData()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.createImageData.html)
+ *
+ * 需要基础库: `2.9.0`
+ *
+ * 在插件中使用:支持
+ *
+ * 创建一个 ImageData 对象。仅支持在 2D Canvas 中使用。 */
+ createImageData(): ImageData
+ /** [[Image](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Image.html) Canvas.createImage()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.createImage.html)
+ *
+ * 需要基础库: `2.7.0`
+ *
+ * 在插件中使用:支持
+ *
+ * 创建一个图片对象。 支持在 2D Canvas 和 WebGL Canvas 下使用, 但不支持混用 2D 和 WebGL 的方法。 */
+ createImage(): Image
+ /** [[Path2D](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Path2D.html) Canvas.createPath2D([Path2D](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Path2D.html) path)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.createPath2D.html)
+ *
+ * 需要基础库: `2.11.0`
+ *
+ * 在插件中使用:支持
+ *
+ * 创建 Path2D 对象 */
+ createPath2D(
+ /** [Path2D](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Path2D.html) */
+ path: Path2D
+ ): Path2D
+ /** [[RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) Canvas.getContext(string contextType)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.getContext.html)
+ *
+ * 需要基础库: `2.7.0`
+ *
+ * 在插件中使用:支持
+ *
+ * 该方法返回 Canvas 的绘图上下文
+ *
+ * ****
+ *
+ * 支持获取 2D 和 WebGL 绘图上下文 */
+ getContext(
+ /** 上下文类型
+ *
+ * 参数 contextType 可选值:
+ * - '2d': 2d 绘图上下文; */
+ contextType: '2d'
+ ): CanvasRenderingContext.CanvasRenderingContext2D
+ /** [[RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) Canvas.getContext(string contextType)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.getContext.html)
+ *
+ * 需要基础库: `2.7.0`
+ *
+ * 在插件中使用:支持
+ *
+ * 该方法返回 Canvas 的绘图上下文
+ *
+ * ****
+ *
+ * 支持获取 2D 和 WebGL 绘图上下文 */
+ getContext(
+ /** 上下文类型
+ *
+ * 参数 contextType 可选值:
+ * - 'webgl': webgl 绘图上下文; */
+ contextType: 'webgl'
+ ): CanvasRenderingContext.WebGLRenderingContext
+ /** [[RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) Canvas.getContext(string contextType)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.getContext.html)
+ *
+ * 需要基础库: `2.7.0`
+ *
+ * 在插件中使用:支持
+ *
+ * 该方法返回 Canvas 的绘图上下文
+ *
+ * ****
+ *
+ * 支持获取 2D 和 WebGL 绘图上下文 */
+ getContext(
+ /** 上下文类型
+ *
+ * 参数 contextType 可选值:
+ * - 'webgl2': webgl2 绘图上下文; */
+ contextType: 'webgl2'
+ ): CanvasRenderingContext.WebGL2RenderingContext
+ /** [number Canvas.requestAnimationFrame(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.requestAnimationFrame.html)
+ *
+ * 需要基础库: `2.7.0`
+ *
+ * 在插件中使用:支持
+ *
+ * 在下次进行重绘时执行。 支持在 2D Canvas 和 WebGL Canvas 下使用, 但不支持混用 2D 和 WebGL 的方法。 */
+ requestAnimationFrame(
+ /** 执行的 callback */
+ callback: (...args: any[]) => any
+ ): number
+ /** [string Canvas.toDataURL(string type, number encoderOptions)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.toDataURL.html)
+ *
+ * 需要基础库: `2.11.0`
+ *
+ * 在插件中使用:支持
+ *
+ * 返回一个包含图片展示的 data URI 。可以使用 type 参数其类型,默认为 PNG 格式。 */
+ toDataURL(
+ /** 图片格式,默认为 image/png */
+ type: string,
+ /** 在指定图片格式为 image/jpeg 或 image/webp的情况下,可以从 0 到 1 的区间内选择图片的质量。如果超出取值范围,将会使用默认值 0.92。其他参数会被忽略。 */
+ encoderOptions: number
+ ): string
}
- /** canvas 组件的绘图上下文。CanvasContext 是旧版的接口, 新版 Canvas 2D 接口与 Web 一致。 */
+ /** @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
+ *
+ * canvas 组件的绘图上下文。CanvasContext 是旧版的接口, 新版 Canvas 2D 接口与 Web 一致。 */
interface CanvasContext {
- /** 填充颜色。用法同 [CanvasContext.setFillStyle()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setFillStyle.html)。
+ /** 需要基础库: `1.9.90`
*
- * 最低基础库: `1.9.90` */
+ * 填充颜色。用法同 [CanvasContext.setFillStyle()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setFillStyle.html)。 */
fillStyle: string | CanvasGradient
- /** 当前字体样式的属性。符合 [CSS font 语法](https://developer.mozilla.org/zh-CN/docs/Web/CSS/font) 的 DOMString 字符串,至少需要提供字体大小和字体族名。默认值为 10px sans-serif。
+ /** 需要基础库: `1.9.90`
*
- * 最低基础库: `1.9.90` */
+ * 当前字体样式的属性。符合 [CSS font 语法](https://developer.mozilla.org/zh-CN/docs/Web/CSS/font) 的 DOMString 字符串,至少需要提供字体大小和字体族名。默认值为 10px sans-serif。 */
font: string
/** 全局画笔透明度。范围 0-1,0 表示完全透明,1 表示完全不透明。 */
globalAlpha: number
- /** 在绘制新形状时应用的合成操作的类型。目前安卓版本只适用于 `fill` 填充块的合成,用于 `stroke` 线段的合成效果都是 `source-over`。
+ /** 需要基础库: `1.9.90`
+ *
+ * 在绘制新形状时应用的合成操作的类型。目前安卓版本只适用于 `fill` 填充块的合成,用于 `stroke` 线段的合成效果都是 `source-over`。
*
* 目前支持的操作有
* - 安卓:xor, source-over, source-atop, destination-out, lighter, overlay, darken, lighten, hard-light
- * - iOS:xor, source-over, source-atop, destination-over, destination-out, lighter, multiply, overlay, darken, lighten, color-dodge, color-burn, hard-light, soft-light, difference, exclusion, saturation, luminosity
- *
- * 最低基础库: `1.9.90` */
+ * - iOS:xor, source-over, source-atop, destination-over, destination-out, lighter, multiply, overlay, darken, lighten, color-dodge, color-burn, hard-light, soft-light, difference, exclusion, saturation, luminosity */
globalCompositeOperation: string
- /** 线条的端点样式。用法同 [CanvasContext.setLineCap()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineCap.html)。
+ /** 需要基础库: `1.9.90`
*
- * 最低基础库: `1.9.90` */
+ * 线条的端点样式。用法同 [CanvasContext.setLineCap()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineCap.html)。 */
lineCap: string
- /** 虚线偏移量,初始值为0
+ /** 需要基础库: `1.9.90`
*
- * 最低基础库: `1.9.90` */
+ * 虚线偏移量,初始值为0 */
lineDashOffset: number
- /** 线条的交点样式。用法同 [CanvasContext.setLineJoin()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineJoin.html)。
+ /** 需要基础库: `1.9.90`
+ *
+ * 线条的交点样式。用法同 [CanvasContext.setLineJoin()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineJoin.html)。
*
* 可选值:
* - 'bevel': 斜角;
* - 'round': 圆角;
- * - 'miter': 尖角;
- *
- * 最低基础库: `1.9.90` */
+ * - 'miter': 尖角; */
lineJoin: 'bevel' | 'round' | 'miter'
- /** 线条的宽度。用法同 [CanvasContext.setLineWidth()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineWidth.html)。
+ /** 需要基础库: `1.9.90`
*
- * 最低基础库: `1.9.90` */
+ * 线条的宽度。用法同 [CanvasContext.setLineWidth()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineWidth.html)。 */
lineWidth: number
- /** 最大斜接长度。用法同 [CanvasContext.setMiterLimit()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setMiterLimit.html)。
+ /** 需要基础库: `1.9.90`
*
- * 最低基础库: `1.9.90` */
+ * 最大斜接长度。用法同 [CanvasContext.setMiterLimit()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setMiterLimit.html)。 */
miterLimit: number
- /** 阴影的模糊级别
+ /** 需要基础库: `1.9.90`
*
- * 最低基础库: `1.9.90` */
+ * 阴影的模糊级别 */
shadowBlur: number
- /** 阴影的颜色
+ /** 需要基础库: `1.9.90`
*
- * 最低基础库: `1.9.90` */
+ * 阴影的颜色 */
shadowColor: number
- /** 阴影相对于形状在水平方向的偏移
+ /** 需要基础库: `1.9.90`
*
- * 最低基础库: `1.9.90` */
+ * 阴影相对于形状在水平方向的偏移 */
shadowOffsetX: number
- /** 阴影相对于形状在竖直方向的偏移
+ /** 需要基础库: `1.9.90`
*
- * 最低基础库: `1.9.90` */
+ * 阴影相对于形状在竖直方向的偏移 */
shadowOffsetY: number
- /** 边框颜色。用法同 [CanvasContext.setStrokeStyle()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setStrokeStyle.html)。
+ /** 需要基础库: `1.9.90`
*
- * 最低基础库: `1.9.90` */
+ * 边框颜色。用法同 [CanvasContext.setStrokeStyle()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setStrokeStyle.html)。 */
strokeStyle: string | CanvasGradient
+ /** [CanvasContext.arc(number x, number y, number r, number sAngle, number eAngle, boolean counterclockwise)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.arc.html)
+*
+* 在插件中使用:支持
+* @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
+*
+* @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
+*
+* 创建一条弧线。
+*
+* - 创建一个圆可以指定起始弧度为 0,终止弧度为 2 * Math.PI。
+* - 用 `stroke` 或者 `fill` 方法来在 `canvas` 中画弧线。
+*
+* **示例代码**
+*
+* ```javascript
+const ctx = wx.createCanvasContext('myCanvas')
+
+// Draw coordinates
+ctx.arc(100, 75, 50, 0, 2 * Math.PI)
+ctx.setFillStyle('#EEEEEE')
+ctx.fill()
+
+ctx.beginPath()
+ctx.moveTo(40, 75)
+ctx.lineTo(160, 75)
+ctx.moveTo(100, 15)
+ctx.lineTo(100, 135)
+ctx.setStrokeStyle('#AAAAAA')
+ctx.stroke()
+
+ctx.setFontSize(12)
+ctx.setFillStyle('black')
+ctx.fillText('0', 165, 78)
+ctx.fillText('0.5*PI', 83, 145)
+ctx.fillText('1*PI', 15, 78)
+ctx.fillText('1.5*PI', 83, 10)
+
+// Draw points
+ctx.beginPath()
+ctx.arc(100, 75, 2, 0, 2 * Math.PI)
+ctx.setFillStyle('lightgreen')
+ctx.fill()
+
+ctx.beginPath()
+ctx.arc(100, 25, 2, 0, 2 * Math.PI)
+ctx.setFillStyle('blue')
+ctx.fill()
+
+ctx.beginPath()
+ctx.arc(150, 75, 2, 0, 2 * Math.PI)
+ctx.setFillStyle('red')
+ctx.fill()
+
+// Draw arc
+ctx.beginPath()
+ctx.arc(100, 75, 50, 0, 1.5 * Math.PI)
+ctx.setStrokeStyle('#333333')
+ctx.stroke()
+
+ctx.draw()
+```
+*
+* 
+*
+* 针对 arc(100, 75, 50, 0, 1.5 * Math.PI)的三个关键坐标如下:
+*
+* - 绿色: 圆心 (100, 75)
+* - 红色: 起始弧度 (0)
+* - 蓝色: 终止弧度 (1.5 * Math.PI) */
+ arc(
+ /** 圆心的 x 坐标 */
+ x: number,
+ /** 圆心的 y 坐标 */
+ y: number,
+ /** 圆的半径 */
+ r: number,
+ /** 起始弧度,单位弧度(在3点钟方向) */
+ sAngle: number,
+ /** 终止弧度 */
+ eAngle: number,
+ /** 弧度的方向是否是逆时针 */
+ counterclockwise?: boolean
+ ): void
+ /** [CanvasContext.arcTo(number x1, number y1, number x2, number y2, number radius)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.arcTo.html)
+ *
+ * 需要基础库: `1.9.90`
+ *
+ * 在插件中使用:支持
+ * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
+ *
+ * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
+ *
+ * 根据控制点和半径绘制圆弧路径。 */
+ arcTo(
+ /** 第一个控制点的 x 轴坐标 */
+ x1: number,
+ /** 第一个控制点的 y 轴坐标 */
+ y1: number,
+ /** 第二个控制点的 x 轴坐标 */
+ x2: number,
+ /** 第二个控制点的 y 轴坐标 */
+ y2: number,
+ /** 圆弧的半径 */
+ radius: number
+ ): void
+ /** [CanvasContext.beginPath()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.beginPath.html)
+*
+* 在插件中使用:支持
+* @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
+*
+* @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
+*
+* 开始创建一个路径。需要调用 `fill` 或者 `stroke` 才会使用路径进行填充或描边
+*
+* - 在最开始的时候相当于调用了一次 `beginPath`。
+* - 同一个路径内的多次 `setFillStyle`、`setStrokeStyle`、`setLineWidth`等设置,以最后一次设置为准。
+*
+* **示例代码**
+*
+* ```javascript
+const ctx = wx.createCanvasContext('myCanvas')
+// begin path
+ctx.rect(10, 10, 100, 30)
+ctx.setFillStyle('yellow')
+ctx.fill()
+
+// begin another path
+ctx.beginPath()
+ctx.rect(10, 40, 100, 30)
+
+// only fill this rect, not in current path
+ctx.setFillStyle('blue')
+ctx.fillRect(10, 70, 100, 30)
+
+ctx.rect(10, 100, 100, 30)
+
+// it will fill current path
+ctx.setFillStyle('red')
+ctx.fill()
+ctx.draw()
+```
+*
+*  */
+ beginPath(): void
+ /** [CanvasContext.bezierCurveTo(number cp1x, number cp1y, number cp2x, number cp2y, number x, number y)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.bezierCurveTo.html)
+*
+* 在插件中使用:支持
+* @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
+*
+* @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
+*
+* 创建三次方贝塞尔曲线路径。曲线的起始点为路径中前一个点。
+*
+* **示例代码**
+*
+* ```javascript
+const ctx = wx.createCanvasContext('myCanvas')
+
+// Draw points
+ctx.beginPath()
+ctx.arc(20, 20, 2, 0, 2 * Math.PI)
+ctx.setFillStyle('red')
+ctx.fill()
+
+ctx.beginPath()
+ctx.arc(200, 20, 2, 0, 2 * Math.PI)
+ctx.setFillStyle('lightgreen')
+ctx.fill()
+
+ctx.beginPath()
+ctx.arc(20, 100, 2, 0, 2 * Math.PI)
+ctx.arc(200, 100, 2, 0, 2 * Math.PI)
+ctx.setFillStyle('blue')
+ctx.fill()
+
+ctx.setFillStyle('black')
+ctx.setFontSize(12)
+
+// Draw guides
+ctx.beginPath()
+ctx.moveTo(20, 20)
+ctx.lineTo(20, 100)
+ctx.lineTo(150, 75)
+
+ctx.moveTo(200, 20)
+ctx.lineTo(200, 100)
+ctx.lineTo(70, 75)
+ctx.setStrokeStyle('#AAAAAA')
+ctx.stroke()
+
+// Draw quadratic curve
+ctx.beginPath()
+ctx.moveTo(20, 20)
+ctx.bezierCurveTo(20, 100, 200, 100, 200, 20)
+ctx.setStrokeStyle('black')
+ctx.stroke()
+
+ctx.draw()
+```
+*
+* 
+*
+* 针对 moveTo(20, 20) bezierCurveTo(20, 100, 200, 100, 200, 20) 的三个关键坐标如下:
+*
+* - 红色:起始点(20, 20)
+* - 蓝色:两个控制点(20, 100) (200, 100)
+* - 绿色:终止点(200, 20) */
+ bezierCurveTo(
+ /** 第一个贝塞尔控制点的 x 坐标 */
+ cp1x: number,
+ /** 第一个贝塞尔控制点的 y 坐标 */
+ cp1y: number,
+ /** 第二个贝塞尔控制点的 x 坐标 */
+ cp2x: number,
+ /** 第二个贝塞尔控制点的 y 坐标 */
+ cp2y: number,
+ /** 结束点的 x 坐标 */
+ x: number,
+ /** 结束点的 y 坐标 */
+ y: number
+ ): void
+ /** [CanvasContext.clearRect(number x, number y, number width, number height)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.clearRect.html)
+*
+* 在插件中使用:支持
+* @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
+*
+* @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
+*
+* 清除画布上在该矩形区域内的内容
+*
+* **示例代码**
+*
+* clearRect 并非画一个白色的矩形在地址区域,而是清空,为了有直观感受,对 canvas 加了一层背景色。
+* ```html
+*
+* ```
+* ```javascript
+const ctx = wx.createCanvasContext('myCanvas')
+ctx.setFillStyle('red')
+ctx.fillRect(0, 0, 150, 200)
+ctx.setFillStyle('blue')
+ctx.fillRect(150, 0, 150, 200)
+ctx.clearRect(10, 10, 150, 75)
+ctx.draw()
+```
+*  */
+ clearRect(
+ /** 矩形路径左上角的横坐标 */
+ x: number,
+ /** 矩形路径左上角的纵坐标 */
+ y: number,
+ /** 矩形路径的宽度 */
+ width: number,
+ /** 矩形路径的高度 */
+ height: number
+ ): void
+ /** [CanvasContext.clip()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.clip.html)
+*
+* 需要基础库: `1.6.0`
+*
+* 在插件中使用:支持
+* @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
+*
+* @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
+*
+* 从原始画布中剪切任意形状和尺寸。一旦剪切了某个区域,则所有之后的绘图都会被限制在被剪切的区域内(不能访问画布上的其他区域)。可以在使用 `clip` 方法前通过使用 `save` 方法对当前画布区域进行保存,并在以后的任意时间通过`restore`方法对其进行恢复。
+*
+* **示例代码**
+*
+* ```javascript
+const ctx = wx.createCanvasContext('myCanvas')
+
+wx.downloadFile({
+ url: 'http://is5.mzstatic.com/image/thumb/Purple128/v4/75/3b/90/753b907c-b7fb-5877-215a-759bd73691a4/source/50x50bb.jpg',
+ success: function(res) {
+ ctx.save()
+ ctx.beginPath()
+ ctx.arc(50, 50, 25, 0, 2*Math.PI)
+ ctx.clip()
+ ctx.drawImage(res.tempFilePath, 25, 25)
+ ctx.restore()
+ ctx.draw()
+ }
+})
+```
+*  */
+ clip(): void
+ /** [CanvasContext.closePath()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.closePath.html)
+*
+* 在插件中使用:支持
+* @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
+*
+* @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
+*
+* 关闭一个路径。会连接起点和终点。如果关闭路径后没有调用 `fill` 或者 `stroke` 并开启了新的路径,那之前的路径将不会被渲染。
+*
+* **示例代码**
+*
+* ```javascript
+const ctx = wx.createCanvasContext('myCanvas')
+ctx.moveTo(10, 10)
+ctx.lineTo(100, 10)
+ctx.lineTo(100, 100)
+ctx.closePath()
+ctx.stroke()
+ctx.draw()
+```
+* 
+*
+* ```javascript
+const ctx = wx.createCanvasContext('myCanvas')
+// begin path
+ctx.rect(10, 10, 100, 30)
+ctx.closePath()
+
+// begin another path
+ctx.beginPath()
+ctx.rect(10, 40, 100, 30)
+
+// only fill this rect, not in current path
+ctx.setFillStyle('blue')
+ctx.fillRect(10, 70, 100, 30)
+
+ctx.rect(10, 100, 100, 30)
+
+// it will fill current path
+ctx.setFillStyle('red')
+ctx.fill()
+ctx.draw()
+```
+*
+*  */
+ closePath(): void
+ /** [CanvasContext.createPattern(string image, string repetition)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.createPattern.html)
+ *
+ * 需要基础库: `1.9.90`
+ *
+ * 在插件中使用:支持
+ * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
+ *
+ * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
+ *
+ * 对指定的图像创建模式的方法,可在指定的方向上重复元图像 */
+ createPattern(
+ /** 重复的图像源,支持代码包路径和本地临时路径 (本地路径) */
+ image: string,
+ /** 如何重复图像
+ *
+ * 参数 repetition 可选值:
+ * - 'repeat': 水平竖直方向都重复;
+ * - 'repeat-x': 水平方向重复;
+ * - 'repeat-y': 竖直方向重复;
+ * - 'no-repeat': 不重复; */
+ repetition: 'repeat' | 'repeat-x' | 'repeat-y' | 'no-repeat'
+ ): void
+ /** [CanvasContext.draw(boolean reserve, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.draw.html)
+*
+* 在插件中使用:支持
+* @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
+*
+* @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
+*
+* 将之前在绘图上下文中的描述(路径、变形、样式)画到 canvas 中。
+*
+* **示例代码**
+*
+* 第二次 draw() reserve 为 true。所以保留了上一次的绘制结果,在上下文设置的 fillStyle 'red' 也变成了默认的 'black'。
+*
+* ```javascript
+const ctx = wx.createCanvasContext('myCanvas')
+
+ctx.setFillStyle('red')
+ctx.fillRect(10, 10, 150, 100)
+ctx.draw()
+ctx.fillRect(50, 50, 150, 100)
+ctx.draw(true)
+```
+* 
+*
+* **示例代码**
+*
+* 第二次 draw() reserve 为 false。所以没有保留了上一次的绘制结果和在上下文设置的 fillStyle 'red'。
+*
+* ```javascript
+const ctx = wx.createCanvasContext('myCanvas')
+
+ctx.setFillStyle('red')
+ctx.fillRect(10, 10, 150, 100)
+ctx.draw()
+ctx.fillRect(50, 50, 150, 100)
+ctx.draw()
+```
+*  */
+ draw(
+ /** 本次绘制是否接着上一次绘制。即 reserve 参数为 false,则在本次调用绘制之前 native 层会先清空画布再继续绘制;若 reserve 参数为 true,则保留当前画布上的内容,本次调用 drawCanvas 绘制的内容覆盖在上面,默认 false。 */
+ reserve?: boolean,
+ /** 绘制完成后执行的回调函数 */
+ callback?: (...args: any[]) => any
+ ): void
+ /** [CanvasContext.drawImage(string imageResource, number sx, number sy, number sWidth, number sHeight, number dx, number dy, number dWidth, number dHeight)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.drawImage.html)
+*
+* 在插件中使用:支持
+* @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
+*
+* @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
+*
+* 绘制图像到画布
+*
+* **示例代码**
+*
+* 有三个版本的写法:
+*
+* - drawImage(imageResource, dx, dy)
+* - drawImage(imageResource, dx, dy, dWidth, dHeight)
+* - drawImage(imageResource, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight) 从 1.9.0 起支持
+*
+* ```javascript
+const ctx = wx.createCanvasContext('myCanvas')
+
+wx.chooseImage({
+ success: function(res){
+ ctx.drawImage(res.tempFilePaths[0], 0, 0, 150, 100)
+ ctx.draw()
+ }
+})
+
+```
+*  */
+ drawImage(
+ /** 所要绘制的图片资源(网络图片要通过 getImageInfo / downloadFile 先下载) */
+ imageResource: string,
+ /** imageResource的左上角在目标 canvas 上 x 轴的位置 */
+ dx: number,
+ /** imageResource的左上角在目标 canvas 上 y 轴的位置 */
+ dy: number
+ ): void
+ /** [CanvasContext.drawImage(string imageResource, number sx, number sy, number sWidth, number sHeight, number dx, number dy, number dWidth, number dHeight)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.drawImage.html)
+*
+* 在插件中使用:支持
+* @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
+*
+* @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
+*
+* 绘制图像到画布
+*
+* **示例代码**
+*
+* 有三个版本的写法:
+*
+* - drawImage(imageResource, dx, dy)
+* - drawImage(imageResource, dx, dy, dWidth, dHeight)
+* - drawImage(imageResource, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight) 从 1.9.0 起支持
+*
+* ```javascript
+const ctx = wx.createCanvasContext('myCanvas')
+
+wx.chooseImage({
+ success: function(res){
+ ctx.drawImage(res.tempFilePaths[0], 0, 0, 150, 100)
+ ctx.draw()
+ }
+})
+
+```
+*  */
+ drawImage(
+ /** 所要绘制的图片资源(网络图片要通过 getImageInfo / downloadFile 先下载) */
+ imageResource: string,
+ /** imageResource的左上角在目标 canvas 上 x 轴的位置 */
+ dx: number,
+ /** imageResource的左上角在目标 canvas 上 y 轴的位置 */
+ dy: number,
+ /** 在目标画布上绘制imageResource的宽度,允许对绘制的imageResource进行缩放 */
+ dWidth: number,
+ /** 在目标画布上绘制imageResource的高度,允许对绘制的imageResource进行缩放 */
+ dHeight: number
+ ): void
+ /** [CanvasContext.drawImage(string imageResource, number sx, number sy, number sWidth, number sHeight, number dx, number dy, number dWidth, number dHeight)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.drawImage.html)
+*
+* 在插件中使用:支持
+* @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
+*
+* @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
+*
+* 绘制图像到画布
+*
+* **示例代码**
+*
+* 有三个版本的写法:
+*
+* - drawImage(imageResource, dx, dy)
+* - drawImage(imageResource, dx, dy, dWidth, dHeight)
+* - drawImage(imageResource, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight) 从 1.9.0 起支持
+*
+* ```javascript
+const ctx = wx.createCanvasContext('myCanvas')
+
+wx.chooseImage({
+ success: function(res){
+ ctx.drawImage(res.tempFilePaths[0], 0, 0, 150, 100)
+ ctx.draw()
+ }
+})
+
+```
+*  */
+ drawImage(
+ /** 所要绘制的图片资源(网络图片要通过 getImageInfo / downloadFile 先下载) */
+ imageResource: string,
+ /** 需要绘制到画布中的,imageResource的矩形(裁剪)选择框的左上角 x 坐标 */
+ sx: number,
+ /** 需要绘制到画布中的,imageResource的矩形(裁剪)选择框的左上角 y 坐标 */
+ sy: number,
+ /** 需要绘制到画布中的,imageResource的矩形(裁剪)选择框的宽度 */
+ sWidth: number,
+ /** 需要绘制到画布中的,imageResource的矩形(裁剪)选择框的高度 */
+ sHeight: number,
+ /** imageResource的左上角在目标 canvas 上 x 轴的位置 */
+ dx: number,
+ /** imageResource的左上角在目标 canvas 上 y 轴的位置 */
+ dy: number,
+ /** 在目标画布上绘制imageResource的宽度,允许对绘制的imageResource进行缩放 */
+ dWidth: number,
+ /** 在目标画布上绘制imageResource的高度,允许对绘制的imageResource进行缩放 */
+ dHeight: number
+ ): void
+ /** [CanvasContext.fill()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.fill.html)
+*
+* 在插件中使用:支持
+* @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
+*
+* @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
+*
+* 对当前路径中的内容进行填充。默认的填充色为黑色。
+*
+* **示例代码**
+*
+* 如果当前路径没有闭合,fill() 方法会将起点和终点进行连接,然后填充。
+*
+* ```javascript
+const ctx = wx.createCanvasContext('myCanvas')
+ctx.moveTo(10, 10)
+ctx.lineTo(100, 10)
+ctx.lineTo(100, 100)
+ctx.fill()
+ctx.draw()
+```
+*
+* fill() 填充的的路径是从 beginPath() 开始计算,但是不会将 fillRect() 包含进去。
+*
+* 
+*
+* ```javascript
+const ctx = wx.createCanvasContext('myCanvas')
+// begin path
+ctx.rect(10, 10, 100, 30)
+ctx.setFillStyle('yellow')
+ctx.fill()
+
+// begin another path
+ctx.beginPath()
+ctx.rect(10, 40, 100, 30)
+
+// only fill this rect, not in current path
+ctx.setFillStyle('blue')
+ctx.fillRect(10, 70, 100, 30)
+
+ctx.rect(10, 100, 100, 30)
+
+// it will fill current path
+ctx.setFillStyle('red')
+ctx.fill()
+ctx.draw()
+```
+*
+*  */
+ fill(): void
+ /** [CanvasContext.fillRect(number x, number y, number width, number height)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.fillRect.html)
+*
+* 在插件中使用:支持
+* @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
+*
+* @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
+*
+* 填充一个矩形。用 [`setFillStyle`](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setFillStyle.html) 设置矩形的填充色,如果没设置默认是黑色。
+*
+* **示例代码**
+*
+* ```javascript
+const ctx = wx.createCanvasContext('myCanvas')
+ctx.setFillStyle('red')
+ctx.fillRect(10, 10, 150, 75)
+ctx.draw()
+```
+*  */
+ fillRect(
+ /** 矩形路径左上角的横坐标 */
+ x: number,
+ /** 矩形路径左上角的纵坐标 */
+ y: number,
+ /** 矩形路径的宽度 */
+ width: number,
+ /** 矩形路径的高度 */
+ height: number
+ ): void
+ /** [CanvasContext.fillText(string text, number x, number y, number maxWidth)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.fillText.html)
+*
+* 在插件中使用:支持
+* @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
+*
+* @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
+*
+* 在画布上绘制被填充的文本
+*
+* **示例代码**
+*
+* ```javascript
+const ctx = wx.createCanvasContext('myCanvas')
+
+ctx.setFontSize(20)
+ctx.fillText('Hello', 20, 20)
+ctx.fillText('MINA', 100, 100)
+
+ctx.draw()
+```
+*  */
+ fillText(
+ /** 在画布上输出的文本 */
+ text: string,
+ /** 绘制文本的左上角 x 坐标位置 */
+ x: number,
+ /** 绘制文本的左上角 y 坐标位置 */
+ y: number,
+ /** 需要绘制的最大宽度,可选 */
+ maxWidth?: number
+ ): void
+ /** [CanvasContext.lineTo(number x, number y)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.lineTo.html)
+*
+* 在插件中使用:支持
+* @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
+*
+* @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
+*
+* 增加一个新点,然后创建一条从上次指定点到目标点的线。用 `stroke` 方法来画线条
+*
+* **示例代码**
+*
+* ```javascript
+const ctx = wx.createCanvasContext('myCanvas')
+ctx.moveTo(10, 10)
+ctx.rect(10, 10, 100, 50)
+ctx.lineTo(110, 60)
+ctx.stroke()
+ctx.draw()
+```
+*  */
+ lineTo(
+ /** 目标位置的 x 坐标 */
+ x: number,
+ /** 目标位置的 y 坐标 */
+ y: number
+ ): void
+ /** [CanvasContext.moveTo(number x, number y)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.moveTo.html)
+*
+* 在插件中使用:支持
+* @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
+*
+* @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
+*
+* 把路径移动到画布中的指定点,不创建线条。用 `stroke` 方法来画线条
+*
+* **示例代码**
+*
+* ```javascript
+const ctx = wx.createCanvasContext('myCanvas')
+ctx.moveTo(10, 10)
+ctx.lineTo(100, 10)
+
+ctx.moveTo(10, 50)
+ctx.lineTo(100, 50)
+ctx.stroke()
+ctx.draw()
+```
+*  */
+ moveTo(
+ /** 目标位置的 x 坐标 */
+ x: number,
+ /** 目标位置的 y 坐标 */
+ y: number
+ ): void
+ /** [CanvasContext.quadraticCurveTo(number cpx, number cpy, number x, number y)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.quadraticCurveTo.html)
+*
+* 在插件中使用:支持
+* @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
+*
+* @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
+*
+* 创建二次贝塞尔曲线路径。曲线的起始点为路径中前一个点。
+*
+* **示例代码**
+*
+* ```javascript
+const ctx = wx.createCanvasContext('myCanvas')
+
+// Draw points
+ctx.beginPath()
+ctx.arc(20, 20, 2, 0, 2 * Math.PI)
+ctx.setFillStyle('red')
+ctx.fill()
+
+ctx.beginPath()
+ctx.arc(200, 20, 2, 0, 2 * Math.PI)
+ctx.setFillStyle('lightgreen')
+ctx.fill()
+
+ctx.beginPath()
+ctx.arc(20, 100, 2, 0, 2 * Math.PI)
+ctx.setFillStyle('blue')
+ctx.fill()
+
+ctx.setFillStyle('black')
+ctx.setFontSize(12)
+
+// Draw guides
+ctx.beginPath()
+ctx.moveTo(20, 20)
+ctx.lineTo(20, 100)
+ctx.lineTo(200, 20)
+ctx.setStrokeStyle('#AAAAAA')
+ctx.stroke()
+
+// Draw quadratic curve
+ctx.beginPath()
+ctx.moveTo(20, 20)
+ctx.quadraticCurveTo(20, 100, 200, 20)
+ctx.setStrokeStyle('black')
+ctx.stroke()
+
+ctx.draw()
+```
+*
+* 
+*
+* 针对 moveTo(20, 20) quadraticCurveTo(20, 100, 200, 20) 的三个关键坐标如下:
+*
+* - 红色:起始点(20, 20)
+* - 蓝色:控制点(20, 100)
+* - 绿色:终止点(200, 20) */
+ quadraticCurveTo(
+ /** 贝塞尔控制点的 x 坐标 */
+ cpx: number,
+ /** 贝塞尔控制点的 y 坐标 */
+ cpy: number,
+ /** 结束点的 x 坐标 */
+ x: number,
+ /** 结束点的 y 坐标 */
+ y: number
+ ): void
+ /** [CanvasContext.rect(number x, number y, number width, number height)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.rect.html)
+*
+* 在插件中使用:支持
+* @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
+*
+* @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
+*
+* 创建一个矩形路径。需要用 [`fill`](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.fill.html) 或者 [`stroke`](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.stroke.html) 方法将矩形真正的画到 `canvas` 中
+*
+* **示例代码**
+*
+* ```javascript
+const ctx = wx.createCanvasContext('myCanvas')
+ctx.rect(10, 10, 150, 75)
+ctx.setFillStyle('red')
+ctx.fill()
+ctx.draw()
+```
+*  */
+ rect(
+ /** 矩形路径左上角的横坐标 */
+ x: number,
+ /** 矩形路径左上角的纵坐标 */
+ y: number,
+ /** 矩形路径的宽度 */
+ width: number,
+ /** 矩形路径的高度 */
+ height: number
+ ): void
+ /** [CanvasContext.restore()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.restore.html)
+*
+* 在插件中使用:支持
+* @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
+*
+* @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
+*
+* 恢复之前保存的绘图上下文。
+*
+* **示例代码**
+*
+* ```javascript
+const ctx = wx.createCanvasContext('myCanvas')
+
+// save the default fill style
+ctx.save()
+ctx.setFillStyle('red')
+ctx.fillRect(10, 10, 150, 100)
+
+// restore to the previous saved state
+ctx.restore()
+ctx.fillRect(50, 50, 150, 100)
+
+ctx.draw()
+```
+*  */
+ restore(): void
+ /** [CanvasContext.rotate(number rotate)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.rotate.html)
+*
+* 在插件中使用:支持
+* @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
+*
+* @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
+*
+* 以原点为中心顺时针旋转当前坐标轴。多次调用旋转的角度会叠加。原点可以用 `translate` 方法修改。
+*
+* **示例代码**
+*
+* ```javascript
+const ctx = wx.createCanvasContext('myCanvas')
+
+ctx.strokeRect(100, 10, 150, 100)
+ctx.rotate(20 * Math.PI / 180)
+ctx.strokeRect(100, 10, 150, 100)
+ctx.rotate(20 * Math.PI / 180)
+ctx.strokeRect(100, 10, 150, 100)
+
+ctx.draw()
+```
+*  */
+ rotate(
+ /** 旋转角度,以弧度计 degrees * Math.PI/180;degrees 范围为 0-360 */
+ rotate: number
+ ): void
+ /** [CanvasContext.save()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.save.html)
+*
+* 在插件中使用:支持
+* @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
+*
+* @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
+*
+* 保存绘图上下文。
+*
+* **示例代码**
+*
+* ```javascript
+const ctx = wx.createCanvasContext('myCanvas')
+
+// save the default fill style
+ctx.save()
+ctx.setFillStyle('red')
+ctx.fillRect(10, 10, 150, 100)
+
+// restore to the previous saved state
+ctx.restore()
+ctx.fillRect(50, 50, 150, 100)
+
+ctx.draw()
+```
+*  */
+ save(): void
+ /** [CanvasContext.scale(number scaleWidth, number scaleHeight)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.scale.html)
+*
+* 在插件中使用:支持
+* @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
+*
+* @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
+*
+* 在调用后,之后创建的路径其横纵坐标会被缩放。多次调用倍数会相乘。
+*
+* **示例代码**
+*
+* ```javascript
+const ctx = wx.createCanvasContext('myCanvas')
+
+ctx.strokeRect(10, 10, 25, 15)
+ctx.scale(2, 2)
+ctx.strokeRect(10, 10, 25, 15)
+ctx.scale(2, 2)
+ctx.strokeRect(10, 10, 25, 15)
+
+ctx.draw()
+```
+*  */
+ scale(
+ /** 横坐标缩放的倍数 (1 = 100%,0.5 = 50%,2 = 200%) */
+ scaleWidth: number,
+ /** 纵坐标轴缩放的倍数 (1 = 100%,0.5 = 50%,2 = 200%) */
+ scaleHeight: number
+ ): void
+ /** [CanvasContext.setFillStyle(string|[CanvasGradient](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasGradient.html) color)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setFillStyle.html)
+*
+* 在插件中使用:支持
+* @deprecated 基础库版本 [1.9.90](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [CanvasContext.fillStyle](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html) 替换
+*
+* @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
+*
+* 设置填充色。
+*
+* **代码示例**
+*
+* ```js
+const ctx = wx.createCanvasContext('myCanvas')
+ctx.setFillStyle('red')
+ctx.fillRect(10, 10, 150, 75)
+ctx.draw()
+```
+*  */
+ setFillStyle(
+ /** 填充的颜色,默认颜色为 black。 */
+ color: string | CanvasGradient
+ ): void
+ /** [CanvasContext.setFontSize(number fontSize)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setFontSize.html)
+*
+* 在插件中使用:支持
+* @deprecated 基础库版本 [1.9.90](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [CanvasContext.font](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html) 替换
+*
+* @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
+*
+* 设置字体的字号
+*
+* **示例代码**
+*
+* ```javascript
+const ctx = wx.createCanvasContext('myCanvas')
+
+ctx.setFontSize(20)
+ctx.fillText('20', 20, 20)
+ctx.setFontSize(30)
+ctx.fillText('30', 40, 40)
+ctx.setFontSize(40)
+ctx.fillText('40', 60, 60)
+ctx.setFontSize(50)
+ctx.fillText('50', 90, 90)
+
+ctx.draw()
+```
+*  */
+ setFontSize(
+ /** 字体的字号 */
+ fontSize: number
+ ): void
+ /** [CanvasContext.setGlobalAlpha(number alpha)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setGlobalAlpha.html)
+*
+* 在插件中使用:支持
+* @deprecated 基础库版本 [1.9.90](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [CanvasContext.globalAlpha](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html) 替换
+*
+* @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
+*
+* 设置全局画笔透明度。
+*
+* **示例代码**
+*
+* ```javascript
+const ctx = wx.createCanvasContext('myCanvas')
+
+ctx.setFillStyle('red')
+ctx.fillRect(10, 10, 150, 100)
+ctx.setGlobalAlpha(0.2)
+ctx.setFillStyle('blue')
+ctx.fillRect(50, 50, 150, 100)
+ctx.setFillStyle('yellow')
+ctx.fillRect(100, 100, 150, 100)
+
+ctx.draw()
+```
+*  */
+ setGlobalAlpha(
+ /** 透明度。范围 0-1,0 表示完全透明,1 表示完全不透明。 */
+ alpha: number
+ ): void
+ /** [CanvasContext.setLineCap(string lineCap)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineCap.html)
+*
+* 在插件中使用:支持
+* @deprecated 基础库版本 [1.9.90](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [CanvasContext.lineCap](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html) 替换
+*
+* @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
+*
+* 设置线条的端点样式
+*
+* **示例代码**
+*
+* ```javascript
+const ctx = wx.createCanvasContext('myCanvas')
+ctx.beginPath()
+ctx.moveTo(10, 10)
+ctx.lineTo(150, 10)
+ctx.stroke()
+
+ctx.beginPath()
+ctx.setLineCap('butt')
+ctx.setLineWidth(10)
+ctx.moveTo(10, 30)
+ctx.lineTo(150, 30)
+ctx.stroke()
+
+ctx.beginPath()
+ctx.setLineCap('round')
+ctx.setLineWidth(10)
+ctx.moveTo(10, 50)
+ctx.lineTo(150, 50)
+ctx.stroke()
+
+ctx.beginPath()
+ctx.setLineCap('square')
+ctx.setLineWidth(10)
+ctx.moveTo(10, 70)
+ctx.lineTo(150, 70)
+ctx.stroke()
+
+ctx.draw()
+```
+*  */
+ setLineCap(
+ /** 线条的结束端点样式
+ *
+ * 参数 lineCap 可选值:
+ * - 'butt': 向线条的每个末端添加平直的边缘。;
+ * - 'round': 向线条的每个末端添加圆形线帽。;
+ * - 'square': 向线条的每个末端添加正方形线帽。; */
+ lineCap: 'butt' | 'round' | 'square'
+ ): void
+ /** [CanvasContext.setLineDash(Array.<number> pattern, number offset)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineDash.html)
+*
+* 需要基础库: `1.6.0`
+*
+* 在插件中使用:支持
+* @deprecated 基础库版本 [1.9.90](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [CanvasContext.lineDashOffset](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html) 替换
+*
+* @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
+*
+* 设置虚线样式。
+*
+* **示例代码**
+*
+* ```javascript
+const ctx = wx.createCanvasContext('myCanvas')
+
+ctx.setLineDash([10, 20], 5);
+
+ctx.beginPath();
+ctx.moveTo(0,100);
+ctx.lineTo(400, 100);
+ctx.stroke();
+
+ctx.draw()
+```
+*  */
+ setLineDash(
+ /** 一组描述交替绘制线段和间距(坐标空间单位)长度的数字 */
+ pattern: number[],
+ /** 虚线偏移量 */
+ offset: number
+ ): void
+ /** [CanvasContext.setLineJoin(string lineJoin)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineJoin.html)
+*
+* 在插件中使用:支持
+* @deprecated 基础库版本 [1.9.90](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [CanvasContext.lineJoin](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html) 替换
+*
+* @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
+*
+* 设置线条的交点样式
+*
+* **示例代码**
+*
+* ```javascript
+const ctx = wx.createCanvasContext('myCanvas')
+ctx.beginPath()
+ctx.moveTo(10, 10)
+ctx.lineTo(100, 50)
+ctx.lineTo(10, 90)
+ctx.stroke()
+
+ctx.beginPath()
+ctx.setLineJoin('bevel')
+ctx.setLineWidth(10)
+ctx.moveTo(50, 10)
+ctx.lineTo(140, 50)
+ctx.lineTo(50, 90)
+ctx.stroke()
+
+ctx.beginPath()
+ctx.setLineJoin('round')
+ctx.setLineWidth(10)
+ctx.moveTo(90, 10)
+ctx.lineTo(180, 50)
+ctx.lineTo(90, 90)
+ctx.stroke()
+
+ctx.beginPath()
+ctx.setLineJoin('miter')
+ctx.setLineWidth(10)
+ctx.moveTo(130, 10)
+ctx.lineTo(220, 50)
+ctx.lineTo(130, 90)
+ctx.stroke()
+
+ctx.draw()
+```
+*  */
+ setLineJoin(
+ /** 线条的结束交点样式
+ *
+ * 参数 lineJoin 可选值:
+ * - 'bevel': 斜角;
+ * - 'round': 圆角;
+ * - 'miter': 尖角; */
+ lineJoin: 'bevel' | 'round' | 'miter'
+ ): void
+ /** [CanvasContext.setLineWidth(number lineWidth)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineWidth.html)
+*
+* 在插件中使用:支持
+* @deprecated 基础库版本 [1.9.90](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [CanvasContext.lineWidth](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html) 替换
+*
+* @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
+*
+* 设置线条的宽度
+*
+* **示例代码**
+*
+* ```javascript
+const ctx = wx.createCanvasContext('myCanvas')
+ctx.beginPath()
+ctx.moveTo(10, 10)
+ctx.lineTo(150, 10)
+ctx.stroke()
+
+ctx.beginPath()
+ctx.setLineWidth(5)
+ctx.moveTo(10, 30)
+ctx.lineTo(150, 30)
+ctx.stroke()
+
+ctx.beginPath()
+ctx.setLineWidth(10)
+ctx.moveTo(10, 50)
+ctx.lineTo(150, 50)
+ctx.stroke()
+
+ctx.beginPath()
+ctx.setLineWidth(15)
+ctx.moveTo(10, 70)
+ctx.lineTo(150, 70)
+ctx.stroke()
+
+ctx.draw()
+```
+*
+*  */
+ setLineWidth(
+ /** 线条的宽度,单位px */
+ lineWidth: number
+ ): void
+ /** [CanvasContext.setMiterLimit(number miterLimit)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setMiterLimit.html)
+*
+* 在插件中使用:支持
+* @deprecated 基础库版本 [1.9.90](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [CanvasContext.miterLimit](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html) 替换
+*
+* @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
+*
+* 设置最大斜接长度。斜接长度指的是在两条线交汇处内角和外角之间的距离。当 [CanvasContext.setLineJoin()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineJoin.html) 为 miter 时才有效。超过最大倾斜长度的,连接处将以 lineJoin 为 bevel 来显示。
+*
+* **示例代码**
+*
+* ```javascript
+const ctx = wx.createCanvasContext('myCanvas')
+ctx.beginPath()
+ctx.setLineWidth(10)
+ctx.setLineJoin('miter')
+ctx.setMiterLimit(1)
+ctx.moveTo(10, 10)
+ctx.lineTo(100, 50)
+ctx.lineTo(10, 90)
+ctx.stroke()
+
+ctx.beginPath()
+ctx.setLineWidth(10)
+ctx.setLineJoin('miter')
+ctx.setMiterLimit(2)
+ctx.moveTo(50, 10)
+ctx.lineTo(140, 50)
+ctx.lineTo(50, 90)
+ctx.stroke()
+
+ctx.beginPath()
+ctx.setLineWidth(10)
+ctx.setLineJoin('miter')
+ctx.setMiterLimit(3)
+ctx.moveTo(90, 10)
+ctx.lineTo(180, 50)
+ctx.lineTo(90, 90)
+ctx.stroke()
+
+ctx.beginPath()
+ctx.setLineWidth(10)
+ctx.setLineJoin('miter')
+ctx.setMiterLimit(4)
+ctx.moveTo(130, 10)
+ctx.lineTo(220, 50)
+ctx.lineTo(130, 90)
+ctx.stroke()
+
+ctx.draw()
+```
+*  */
+ setMiterLimit(
+ /** 最大斜接长度 */
+ miterLimit: number
+ ): void
+ /** [CanvasContext.setShadow(number offsetX, number offsetY, number blur, string color)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setShadow.html)
+*
+* 在插件中使用:支持
+* @deprecated 基础库版本 [1.9.90](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [CanvasContext.shadowOffsetX|CanvasContext.shadowOffsetY|CanvasContext.shadowColor|CanvasContext.shadowBlur](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html) 替换
+*
+* @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
+*
+* 设定阴影样式。
+*
+* **示例代码**
+*
+* ```javascript
+const ctx = wx.createCanvasContext('myCanvas')
+ctx.setFillStyle('red')
+ctx.setShadow(10, 50, 50, 'blue')
+ctx.fillRect(10, 10, 150, 75)
+ctx.draw()
+```
+*  */
+ setShadow(
+ /** 阴影相对于形状在水平方向的偏移,默认值为 0。 */
+ offsetX: number,
+ /** 阴影相对于形状在竖直方向的偏移,默认值为 0。 */
+ offsetY: number,
+ /** 阴影的模糊级别,数值越大越模糊。范围 0- 100。,默认值为 0。 */
+ blur: number,
+ /** 阴影的颜色。默认值为 black。 */
+ color: string
+ ): void
+ /** [CanvasContext.setStrokeStyle(string|[CanvasGradient](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasGradient.html) color)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setStrokeStyle.html)
+*
+* 在插件中使用:支持
+* @deprecated 基础库版本 [1.9.90](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [CanvasContext.strokeStyle](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html) 替换
+*
+* @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
+*
+* 设置描边颜色。
+*
+* **代码示例**
+*
+* ```js
+const ctx = wx.createCanvasContext('myCanvas')
+ctx.setStrokeStyle('red')
+ctx.strokeRect(10, 10, 150, 75)
+ctx.draw()
+```
+*  */
+ setStrokeStyle(
+ /** 描边的颜色,默认颜色为 black。 */
+ color: string | CanvasGradient
+ ): void
+ /** [CanvasContext.setTextAlign(string align)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setTextAlign.html)
+*
+* 需要基础库: `1.1.0`
+*
+* 在插件中使用:支持
+* @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
+*
+* @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
+*
+* 设置文字的对齐
+*
+* **示例代码**
+*
+* ```javascript
+const ctx = wx.createCanvasContext('myCanvas')
+
+ctx.setStrokeStyle('red')
+ctx.moveTo(150, 20)
+ctx.lineTo(150, 170)
+ctx.stroke()
+
+ctx.setFontSize(15)
+ctx.setTextAlign('left')
+ctx.fillText('textAlign=left', 150, 60)
+
+ctx.setTextAlign('center')
+ctx.fillText('textAlign=center', 150, 80)
+
+ctx.setTextAlign('right')
+ctx.fillText('textAlign=right', 150, 100)
+
+ctx.draw()
+```
+*
+*  */
+ setTextAlign(
+ /** 文字的对齐方式
+ *
+ * 参数 align 可选值:
+ * - 'left': 左对齐;
+ * - 'center': 居中对齐;
+ * - 'right': 右对齐; */
+ align: 'left' | 'center' | 'right'
+ ): void
+ /** [CanvasContext.setTextBaseline(string textBaseline)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setTextBaseline.html)
+*
+* 需要基础库: `1.4.0`
+*
+* 在插件中使用:支持
+* @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
+*
+* @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
+*
+* 设置文字的竖直对齐
+*
+* **示例代码**
+*
+* ```javascript
+const ctx = wx.createCanvasContext('myCanvas')
+
+ctx.setStrokeStyle('red')
+ctx.moveTo(5, 75)
+ctx.lineTo(295, 75)
+ctx.stroke()
+
+ctx.setFontSize(20)
+
+ctx.setTextBaseline('top')
+ctx.fillText('top', 5, 75)
+
+ctx.setTextBaseline('middle')
+ctx.fillText('middle', 50, 75)
+
+ctx.setTextBaseline('bottom')
+ctx.fillText('bottom', 120, 75)
+
+ctx.setTextBaseline('normal')
+ctx.fillText('normal', 200, 75)
+
+ctx.draw()
+```
+*  */
+ setTextBaseline(
+ /** 文字的竖直对齐方式
+ *
+ * 参数 textBaseline 可选值:
+ * - 'top': 顶部对齐;
+ * - 'bottom': 底部对齐;
+ * - 'middle': 居中对齐;
+ * - 'normal': ; */
+ textBaseline: 'top' | 'bottom' | 'middle' | 'normal'
+ ): void
+ /** [CanvasContext.setTransform(number scaleX, number skewX, number skewY, number scaleY, number translateX, number translateY)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setTransform.html)
+ *
+ * 需要基础库: `1.9.90`
+ *
+ * 在插件中使用:支持
+ * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
+ *
+ * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
+ *
+ * 使用矩阵重新设置(覆盖)当前变换的方法 */
+ setTransform(
+ /** 水平缩放 */
+ scaleX: number,
+ /** 水平倾斜 */
+ skewX: number,
+ /** 垂直倾斜 */
+ skewY: number,
+ /** 垂直缩放 */
+ scaleY: number,
+ /** 水平移动 */
+ translateX: number,
+ /** 垂直移动 */
+ translateY: number
+ ): void
+ /** [CanvasContext.stroke()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.stroke.html)
+*
+* 在插件中使用:支持
+* @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
+*
+* @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
+*
+* 画出当前路径的边框。默认颜色色为黑色。
+*
+* **示例代码**
+*
+* ```javascript
+const ctx = wx.createCanvasContext('myCanvas')
+ctx.moveTo(10, 10)
+ctx.lineTo(100, 10)
+ctx.lineTo(100, 100)
+ctx.stroke()
+ctx.draw()
+```
+* 
+*
+* stroke() 描绘的的路径是从 beginPath() 开始计算,但是不会将 strokeRect() 包含进去。
+*
+* ```javascript
+const ctx = wx.createCanvasContext('myCanvas')
+// begin path
+ctx.rect(10, 10, 100, 30)
+ctx.setStrokeStyle('yellow')
+ctx.stroke()
+
+// begin another path
+ctx.beginPath()
+ctx.rect(10, 40, 100, 30)
+
+// only stoke this rect, not in current path
+ctx.setStrokeStyle('blue')
+ctx.strokeRect(10, 70, 100, 30)
+
+ctx.rect(10, 100, 100, 30)
+
+// it will stroke current path
+ctx.setStrokeStyle('red')
+ctx.stroke()
+ctx.draw()
+```
+*
+*  */
+ stroke(): void
+ /** [CanvasContext.strokeRect(number x, number y, number width, number height)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.strokeRect.html)
+*
+* 在插件中使用:支持
+* @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
+*
+* @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
+*
+* 画一个矩形(非填充)。 用 [`setStrokeStyle`](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setStrokeStyle.html) 设置矩形线条的颜色,如果没设置默认是黑色。
+*
+* **示例代码**
+*
+* ```javascript
+const ctx = wx.createCanvasContext('myCanvas')
+ctx.setStrokeStyle('red')
+ctx.strokeRect(10, 10, 150, 75)
+ctx.draw()
+```
+*  */
+ strokeRect(
+ /** 矩形路径左上角的横坐标 */
+ x: number,
+ /** 矩形路径左上角的纵坐标 */
+ y: number,
+ /** 矩形路径的宽度 */
+ width: number,
+ /** 矩形路径的高度 */
+ height: number
+ ): void
+ /** [CanvasContext.strokeText(string text, number x, number y, number maxWidth)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.strokeText.html)
+ *
+ * 需要基础库: `1.9.90`
+ *
+ * 在插件中使用:支持
+ * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
+ *
+ * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
+ *
+ * 给定的 (x, y) 位置绘制文本描边的方法 */
+ strokeText(
+ /** 要绘制的文本 */
+ text: string,
+ /** 文本起始点的 x 轴坐标 */
+ x: number,
+ /** 文本起始点的 y 轴坐标 */
+ y: number,
+ /** 需要绘制的最大宽度,可选 */
+ maxWidth?: number
+ ): void
+ /** [CanvasContext.transform(number scaleX, number skewX, number skewY, number scaleY, number translateX, number translateY)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.transform.html)
+ *
+ * 需要基础库: `1.9.90`
+ *
+ * 在插件中使用:支持
+ * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
+ *
+ * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
+ *
+ * 使用矩阵多次叠加当前变换的方法 */
+ transform(
+ /** 水平缩放 */
+ scaleX: number,
+ /** 水平倾斜 */
+ skewX: number,
+ /** 垂直倾斜 */
+ skewY: number,
+ /** 垂直缩放 */
+ scaleY: number,
+ /** 水平移动 */
+ translateX: number,
+ /** 垂直移动 */
+ translateY: number
+ ): void
+ /** [CanvasContext.translate(number x, number y)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.translate.html)
+*
+* 在插件中使用:支持
+* @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
+*
+* @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
+*
+* 对当前坐标系的原点 (0, 0) 进行变换。默认的坐标系原点为页面左上角。
+*
+* **示例代码**
+*
+* ```javascript
+const ctx = wx.createCanvasContext('myCanvas')
+
+ctx.strokeRect(10, 10, 150, 100)
+ctx.translate(20, 20)
+ctx.strokeRect(10, 10, 150, 100)
+ctx.translate(20, 20)
+ctx.strokeRect(10, 10, 150, 100)
+
+ctx.draw()
+```
+*
+*  */
+ translate(
+ /** 水平坐标平移量 */
+ x: number,
+ /** 竖直坐标平移量 */
+ y: number
+ ): void
+ /** [Object CanvasContext.measureText(string text)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.measureText.html)
+ *
+ * 需要基础库: `1.9.90`
+ *
+ * 在插件中使用:支持
+ * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
+ *
+ * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
+ *
+ * 测量文本尺寸信息。目前仅返回文本宽度。同步接口。 */
+ measureText(
+ /** 要测量的文本 */
+ text: string
+ ): TextMetrics
+ /** [[CanvasGradient](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasGradient.html) CanvasContext.createCircularGradient(number x, number y, number r)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.createCircularGradient.html)
+*
+* 在插件中使用:支持
+* @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
+*
+* @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
+*
+* 创建一个圆形的渐变颜色。起点在圆心,终点在圆环。返回的`CanvasGradient`对象需要使用 [CanvasGradient.addColorStop()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasGradient.addColorStop.html) 来指定渐变点,至少要两个。
+*
+* **示例代码**
+*
+* ```javascript
+const ctx = wx.createCanvasContext('myCanvas')
+
+// Create circular gradient
+const grd = ctx.createCircularGradient(75, 50, 50)
+grd.addColorStop(0, 'red')
+grd.addColorStop(1, 'white')
+
+// Fill with gradient
+ctx.setFillStyle(grd)
+ctx.fillRect(10, 10, 150, 80)
+ctx.draw()
+```
+*  */
+ createCircularGradient(
+ /** 圆心的 x 坐标 */
+ x: number,
+ /** 圆心的 y 坐标 */
+ y: number,
+ /** 圆的半径 */
+ r: number
+ ): CanvasGradient
+ /** [[CanvasGradient](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasGradient.html) CanvasContext.createLinearGradient(number x0, number y0, number x1, number y1)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.createLinearGradient.html)
+*
+* 在插件中使用:支持
+* @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
+*
+* @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
+*
+* 创建一个线性的渐变颜色。返回的`CanvasGradient`对象需要使用 [CanvasGradient.addColorStop()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasGradient.addColorStop.html) 来指定渐变点,至少要两个。
+*
+* **示例代码**
+*
+* ```javascript
+const ctx = wx.createCanvasContext('myCanvas')
+
+// Create linear gradient
+const grd = ctx.createLinearGradient(0, 0, 200, 0)
+grd.addColorStop(0, 'red')
+grd.addColorStop(1, 'white')
+
+// Fill with gradient
+ctx.setFillStyle(grd)
+ctx.fillRect(10, 10, 150, 80)
+ctx.draw()
+```
+*  */
+ createLinearGradient(
+ /** 起点的 x 坐标 */
+ x0: number,
+ /** 起点的 y 坐标 */
+ y0: number,
+ /** 终点的 x 坐标 */
+ x1: number,
+ /** 终点的 y 坐标 */
+ y1: number
+ ): CanvasGradient
}
interface CanvasGetImageDataOption {
/** 画布标识,传入 [canvas](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 组件的 `canvas-id` 属性。 */
@@ -715,45 +3505,45 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
canvasId?: string
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: CanvasToTempFilePathCompleteCallback
- /** 输出的图片的高度
+ /** 需要基础库: `1.2.0`
*
- * 最低基础库: `1.2.0` */
+ * 输出的图片的高度 */
destHeight?: number
- /** 输出的图片的宽度
+ /** 需要基础库: `1.2.0`
*
- * 最低基础库: `1.2.0` */
+ * 输出的图片的宽度 */
destWidth?: number
/** 接口调用失败的回调函数 */
fail?: CanvasToTempFilePathFailCallback
- /** 目标文件的类型
+ /** 需要基础库: `1.7.0`
+ *
+ * 目标文件的类型
*
* 可选值:
* - 'jpg': jpg 图片;
- * - 'png': png 图片;
- *
- * 最低基础库: `1.7.0` */
+ * - 'png': png 图片; */
fileType?: 'jpg' | 'png'
- /** 指定的画布区域的高度
+ /** 需要基础库: `1.2.0`
*
- * 最低基础库: `1.2.0` */
+ * 指定的画布区域的高度 */
height?: number
- /** 图片的质量,目前仅对 jpg 有效。取值范围为 (0, 1],不在范围内时当作 1.0 处理。
+ /** 需要基础库: `1.7.0`
*
- * 最低基础库: `1.7.0` */
+ * 图片的质量,目前仅对 jpg 有效。取值范围为 (0, 1],不在范围内时当作 1.0 处理。 */
quality?: number
/** 接口调用成功的回调函数 */
success?: CanvasToTempFilePathSuccessCallback
- /** 指定的画布区域的宽度
+ /** 需要基础库: `1.2.0`
*
- * 最低基础库: `1.2.0` */
+ * 指定的画布区域的宽度 */
width?: number
- /** 指定的画布区域的左上角横坐标
+ /** 需要基础库: `1.2.0`
*
- * 最低基础库: `1.2.0` */
+ * 指定的画布区域的左上角横坐标 */
x?: number
- /** 指定的画布区域的左上角纵坐标
+ /** 需要基础库: `1.2.0`
*
- * 最低基础库: `1.2.0` */
+ * 指定的画布区域的左上角纵坐标 */
y?: number
}
interface CanvasToTempFilePathSuccessCallbackResult {
@@ -761,29 +3551,35 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
tempFilePath: string
errMsg: string
}
+ interface CardDesc {
+ /** 卡标题 */
+ key: string
+ /** 卡描述文案 */
+ value: string
+ }
/** characteristics列表 */
interface Characteristic {
- /** Characteristic 的 uuid */
+ /** characteristic 的 UUID */
uuid: string
/** 描述符数据 */
descriptors?: CharacteristicDescriptor[]
- /** 特征值权限 */
+ /** 特征权限 */
permission?: CharacteristicPermission
- /** 特征值支持的操作 */
+ /** 特征支持的操作 */
properties?: CharacteristicProperties
- /** 特征值对应的二进制值 */
+ /** 特征对应的二进制值 */
value?: ArrayBuffer
}
/** 描述符数据 */
interface CharacteristicDescriptor {
- /** Descriptor 的 uuid */
+ /** Descriptor 的 UUID */
uuid: string
/** 描述符的权限 */
permission?: DescriptorPermission
/** 描述符数据 */
value?: ArrayBuffer
}
- /** 特征值权限 */
+ /** 特征权限 */
interface CharacteristicPermission {
/** 加密读请求 */
readEncryptionRequired?: boolean
@@ -794,7 +3590,7 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
/** 可写 */
writeable?: boolean
}
- /** 特征值支持的操作 */
+ /** 特征支持的操作 */
interface CharacteristicProperties {
/** 回包 */
indicate?: boolean
@@ -804,6 +3600,52 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
read?: boolean
/** 写 */
write?: boolean
+ /** 无回复写 */
+ writeNoResponse?: boolean
+ }
+ interface CheckDeviceSupportHevcOption {
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: CheckDeviceSupportHevcCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: CheckDeviceSupportHevcFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: CheckDeviceSupportHevcSuccessCallback
+ }
+ interface CheckDeviceSupportHevcSuccessCallbackResult {
+ /** 设备是否支持 H.265 编码 */
+ supportHevc: boolean
+ errMsg: string
+ }
+ interface CheckEmployeeRelationOption {
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: CheckEmployeeRelationCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: CheckEmployeeRelationFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: CheckEmployeeRelationSuccessCallback
+ }
+ interface CheckEmployeeRelationSuccessCallbackResult {
+ /** 绑定状态
+ *
+ * 可选值:
+ * - 'accept': 已绑定;
+ * - 'reject': 已拒绝;
+ * - '': 未绑定且未拒绝; */
+ bindingStatus: 'accept' | 'reject' | ''
+ errMsg: string
+ }
+ interface CheckIsAddedToMyMiniProgramOption {
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: CheckIsAddedToMyMiniProgramCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: CheckIsAddedToMyMiniProgramFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: CheckIsAddedToMyMiniProgramSuccessCallback
+ }
+ interface CheckIsAddedToMyMiniProgramSuccessCallbackResult {
+ /** 是否被添加至 「我的小程序」 */
+ added: boolean
+ errMsg: string
}
interface CheckIsOpenAccessibilityOption {
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
@@ -816,6 +3658,7 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
interface CheckIsOpenAccessibilitySuccessCallbackOption {
/** iOS 上开启辅助功能旁白,安卓开启 talkback 时返回 true */
open: boolean
+ errMsg: string
}
interface CheckIsSoterEnrolledInDeviceOption {
/** 认证方式
@@ -877,8 +3720,10 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
cityName: string
/** 国标收货地址第三级地址 */
countyName: string
- /** 详细收货地址信息 */
+ /** 详细收货地址信息(包括街道地址) */
detailInfo: string
+ /** 新选择器详细收货地址信息 */
+ detailInfoNew: string
/** 错误信息 */
errMsg: string
/** 收货地址国家码 */
@@ -887,11 +3732,30 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
postalCode: string
/** 国标收货地址第一级地址 */
provinceName: string
+ /** 国标收货地址第四级地址 */
+ streetName: string
/** 收货人手机号码 */
telNumber: string
/** 收货人姓名 */
userName: string
}
+ interface ChooseContactOption {
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: ChooseContactCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: ChooseContactFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: ChooseContactSuccessCallback
+ }
+ interface ChooseContactSuccessCallbackOption {
+ /** 联系人姓名 */
+ displayName: string
+ /** 手机号 */
+ phoneNumber: string
+ /** 选定联系人的所有手机号(部分 Android 系统只能选联系人而不能选特定手机号) */
+ phoneNumberList: string
+ errMsg: string
+ }
/** 返回选择的文件的本地临时文件对象数组 */
interface ChooseFile {
/** 选择的文件名称 */
@@ -935,9 +3799,9 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
interface ChooseImageSuccessCallbackResult {
/** 图片的本地临时文件路径列表 (本地路径) */
tempFilePaths: string[]
- /** 图片的本地临时文件列表
+ /** 需要基础库: `1.2.0`
*
- * 最低基础库: `1.2.0` */
+ * 图片的本地临时文件列表 */
tempFiles: ImageFile[]
errMsg: string
}
@@ -984,18 +3848,31 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
* - 1: 个人; */
type: 0 | 1
}
+ interface ChooseLicensePlateOption {
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: ChooseLicensePlateCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: ChooseLicensePlateFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: ChooseLicensePlateSuccessCallback
+ }
+ interface ChooseLicensePlateSuccessCallbackResult {
+ /** 用户选择的车牌号 */
+ plateNumber: string
+ errMsg: string
+ }
interface ChooseLocationOption {
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: ChooseLocationCompleteCallback
/** 接口调用失败的回调函数 */
fail?: ChooseLocationFailCallback
- /** 目标地纬度
+ /** 需要基础库: `2.9.0`
*
- * 最低基础库: `2.9.0` */
+ * 目标地纬度 */
latitude?: number
- /** 目标地经度
+ /** 需要基础库: `2.9.0`
*
- * 最低基础库: `2.9.0` */
+ * 目标地经度 */
longitude?: number
/** 接口调用成功的回调函数 */
success?: ChooseLocationSuccessCallback
@@ -1004,9 +3881,9 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
/** 详细地址 */
address: string
/** 纬度,浮点数,范围为-90~90,负数表示南纬。使用 gcj02 国测局坐标系 */
- latitude: string
+ latitude: number
/** 经度,浮点数,范围为-180~180,负数表示西经。使用 gcj02 国测局坐标系 */
- longitude: string
+ longitude: number
/** 位置名称 */
name: string
errMsg: string
@@ -1020,19 +3897,20 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
camera?: 'back' | 'front'
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: ChooseMediaCompleteCallback
- /** 最多可以选择的文件个数 */
+ /** 最多可以选择的文件个数,基础库2.25.0前,最多可支持9个文件,2.25.0及以后最多可支持20个文件 */
count?: number
/** 接口调用失败的回调函数 */
fail?: ChooseMediaFailCallback
- /** 拍摄视频最长拍摄时间,单位秒。时间范围为 3s 至 30s 之间 */
+ /** 拍摄视频最长拍摄时间,单位秒。时间范围为 3s 至 60s 之间。不限制相册。 */
maxDuration?: number
/** 文件类型
*
* 可选值:
* - 'image': 只能拍摄图片或从相册选择图片;
- * - 'video': 只能拍摄视频或从相册选择视频; */
- mediaType?: Array<'image' | 'video'>
- /** 仅对 mediaType 为 image 时有效,是否压缩所选文件 */
+ * - 'video': 只能拍摄视频或从相册选择视频;
+ * - 'mix': 可同时选择图片和视频; */
+ mediaType?: Array<'image' | 'video' | 'mix'>
+ /** 是否压缩所选文件,基础库2.25.0前仅对 mediaType 为 image 时有效,2.25.0及以后对全量 mediaType 有效 */
sizeType?: string[]
/** 图片和视频选择的来源
*
@@ -1046,7 +3924,7 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
interface ChooseMediaSuccessCallbackResult {
/** 本地临时文件列表 */
tempFiles: MediaFile[]
- /** 文件类型,有效值有 image 、video */
+ /** 文件类型,有效值有 image 、video、mix */
type: string
errMsg: string
}
@@ -1055,9 +3933,9 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
count: number
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: ChooseMessageFileCompleteCallback
- /** 根据文件拓展名过滤,仅 type==file 时有效。每一项都不能是空字符串。默认不过滤。
+ /** 需要基础库: `2.6.0`
*
- * 最低基础库: `2.6.0` */
+ * 根据文件拓展名过滤,仅 type==file 时有效。每一项都不能是空字符串。默认不过滤。 */
extension?: string[]
/** 接口调用失败的回调函数 */
fail?: ChooseMessageFileFailCallback
@@ -1077,6 +3955,29 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
tempFiles: ChooseFile[]
errMsg: string
}
+ interface ChoosePoiOption {
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: ChoosePoiCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: ChoosePoiFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: ChoosePoiSuccessCallback
+ }
+ interface ChoosePoiSuccessCallbackResult {
+ /** 详细地址 */
+ address: string
+ /** 城市名称 */
+ city: number
+ /** 纬度,浮点数,范围为-90~90,负数表示南纬。使用 gcj02 国测局坐标系(即将废弃) */
+ latitude: number
+ /** 经度,浮点数,范围为-180~180,负数表示西经。使用 gcj02 国测局坐标系(即将废弃) */
+ longitude: number
+ /** 位置名称 */
+ name: string
+ /** 选择城市时,值为 1,选择精确位置时,值为 2 */
+ type: number
+ errMsg: string
+ }
interface ChooseVideoOption {
/** 默认拉起的是前置或者后置摄像头。部分 Android 手机下由于系统 ROM 不支持无法生效
*
@@ -1086,9 +3987,9 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
camera?: 'back' | 'front'
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: ChooseVideoCompleteCallback
- /** 是否压缩所选择的视频文件
+ /** 需要基础库: `1.6.0`
*
- * 最低基础库: `1.6.0` */
+ * 是否压缩所选择的视频文件 */
compressed?: boolean
/** 接口调用失败的回调函数 */
fail?: ChooseVideoFailCallback
@@ -1116,6 +4017,22 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
width: number
errMsg: string
}
+ interface ClearFiltersOption {
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: ClearFiltersCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: ClearFiltersFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: ClearFiltersSuccessCallback
+ }
+ interface ClearMakeupsOption {
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: ClearMakeupsCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: ClearMakeupsFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: ClearMakeupsSuccessCallback
+ }
interface ClearOption {
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: ClearCompleteCallback
@@ -1124,6 +4041,14 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
/** 接口调用成功的回调函数 */
success?: ClearSuccessCallback
}
+ interface ClearStickersOption {
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: ClearStickersCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: ClearStickersFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: ClearStickersSuccessCallback
+ }
interface ClearStorageOption {
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: ClearStorageCompleteCallback
@@ -1132,8 +4057,23 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
/** 接口调用成功的回调函数 */
success?: ClearStorageSuccessCallback
}
+ /** 菜单按钮的布局位置信息 */
+ interface ClientRect {
+ /** 下边界坐标,单位:px */
+ bottom: number
+ /** 高度,单位:px */
+ height: number
+ /** 左边界坐标,单位:px */
+ left: number
+ /** 右边界坐标,单位:px */
+ right: number
+ /** 上边界坐标,单位:px */
+ top: number
+ /** 宽度,单位:px */
+ width: number
+ }
interface CloseBLEConnectionOption {
- /** 用于区分设备的 id */
+ /** 蓝牙设备 id */
deviceId: string
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: CloseBLEConnectionCompleteCallback
@@ -1162,6 +4102,10 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
/** 接口调用成功的回调函数 */
success?: CloseSocketSuccessCallback
}
+ interface CloseSyncOption {
+ /** 需要被关闭的文件描述符。fd 通过 [FileSystemManager.open](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.open.html) 或 [FileSystemManager.openSync](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.openSync.html) 接口获得 */
+ fd: string
+ }
/** 颜色。可以用以下几种方式来表示 canvas 中使用的颜色:
*
* - RGB 颜色: 如 `'rgb(255, 0, 0)'`
@@ -1328,6 +4272,14 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
src: string
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: CompressImageCompleteCallback
+ /** 需要基础库: `2.26.0`
+ *
+ * 压缩后图片的高度,单位为px,若不填写则默认以compressedWidth为准等比缩放 */
+ compressedHeight?: number
+ /** 需要基础库: `2.26.0`
+ *
+ * 压缩后图片的宽度,单位为px,若不填写则默认以compressedHeight为准等比缩放。 */
+ compressedWidth?: number
/** 接口调用失败的回调函数 */
fail?: CompressImageFailCallback
/** 压缩质量,范围0~100,数值越小,质量越低,压缩率越高(仅对jpg有效)。 */
@@ -1345,13 +4297,6 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
bitrate: number
/** 帧率 */
fps: number
- /** 压缩质量
- *
- * 可选值:
- * - 'low': 低;
- * - 'medium': 中;
- * - 'high': 高; */
- quality: 'low' | 'medium' | 'high'
/** 相对于原视频的分辨率比例,取值范围(0, 1] */
resolution: number
/** 视频文件路径,可以是临时文件路径也可以是永久文件路径 */
@@ -1360,6 +4305,13 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
complete?: CompressVideoCompleteCallback
/** 接口调用失败的回调函数 */
fail?: CompressVideoFailCallback
+ /** 压缩质量
+ *
+ * 可选值:
+ * - 'low': 低;
+ * - 'medium': 中;
+ * - 'high': 高; */
+ quality?: 'low' | 'medium' | 'high'
/** 接口调用成功的回调函数 */
success?: CompressVideoSuccessCallback
}
@@ -1370,14 +4322,6 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
tempFilePath: string
errMsg: string
}
- interface ConnectOption {
- /** 接口调用结束的回调函数(调用成功、失败都会执行) */
- complete?: ConnectCompleteCallback
- /** 接口调用失败的回调函数 */
- fail?: ConnectFailCallback
- /** 接口调用成功的回调函数 */
- success?: ConnectSuccessCallback
- }
interface ConnectSocketOption {
/** 开发者服务器 wss 接口地址 */
url: string
@@ -1385,25 +4329,29 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
complete?: ConnectSocketCompleteCallback
/** 接口调用失败的回调函数 */
fail?: ConnectSocketFailCallback
+ /** 需要基础库: `2.29.0`
+ *
+ * 强制使用蜂窝网络发送请求 */
+ forceCellularNetwork?: boolean
/** HTTP Header,Header 中不能设置 Referer */
header?: IAnyObject
- /** 是否开启压缩扩展
+ /** 需要基础库: `2.8.0`
*
- * 最低基础库: `2.8.0` */
+ * 是否开启压缩扩展 */
perMessageDeflate?: boolean
- /** 子协议数组
+ /** 需要基础库: `1.4.0`
*
- * 最低基础库: `1.4.0` */
+ * 子协议数组 */
protocols?: string[]
/** 接口调用成功的回调函数 */
success?: ConnectSocketSuccessCallback
- /** 建立 TCP 连接的时候的 TCP_NODELAY 设置
+ /** 需要基础库: `2.4.0`
*
- * 最低基础库: `2.4.0` */
+ * 建立 TCP 连接的时候的 TCP_NODELAY 设置 */
tcpNoDelay?: boolean
- /** 超时时间,单位为毫秒
+ /** 需要基础库: `2.10.0`
*
- * 最低基础库: `2.10.0` */
+ * 超时时间,单位为毫秒 */
timeout?: number
}
interface ConnectWifiOption {
@@ -1417,27 +4365,26 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
complete?: ConnectWifiCompleteCallback
/** 接口调用失败的回调函数 */
fail?: ConnectWifiFailCallback
- /** 跳转到系统设置页进行连接,仅安卓生效
+ /** 需要基础库: `2.12.0`
*
- * 最低基础库: `2.12.0` */
+ * 跳转到系统设置页进行连接 */
maunal?: boolean
+ /** 需要基础库: `2.22.0`
+ *
+ * 是否需要返回部分 Wi-Fi 信息,仅安卓生效 */
+ partialInfo?: boolean
/** 接口调用成功的回调函数 */
success?: ConnectWifiSuccessCallback
}
+ /** 一个字典对象,用于指定是否禁用规范化(默认启用规范化) */
+ interface Constraints {
+ /** 如果指定为true则禁用标准化,默认为false */
+ disableNormalization?: boolean
+ }
interface ContextCallbackResult {
/** 节点对应的 Context 对象 */
context: IAnyObject
}
- interface CopyFileFailCallbackResult {
- /** 错误信息
- *
- * 可选值:
- * - 'fail permission denied, copyFile ${srcPath} -> ${destPath}': 指定目标文件路径没有写权限;
- * - 'fail no such file or directory, copyFile ${srcPath} -> ${destPath}': 源文件不存在,或目标文件路径的上层目录不存在;
- * - 'fail the maximum size of the file storage limit is exceeded': 存储空间不足;
- * - 'fail sdcard not mounted': Android sdcard 挂载失败; */
- errMsg: string
- }
interface CopyFileOption {
/** 目标文件路径,支持本地路径 */
destPath: string
@@ -1451,7 +4398,7 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
success?: CopyFileSuccessCallback
}
interface CreateBLEConnectionOption {
- /** 用于区分设备的 id */
+ /** 蓝牙设备 id */
deviceId: string
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: CreateBLEConnectionCompleteCallback
@@ -1459,7 +4406,7 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
fail?: CreateBLEConnectionFailCallback
/** 接口调用成功的回调函数 */
success?: CreateBLEConnectionSuccessCallback
- /** 超时时间,单位ms,不填表示不会超时 */
+ /** 超时时间,单位 ms,不填表示不会超时 */
timeout?: number
}
interface CreateBLEPeripheralServerOption {
@@ -1477,13 +4424,63 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
server: BLEPeripheralServer
errMsg: string
}
+ interface CreateCacheManagerOption {
+ /** 额外的缓存处理 */
+ extra?: ExtraOption
+ /** 全局缓存有效时间,单位为毫秒,默认为 7 天,最长不超过 30 天 */
+ maxAge?: number
+ /** 缓存模式
+ *
+ * 可选值:
+ * - 'weakNetwork': 弱网/离线使用缓存返回;
+ * - 'always': 总是使用缓存返回;
+ * - 'none': 不开启,后续可手动开启/停止使用缓存返回; */
+ mode?: 'weakNetwork' | 'always' | 'none'
+ /** 全局 origin */
+ origin?: string
+ }
+ interface CreateGlobalPaymentOption {
+ /** 根据每笔订单实际的交易地区,提供地区编码,不同地区可能匹配不同的支付方式,参考 ISO3166二位字母代码标准,大写。 */
+ mchRegion: string
+ /** true为开发环境,false为生产环境。不传入该参数,则默认为false,即生产环境。 */
+ isSandbox?: string
+ }
+ interface CreateInferenceSessionOption {
+ /** 模型文件路径,目前只执行后缀为.onnx格式(支持代码包路径,和本地文件系统路径) */
+ model: string
+ /** 是否使用NPU推理,仅对IOS有效 */
+ allowNPU?: boolean
+ /** 是否生成量化模型推理 */
+ allowQuantize?: boolean
+ /** 推理精度,有效值为 0 - 4。一般来说,使用的precisionLevel等级越低,推理速度越快,但可能会损失精度。推荐开发者在开发时,在效果满足需求时优先使用更低精度以提高推理速度,节约能耗。
+ *
+ * 可选值:
+ * - 0: 使用fp16 存储浮点,fp16计算,Winograd 算法也采取fp16 计算,开启近似math计算;
+ * - 1: 使用fp16 存储浮点,fp16计算,禁用 Winograd 算法,开启近似math计算;
+ * - 2: 使用fp16 存储浮点,fp32计算,开启 Winograd,开启近似math计算;
+ * - 3: 使用fp32 存储浮点,fp32计算,开启 Winograd,开启近似math计算;
+ * - 4: 使用fp32 存储浮点,fp32计算,开启 Winograd,关闭近似math计算; */
+ precisionLevel?: 0 | 1 | 2 | 3 | 4
+ /** 输入典型分辨率 */
+ typicalShape?: IAnyObject
+ }
+ interface CreateInnerAudioContextOption {
+ /** 需要基础库: `2.19.0`
+ *
+ * 是否使用 WebAudio 作为底层音频驱动,默认关闭。对于短音频、播放频繁的音频建议开启此选项,开启后将获得更优的性能表现。由于开启此选项后也会带来一定的内存增长,因此对于长音频建议关闭此选项。 */
+ useWebAudioImplement?: boolean
+ }
/** 选项 */
interface CreateIntersectionObserverOption {
/** 初始的相交比例,如果调用时检测到的相交比例与这个值不相等且达到阈值,则会触发一次监听器的回调函数。 */
initialRatio?: number
- /** 是否同时观测多个目标节点(而非一个),如果设为 true ,observe 的 targetSelector 将选中多个节点(注意:同时选中过多节点将影响渲染性能)
+ /** 需要基础库: `3.5.7`
*
- * 最低基础库: `2.0.0` */
+ * 是否使用原生观察器模式。 */
+ nativeMode?: boolean
+ /** 需要基础库: `2.0.0`
+ *
+ * 是否同时观测多个目标节点(而非一个),如果设为 true ,observe 的 targetSelector 将选中多个节点(注意:同时选中过多节点将影响渲染性能) */
observeAll?: boolean
/** 一个数值数组,包含所有阈值。 */
thresholds?: number[]
@@ -1499,24 +4496,132 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
fps?: number
/** 视频关键帧间隔 */
gop?: number
+ /** 画布录制高度 */
+ height?: number
/** 视频比特率(kbps),最小值 600,最大值 3000 */
videoBitsPerSecond?: number
+ /** 画布录制宽度 */
+ width?: number
+ }
+ interface CreateOffscreenCanvasOption {
+ /** 在自定义组件下,当前组件实例的 this */
+ compInst?: Component.TrivialInstance | Page.TrivialInstance
+ /** 画布高度 */
+ height?: number
+ /** 创建的离屏 canvas 类型
+ *
+ * 可选值:
+ * - 'webgl': webgl类型上下文;
+ * - '2d': 2d类型上下文; */
+ type?: 'webgl' | '2d'
+ /** 画布宽度 */
+ width?: number
}
interface CreateRewardedVideoAdOption {
/** 广告单元 id */
adUnitId: string
- /** 是否启用多例模式,默认为false
+ /** 需要基础库: `3.7.1`
*
- * 最低基础库: `2.8.0` */
+ * 是否禁用分享页,默认为false */
+ disableFallbackSharePage?: boolean
+ /** 需要基础库: `2.8.0`
+ *
+ * 是否启用多例模式,默认为false */
multiton?: boolean
}
+ interface CreateTCPSocketOption {
+ /** 需要基础库: `3.6.4`
+ *
+ * 套接字族,必须是 IPv4 或者 IPv6,默认是 IPv4
+ *
+ * 可选值:
+ * - 'ipv4': IPv4;
+ * - 'ipv6': IPv6; */
+ type?: 'ipv4' | 'ipv6'
+ }
/** 可选参数 */
interface CreateWorkerOption {
- /** 是否使用实验worker。在iOS下,实验worker的JS运行效率比非实验worker提升近十倍,如需在worker内进行重度计算的建议开启此选项。
+ /** 需要基础库: `2.13.0`
*
- * 最低基础库: `2.13.0` */
+ * 是否使用实验worker。在iOS下,实验worker的JS运行效率比非实验worker提升数倍,如需在worker内进行重度计算的建议开启此选项。同时,实验worker存在极小概率会在系统资源紧张时被系统回收,因此建议配合 worker.onProcessKilled 事件使用,在worker被回收后可重新创建一个。 */
useExperimentalWorker?: boolean
}
+ interface CropImageOption {
+ /** 裁剪比例
+ *
+ * 可选值:
+ * - '16:9': 宽高比为16比9;
+ * - '9:16': 宽高比为9比16;
+ * - '4:3': 宽高比为4比3;
+ * - '3:4': 宽高比为3比4;
+ * - '5:4': 宽高比为5比4;
+ * - '4:5': 宽高比为4比5;
+ * - '1:1': 宽高比为1比1; */
+ cropScale: '16:9' | '9:16' | '4:3' | '3:4' | '5:4' | '4:5' | '1:1'
+ /** 图片路径,图片的路径,支持本地路径、代码包路径 */
+ src: string
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: CropImageCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: CropImageFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: CropImageSuccessCallback
+ }
+ interface CropImageSuccessCallbackResult {
+ /** 编辑后图片的临时文件路径 (本地路径) */
+ tempFilePath: string
+ errMsg: string
+ }
+ interface CurrentState {
+ /** 当前缓存中的日志条数 */
+ logCount: number
+ /** 当前缓存中最大可存日志条数 */
+ maxLogCount: number
+ /** 当前缓存最大可用空间,以字节为单位 */
+ maxSize: number
+ /** 当前缓存中已使用空间,以字节为单位 */
+ size: number
+ }
+ /** 自定义路由动画配置 */
+ interface CustomRouteConfig {
+ /** 遮罩层背景色,支持 `rgba()` 和 `#RRGGBBAA` 写法 */
+ barrierColor: string
+ /** 点击遮罩层返回上一页 */
+ barrierDismissible: boolean
+ /** 无障碍语义 */
+ barrierLabel: string
+ /** 是否与前一个页面联动,决定前一个页 `secondaryAnimation` 是否生效 */
+ canTransitionFrom: boolean
+ /** 是否与下一个页面联动,决定当前页 `secondaryAnimation` 是否生效 */
+ canTransitionTo: boolean
+ /** 是否保持前一个页面状态 */
+ maintainState: boolean
+ /** 下一个页面推入后,不显示前一个页面 */
+ opaque: boolean
+ /** 页面推出动画时长,单位 ms */
+ reverseTransitionDuration: number
+ /** 页面推入动画时长,单位 ms */
+ transitionDuration: number
+ }
+ /** 自定义路由上下文对象 */
+ interface CustomRouteContext {
+ /** 返回上一级,效果同 `wx.navigateBack`,仅可用于 `worklet` 函数内 */
+ didPop: (...args: any[]) => any
+ /** 动画控制器,影响推入页面的进入和退出过渡效果 */
+ primaryAnimation: SharedValue
+ /** 动画控制器状态 */
+ primaryAnimationStatus: SharedValue
+ /** 动画控制器,影响栈顶页面的推出过渡效果 */
+ secondaryAnimation: SharedValue
+ /** 动画控制器状态 */
+ secondaryAnimationStatus: SharedValue
+ /** 手势开始控制路由,与共享元素动画有关 */
+ startUserGesture: (...args: any[]) => any
+ /** 手势不再控制路由,与 `startUserGesture` 成对调用 */
+ stopUserGesture: (...args: any[]) => any
+ /** 当前路由进度由手势控制 */
+ userGestureInProgress: SharedValue
+ }
/** 弹幕内容 */
interface Danmu {
/** 弹幕文字 */
@@ -1524,6 +4629,49 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
/** 弹幕颜色 */
color?: string
}
+ /** 动画配置 */
+ interface DecayOption {
+ /** 边界值,长度为 2 的数组 */
+ clamp?: any[]
+ /** 衰减速率 */
+ deceleration?: number
+ /** 初速度 */
+ velocity?: number
+ }
+ interface DeleteTextOption {
+ /** 选区开始位置 */
+ index: number
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: DeleteTextCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: DeleteTextFailCallback
+ /** 选区长度 */
+ length?: number
+ /** 接口调用成功的回调函数 */
+ success?: DeleteTextSuccessCallback
+ }
+ /** 帧深度纹理buffer对象 */
+ interface DepthBufferRes {
+ /** 深度纹理buffer */
+ DepthAddress: ArrayBuffer
+ /** 深度纹理高 */
+ height: number
+ /** 深度纹理宽 */
+ width: number
+ }
+ /** 需要基础库: `3.0.0`
+ *
+ * 深度识别配置。用法详情[指南文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/visionkit/depth.html)。 */
+ interface DepthTrack {
+ /** 需要基础库: `3.0.0`
+ *
+ * 深度识别模式
+ *
+ * 可选值:
+ * - 1: 通过摄像头实时检测;
+ * - 2: 静态图片检测; */
+ mode: 1 | 2
+ }
/** 可选的字体描述符 */
interface DescOption {
/** 字体样式,可选值为 normal / italic / oblique */
@@ -1547,6 +4695,110 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
/** 经度 */
longitude: number
}
+ interface DetectBodyOption {
+ /** 人脸图像像素点数据,每四项表示一个像素点的 RGBA */
+ frameBuffer: ArrayBuffer
+ /** 图像高度 */
+ height: number
+ /** 图像宽度 */
+ width: number
+ /** 评分阈值。正常情况传入 0.8 即可。 */
+ scoreThreshold?: number
+ /** 图像源类型。正常情况传入 1 即可。当输入的图片是来自一个连续视频的每一帧图像时,sourceType 传入 0 会得到更优的效果
+ *
+ * 可选值:
+ * - 1: 表示输入的图片是随机的图片;
+ * - 0: 表示输入的图片是来自一个连续视频的每一帧图像; */
+ sourceType?: 1 | 0
+ }
+ interface DetectDepthOption {
+ /** 需要识别深度的图像像素点数据,每四项表示一个像素点的 RGBA */
+ frameBuffer: ArrayBuffer
+ /** 图像高度 */
+ height: number
+ /** 图像宽度 */
+ width: number
+ }
+ interface DetectFaceOption {
+ /** 人脸图像像素点数据,每四项表示一个像素点的 RGBA */
+ frameBuffer: ArrayBuffer
+ /** 图像高度 */
+ height: number
+ /** 图像宽度 */
+ width: number
+ /** 算法模型类型。正常情况传入 1 即可。0、1、2 分别表示小、中、大模型,模型越大识别准确率越高,但资源占用也越高。建议根据用户设备性能进行选择。
+ *
+ * 可选值:
+ * - 0: 小模型;
+ * - 1: 中模型;
+ * - 2: 大模型; */
+ modelModel?: 0 | 1 | 2
+ /** 是否返回瞳孔周围点信息,默认为 false。 */
+ pupilInfo?: boolean
+ /** 评分阈值。正常情况传入 0.8 即可。 */
+ scoreThreshold?: number
+ /** 图像源类型。正常情况传入 1 即可。当输入的图片是来自一个连续视频的每一帧图像时,sourceType 传入 0 会得到更优的效果
+ *
+ * 可选值:
+ * - 1: 表示输入的图片是随机的图片;
+ * - 0: 表示输入的图片是来自一个连续视频的每一帧图像; */
+ sourceType?: 1 | 0
+ }
+ interface DetectHandOption {
+ /** 人脸图像像素点数据,每四项表示一个像素点的 RGBA */
+ frameBuffer: ArrayBuffer
+ /** 图像高度 */
+ height: number
+ /** 图像宽度 */
+ width: number
+ /** 算法检测模式
+ *
+ * 可选值:
+ * - 0: 检测模式,输出框和点;
+ * - 1: 手势模式,输出框和手势分类;
+ * - 2: 结合0和1模式,输出框、点、手势分类; */
+ algoMode?: 0 | 1 | 2
+ /** 评分阈值。正常情况传入 0.8 即可。 */
+ scoreThreshold?: number
+ }
+ interface DeviceInfo {
+ /** 应用(微信APP)二进制接口类型(仅 Android 支持) */
+ abi: string
+ /** 设备性能等级(仅 Android 支持)。取值为:-2 或 0(该设备无法运行小游戏),-1(性能未知),>=1(设备性能值,该值越高,设备性能越好,目前最高不到50) 注意:从基础库3.4.5开始,本返回值停止维护,请使用[wx.getDeviceBenchmarkInfo](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getDeviceBenchmarkInfo.html)获取设备性能等级 */
+ benchmarkLevel: number
+ /** 设备品牌 */
+ brand: string
+ /** 需要基础库: `2.29.0`
+ *
+ * 设备 CPU 型号(仅 Android 支持)(Tips: GPU 型号可通过 WebGLRenderingContext.getExtension('WEBGL_debug_renderer_info') 来获取) */
+ cpuType: string
+ /** 需要基础库: `2.25.1`
+ *
+ * 设备二进制接口类型(仅 Android 支持) */
+ deviceAbi: string
+ /** 需要基础库: `2.30.0`
+ *
+ * 设备内存大小,单位为 MB */
+ memorySize: string
+ /** 设备型号。新机型刚推出一段时间会显示unknown,微信会尽快进行适配。 */
+ model: string
+ /** 客户端平台 */
+ platform: string
+ /** 操作系统及版本 */
+ system: string
+ }
+ interface DeviceVoIPInfo {
+ /** 需要基础库: `2.30.4`
+ *
+ * 设备组的唯一标识 id(仅设备组时) */
+ group_id: string
+ /** 设备型号 id。通过微信公众平台注册设备获得。(仅单台设备时) */
+ model_id: string
+ /** 设备唯一序列号。(仅单台设备时) */
+ sn: string
+ /** 设备(组)授权状态。0:未授权;1:已授权 */
+ status: number
+ }
interface DisableAlertBeforeUnloadOption {
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: DisableAlertBeforeUnloadCompleteCallback
@@ -1560,88 +4812,49 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
url: string
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: DownloadFileCompleteCallback
+ /** 需要基础库: `2.10.4`
+ *
+ * 是否开启 http2 */
+ enableHttp2?: boolean
+ /** 是否开启 profile。iOS 和 Android 端默认开启,其他端暂不支持。开启后可在接口回调的 res.profile 中查看性能调试信息。 */
+ enableProfile?: boolean
+ /** 需要基础库: `2.10.4`
+ *
+ * 是否开启 Quic/h3 协议(iOS 微信目前使用 gQUIC-Q43;Android 微信在 v8.0.54 前使用 gQUIC-Q43,v8.0.54 开始使用 IETF QUIC,即 h3 协议;PC微信使用 IETF QUIC,即 h3 协议) */
+ enableQuic?: boolean
/** 接口调用失败的回调函数 */
fail?: DownloadFileFailCallback
- /** 指定文件下载后存储的路径 (本地路径)
+ /** 需要基础库: `1.8.0`
*
- * 最低基础库: `1.8.0` */
+ * 指定文件下载后存储的路径 (本地路径) */
filePath?: string
/** HTTP 请求的 Header,Header 中不能设置 Referer */
header?: IAnyObject
/** 接口调用成功的回调函数 */
success?: DownloadFileSuccessCallback
- /** 超时时间,单位为毫秒
+ /** 需要基础库: `2.10.0`
*
- * 最低基础库: `2.10.0` */
+ * 超时时间,单位为毫秒,默认值为 60000 即一分钟。 */
timeout?: number
}
interface DownloadFileSuccessCallbackResult {
/** 用户文件路径 (本地路径)。传入 filePath 时会返回,跟传入的 filePath 一致 */
filePath: string
- /** 网络请求过程中一些调试信息
+ /** 需要基础库: `2.10.4`
*
- * 最低基础库: `2.10.4` */
- profile: DownloadProfile
+ * 网络请求过程中一些调试信息,[查看详细说明](https://developers.weixin.qq.com/miniprogram/dev/framework/performance/network.html)。目前 iOS 和 Android 端支持。 */
+ profile: RequestProfile
/** 开发者服务器返回的 HTTP 状态码 */
statusCode: number
/** 临时文件路径 (本地路径)。没传入 filePath 指定文件存储路径时会返回,下载后的文件会存储到一个临时文件 */
tempFilePath: string
errMsg: string
}
- /** 网络请求过程中一些调试信息
- *
- * 最低基础库: `2.10.4` */
- interface DownloadProfile {
- /** SSL建立完成的时间,如果不是安全连接,则值为 0 */
- SSLconnectionEnd: number
- /** SSL建立连接的时间,如果不是安全连接,则值为 0 */
- SSLconnectionStart: number
- /** HTTP(TCP) 完成建立连接的时间(完成握手),如果是持久连接,则与 fetchStart 值相等。注意如果在传输层发生了错误且重新建立连接,则这里显示的是新建立的连接完成的时间。注意这里握手结束,包括安全连接建立完成、SOCKS 授权通过 */
- connectEnd: number
- /** HTTP(TCP) 开始建立连接的时间,如果是持久连接,则与 fetchStart 值相等。注意如果在传输层发生了错误且重新建立连接,则这里显示的是新建立的连接开始的时间 */
- connectStart: number
- /** DNS 域名查询完成的时间,如果使用了本地缓存(即无 DNS 查询)或持久连接,则与 fetchStart 值相等 */
- domainLookupEnd: number
- /** DNS 域名查询开始的时间,如果使用了本地缓存(即无 DNS 查询)或持久连接,则与 fetchStart 值相等 */
- domainLookupStart: number
- /** 评估当前网络下载的kbps */
- downstreamThroughputKbpsEstimate: number
- /** 评估的网络状态 slow 2g/2g/3g/4g */
- estimate_nettype: string
- /** 组件准备好使用 HTTP 请求抓取资源的时间,这发生在检查本地缓存之前 */
- fetchStart: number
- /** 协议层根据多个请求评估当前网络的 rtt(仅供参考) */
- httpRttEstimate: number
- /** 当前请求的IP */
- peerIP: string
- /** 当前请求的端口 */
- port: number
- /** 收到字节数 */
- receivedBytedCount: number
- /** 最后一个 HTTP 重定向完成时的时间。有跳转且是同域名内部的重定向才算,否则值为 0 */
- redirectEnd: number
- /** 第一个 HTTP 重定向发生时的时间。有跳转且是同域名内的重定向才算,否则值为 0 */
- redirectStart: number
- /** HTTP请求读取真实文档结束的时间 */
- requestEnd: number
- /** HTTP请求读取真实文档开始的时间(完成建立连接),包括从本地读取缓存。连接错误重连时,这里显示的也是新建立连接的时间 */
- requestStart: number
- /** HTTP 响应全部接收完成的时间(获取到最后一个字节),包括从本地读取缓存 */
- responseEnd: number
- /** HTTP 开始接收响应的时间(获取到第一个字节),包括从本地读取缓存 */
- responseStart: number
- /** 当次请求连接过程中实时 rtt */
- rtt: number
- /** 发送的字节数 */
- sendBytesCount: number
- /** 是否复用连接 */
- socketReused: boolean
- /** 当前网络的实际下载kbps */
- throughputKbps: number
- /** 传输层根据多个请求评估的当前网络的 rtt(仅供参考) */
- transportRttEstimate: number
+ interface DownloadTaskOnHeadersReceivedListenerResult {
+ /** 开发者服务器返回的 HTTP Response Header */
+ header: IAnyObject
}
- interface DownloadTaskOnProgressUpdateCallbackResult {
+ interface DownloadTaskOnProgressUpdateListenerResult {
/** 下载进度百分比 */
progress: number
/** 预期需要下载的数据总长度,单位 Bytes */
@@ -1649,6 +4862,28 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
/** 已经下载的数据长度,单位 Bytes */
totalBytesWritten: number
}
+ interface DraggableSheetContextScrollToOption {
+ /** 是否启用滚动动画 */
+ animated?: boolean
+ /** 滚动动画时长(ms) */
+ duration?: number
+ /** 缓动函数 */
+ easingFunction?: string
+ /** 绝对目标位置 */
+ pixels?: number
+ /** 相对目标位置 */
+ size?: number
+ }
+ interface EditImageOption {
+ /** 图片路径,图片的路径,支持本地路径、代码包路径 */
+ src: string
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: EditImageCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: EditImageFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: EditImageSuccessCallback
+ }
interface EnableAlertBeforeUnloadOption {
/** 询问对话框内容 */
message: string
@@ -1659,6 +4894,109 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
/** 接口调用成功的回调函数 */
success?: EnableAlertBeforeUnloadSuccessCallback
}
+ /** 文件读取结果。res.entries 是一个对象,key是文件路径,value是一个对象 FileItem ,表示该文件的读取结果。每个 FileItem 包含 data (文件内容) 和 errMsg (错误信息) 属性。 */
+ interface EntriesResult {
+ /** 文件路径 */
+ [path: string]: ZipFileItem
+ }
+ /** 要读取的压缩包内的文件列表(当传入"all" 时表示读取压缩包内所有文件) */
+ interface EntryItem {
+ /** 压缩包内文件路径 */
+ path: string
+ /** 指定读取文件的字符编码,如果不传 encoding,则以 ArrayBuffer 格式读取文件的二进制内容
+ *
+ * 可选值:
+ * - 'ascii': ;
+ * - 'base64': ;
+ * - 'binary': ;
+ * - 'hex': ;
+ * - 'ucs2': 以小端序读取;
+ * - 'ucs-2': 以小端序读取;
+ * - 'utf16le': 以小端序读取;
+ * - 'utf-16le': 以小端序读取;
+ * - 'utf-8': ;
+ * - 'utf8': ;
+ * - 'latin1': ; */
+ encoding?:
+ | 'ascii'
+ | 'base64'
+ | 'binary'
+ | 'hex'
+ | 'ucs2'
+ | 'ucs-2'
+ | 'utf16le'
+ | 'utf-16le'
+ | 'utf-8'
+ | 'utf8'
+ | 'latin1'
+ /** 指定文件的长度,如果不指定,则读到文件末尾。有效范围:[1, fileLength]。单位:byte */
+ length?: number
+ /** 从文件指定位置开始读,如果不指定,则从文件头开始读。读取的范围应该是左闭右开区间 [position, position+length)。有效范围:[0, fileLength - 1]。单位:byte */
+ position?: number
+ }
+ /** 要擦除的线段数组。详见 [polyline 属性](https://developers.weixin.qq.com/miniprogram/dev/component/map.html#polyline)。 */
+ interface EraseLineOptions {
+ /** 线段的 id。 */
+ id: number
+ /** 指定线段的某一段,线段起点 index 为 0 */
+ index: number
+ /** 指定线段某一段中的点 */
+ point: MapPostion
+ /** 为 true 时擦除,false 时置灰 */
+ clear?: boolean
+ }
+ interface EraseLinesOption {
+ /** 要擦除的线段数组。详见 [polyline 属性](https://developers.weixin.qq.com/miniprogram/dev/component/map.html#polyline)。 */
+ lines: EraseLineOptions[]
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: EraseLinesCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: EraseLinesFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: EraseLinesSuccessCallback
+ }
+ /** 需要基础库: `3.4.0`
+ *
+ * 网络请求过程中的一些异常信息(例如:TCPSocket.connect 传了 enableHttpDNS: true,但最终未使用 HttpDNS 时,exception 就会说明未使用 HttpDNS 的原因) */
+ interface Exception {
+ /** 需要基础库: `3.4.0`
+ *
+ * 异常信息 */
+ reasons: TCPExceptionReason[]
+ }
+ /** 本次请求底层失败信息,所有失败信息均符合Errno错误码 */
+ interface ExceptionReason {
+ /** 错误原因 */
+ errMsg: string
+ /** 错误码 */
+ errno: string
+ }
+ interface ExecuteVisualLayerCommandOption {
+ /** 图层指令 */
+ command: string
+ /** 可视化图层id */
+ layerId: string
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: ExecuteVisualLayerCommandCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: ExecuteVisualLayerCommandFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: ExecuteVisualLayerCommandSuccessCallback
+ }
+ interface ExecuteVisualLayerCommandSuccessCallbackResult {
+ /** SDK 返回的 JSON 数据 */
+ data: string
+ /** 调用结果 */
+ errMsg: string
+ }
+ interface ExitCastingOption {
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: ExitCastingCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: ExitCastingFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: ExitCastingSuccessCallback
+ }
interface ExitFullScreenOption {
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: ExitFullScreenCompleteCallback
@@ -1667,6 +5005,14 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
/** 接口调用成功的回调函数 */
success?: ExitFullScreenSuccessCallback
}
+ interface ExitMiniProgramOption {
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: ExitMiniProgramCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: ExitMiniProgramFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: ExitMiniProgramSuccessCallback
+ }
interface ExitPictureInPictureOption {
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: ExitPictureInPictureCompleteCallback
@@ -1683,18 +5029,107 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
/** 接口调用成功的回调函数 */
success?: ExitVoIPChatSuccessCallback
}
+ /** 客服信息 */
+ interface ExtInfoOption {
+ /** 客服链接 */
+ url: string
+ }
+ /** 额外的缓存处理 */
+ interface ExtraOption {
+ /** 需要缓存的 wx api 接口,不传则表示支持缓存的接口全都做缓存处理。返回的如果是缓存数据,开发者可通过 fromCache 标记区分
+ *
+ * 可选值:
+ * - 'wx.login': ;
+ * - 'wx.checkSession': ;
+ * - 'wx.getSetting': ; */
+ apiList?: Array<'wx.login' | 'wx.checkSession' | 'wx.getSetting'>
+ }
interface ExtractDataSourceOption {
/** 视频源地址,只支持本地文件 */
source: string
}
+ /** 人脸角度信息,取值范围 [-1, 1],数值越接近 0 表示越正对摄像头 */
+ interface FaceAngel {
+ /** 仰俯角(点头) */
+ pitch: number
+ /** 翻滚角(左右倾) */
+ roll: number
+ /** 偏航角(摇头) */
+ yaw: number
+ }
+ /** 人脸置信度,取值范围 [0, 1],数值越大置信度越高(遮挡越少) */
+ interface FaceConf {
+ /** 整体可信度 */
+ global: number
+ /** 左眼可信度 */
+ leftEye: number
+ /** 嘴巴可信度 */
+ mouth: number
+ /** 鼻子可信度 */
+ nose: number
+ /** 右眼可信度 */
+ rightEye: number
+ }
+ interface FaceDetectOption {
+ /** 图像像素点数据,每四项表示一个像素点的 RGBA */
+ frameBuffer: ArrayBuffer
+ /** 图像高度 */
+ height: number
+ /** 图像宽度 */
+ width: number
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: FaceDetectCompleteCallback
+ /** 是否返回当前图像的人脸角度信息 */
+ enableAngle?: boolean
+ /** 是否返回当前图像的人脸的置信度(可表示器官遮挡情况) */
+ enableConf?: boolean
+ /** 是否返回多张人脸的信息 */
+ enableMultiFace?: boolean
+ /** 是否返回当前图像的人脸(106 个点) */
+ enablePoint?: boolean
+ /** 接口调用失败的回调函数 */
+ fail?: FaceDetectFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: FaceDetectSuccessCallback
+ }
+ interface FaceDetectSuccessCallbackResult {
+ /** 人脸角度信息,取值范围 [-1, 1],数值越接近 0 表示越正对摄像头 */
+ angleArray: FaceAngel
+ /** 人脸置信度,取值范围 [0, 1],数值越大置信度越高(遮挡越少) */
+ confArray: FaceConf
+ /** 脸部方框数值,对象包含 height, width, originX, originY 四个属性 (origin 为方框左上角坐标) */
+ detectRect: IAnyObject
+ /** 多人模式(enableMultiFace)下的人脸信息,每个对象包含上述其它属性 */
+ faceInfo: IAnyObject[]
+ /** 标记人脸轮廓的 106 个点位置数组,数组每个对象包含 x 和 y */
+ pointArray: IAnyObject[]
+ /** 脸部中心点横坐标,检测不到人脸则为 -1 */
+ x: number
+ /** 脸部中心点纵坐标,检测不到人脸则为 -1 */
+ y: number
+ errMsg: string
+ }
+ /** 需要基础库: `2.25.0`
+ *
+ * 人脸检测配置。用法详情[指南文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/visionkit/face.html)。安卓微信8.0.25开始支持,iOS微信8.0.24开始支持。 */
+ interface FaceTrack {
+ /** 需要基础库: `2.25.0`
+ *
+ * 人脸检测模式
+ *
+ * 可选值:
+ * - 1: 通过摄像头实时检测;
+ * - 2: 静态图片检测; */
+ mode: 1 | 2
+ }
interface Fields {
- /** 指定样式名列表,返回节点对应样式名的当前值
+ /** 需要基础库: `2.1.0`
*
- * 最低基础库: `2.1.0` */
+ * 指定样式名列表,返回节点对应样式名的当前值 */
computedStyle?: string[]
- /** 是否返回节点对应的 Context 对象
+ /** 需要基础库: `2.4.2`
*
- * 最低基础库: `2.4.2` */
+ * 是否返回节点对应的 Context 对象 */
context?: boolean
/** 是否返回节点 dataset */
dataset?: boolean
@@ -1702,19 +5137,24 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
id?: boolean
/** 是否返回节点 mark */
mark?: boolean
- /** 是否返回节点对应的 Node 实例
+ /** 需要基础库: `2.7.0`
*
- * 最低基础库: `2.7.0` */
+ * 是否返回节点对应的 Node 实例 */
node?: boolean
/** 指定属性名列表,返回节点对应属性名的当前属性值(只能获得组件文档中标注的常规属性值,id class style 和事件绑定的属性值不可获取) */
properties?: string[]
/** 是否返回节点布局位置(`left` `right` `top` `bottom`) */
rect?: boolean
+ /** 需要基础库: `3.3.0`
+ *
+ * 是否返回节点对应的 Ref 对象,仅 `Skyline` 下支持 */
+ ref?: boolean
/** 否 是否返回节点的 `scrollLeft` `scrollTop`,节点必须是 `scroll-view` 或者 `viewport` */
scrollOffset?: boolean
/** 是否返回节点尺寸(`width` `height`) */
size?: boolean
}
+ /** 文件数组 */
interface FileItem {
/** 文件保存时的时间戳,从1970/01/01 08:00:00 到当前时间的秒数 */
createTime: number
@@ -1723,55 +5163,24 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
/** 本地文件大小,以字节为单位 */
size: number
}
- interface FileSystemManagerGetFileInfoOption {
- /** 要读取的文件路径 (本地路径) */
- filePath: string
+ /** 每个 FileStats 对象包含 path 和 Stats */
+ interface FileStats {
+ /** 文件/目录路径 */
+ path: string
+ /** [Stats](https://developers.weixin.qq.com/miniprogram/dev/api/file/Stats.html)
+ *
+ * Stats 对象,即描述文件状态的对象 */
+ stats: Stats
+ }
+ interface FileSystemManagerCloseOption {
+ /** 需要被关闭的文件描述符。fd 通过 [FileSystemManager.open](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.open.html) 或 [FileSystemManager.openSync](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.openSync.html) 接口获得 */
+ fd: string
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
- complete?: GetFileInfoCompleteCallback
+ complete?: FileSystemManagerCloseCompleteCallback
/** 接口调用失败的回调函数 */
- fail?: FileSystemManagerGetFileInfoFailCallback
+ fail?: FileSystemManagerCloseFailCallback
/** 接口调用成功的回调函数 */
- success?: FileSystemManagerGetFileInfoSuccessCallback
- }
- interface FileSystemManagerGetFileInfoSuccessCallbackResult {
- /** 文件大小,以字节为单位 */
- size: number
- errMsg: string
- }
- interface FileSystemManagerGetSavedFileListOption {
- /** 接口调用结束的回调函数(调用成功、失败都会执行) */
- complete?: GetSavedFileListCompleteCallback
- /** 接口调用失败的回调函数 */
- fail?: GetSavedFileListFailCallback
- /** 接口调用成功的回调函数 */
- success?: FileSystemManagerGetSavedFileListSuccessCallback
- }
- interface FileSystemManagerGetSavedFileListSuccessCallbackResult {
- /** 文件数组 */
- fileList: FileItem[]
- errMsg: string
- }
- interface FileSystemManagerRemoveSavedFileOption {
- /** 需要删除的文件路径 (本地路径) */
- filePath: string
- /** 接口调用结束的回调函数(调用成功、失败都会执行) */
- complete?: RemoveSavedFileCompleteCallback
- /** 接口调用失败的回调函数 */
- fail?: FileSystemManagerRemoveSavedFileFailCallback
- /** 接口调用成功的回调函数 */
- success?: RemoveSavedFileSuccessCallback
- }
- interface FileSystemManagerSaveFileOption {
- /** 临时存储文件路径 (本地路径) */
- tempFilePath: string
- /** 接口调用结束的回调函数(调用成功、失败都会执行) */
- complete?: SaveFileCompleteCallback
- /** 接口调用失败的回调函数 */
- fail?: FileSystemManagerSaveFileFailCallback
- /** 要存储的文件路径 (本地路径) */
- filePath?: string
- /** 接口调用成功的回调函数 */
- success?: SaveFileSuccessCallback
+ success?: FileSystemManagerCloseSuccessCallback
}
/** 打开的文件信息数组,只有从聊天素材场景打开(scene为1173)才会携带该参数 */
interface ForwardMaterials {
@@ -1798,6 +5207,10 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
width: number
}
interface FromScreenLocationOption {
+ /** x 坐标值 */
+ x: number
+ /** y 坐标值 */
+ y: number
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: FromScreenLocationCompleteCallback
/** 接口调用失败的回调函数 */
@@ -1805,6 +5218,49 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
/** 接口调用成功的回调函数 */
success?: FromScreenLocationSuccessCallback
}
+ interface FstatOption {
+ /** 文件描述符。fd 通过 [FileSystemManager.open](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.open.html) 或 [FileSystemManager.openSync](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.openSync.html) 接口获得 */
+ fd: string
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: FstatCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: FstatFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: FstatSuccessCallback
+ }
+ interface FstatSuccessCallbackResult {
+ /** [Stats](https://developers.weixin.qq.com/miniprogram/dev/api/file/Stats.html)
+ *
+ * Stats 对象,包含了文件的状态信息 */
+ stats: Stats
+ errMsg: string
+ }
+ interface FstatSyncOption {
+ /** 文件描述符。fd 通过 [FileSystemManager.open](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.open.html) 或 [FileSystemManager.openSync](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.openSync.html) 接口获得 */
+ fd: string
+ }
+ interface FtruncateOption {
+ /** 文件描述符。fd 通过 [FileSystemManager.open](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.open.html) 或 [FileSystemManager.openSync](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.openSync.html) 接口获得 */
+ fd: string
+ /** 截断位置,默认0。如果 length 小于文件长度(单位:字节),则只有前面 length 个字节会保留在文件中,其余内容会被删除;如果 length 大于文件长度,则会对其进行扩展,并且扩展部分将填充空字节('\0') */
+ length: number
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: FtruncateCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: FtruncateFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: FtruncateSuccessCallback
+ }
+ interface FtruncateSyncOption {
+ /** 文件描述符。fd 通过 [FileSystemManager.open](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.open.html) 或 [FileSystemManager.openSync](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.openSync.html) 接口获得 */
+ fd: string
+ /** 截断位置,默认0。如果 length 小于文件长度(单位:字节),则只有前面 length 个字节会保留在文件中,其余内容会被删除;如果 length 大于文件长度,则会对其进行扩展,并且扩展部分将填充空字节('\0') */
+ length: number
+ }
+ interface GeneralCallbackResult {
+ /** 错误信息 */
+ errMsg: string
+ }
interface GetAtqaOption {
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: GetAtqaCompleteCallback
@@ -1849,9 +5305,9 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
errMsg: string
}
interface GetBLEDeviceCharacteristicsOption {
- /** 蓝牙设备 id */
+ /** 蓝牙设备 id。需要已经通过 [wx.createBLEConnection](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.createBLEConnection.html) 建立连接 */
deviceId: string
- /** 蓝牙服务 uuid,需要使用 `getBLEDeviceServices` 获取 */
+ /** 蓝牙服务 UUID。需要先调用 [wx.getBLEDeviceServices](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.getBLEDeviceServices.html) 获取 */
serviceId: string
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: GetBLEDeviceCharacteristicsCompleteCallback
@@ -1861,7 +5317,7 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
success?: GetBLEDeviceCharacteristicsSuccessCallback
}
interface GetBLEDeviceCharacteristicsSuccessCallbackResult {
- /** 设备特征值列表 */
+ /** 设备特征列表 */
characteristics: BLECharacteristic[]
errMsg: string
}
@@ -1876,12 +5332,12 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
success?: GetBLEDeviceRSSISuccessCallback
}
interface GetBLEDeviceRSSISuccessCallbackResult {
- /** 信号强度 */
+ /** 信号强度,单位 dBm */
RSSI: number
errMsg: string
}
interface GetBLEDeviceServicesOption {
- /** 蓝牙设备 id */
+ /** 蓝牙设备 id。需要已经通过 [wx.createBLEConnection](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.createBLEConnection.html) 建立连接 */
deviceId: string
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: GetBLEDeviceServicesCompleteCallback
@@ -1895,6 +5351,27 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
services: BLEService[]
errMsg: string
}
+ interface GetBLEMTUOption {
+ /** 蓝牙设备 id */
+ deviceId: string
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: GetBLEMTUCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: GetBLEMTUFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: GetBLEMTUSuccessCallback
+ /** 写模式 (iOS 特有参数)
+ *
+ * 可选值:
+ * - 'write': 有回复写;
+ * - 'writeNoResponse': 无回复写; */
+ writeType?: 'write' | 'writeNoResponse'
+ }
+ interface GetBLEMTUSuccessCallbackResult {
+ /** 最大传输单元 */
+ mtu: number
+ errMsg: string
+ }
interface GetBackgroundAudioPlayerStateOption {
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: GetBackgroundAudioPlayerStateCompleteCallback
@@ -1922,7 +5399,7 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
errMsg: string
}
interface GetBackgroundFetchDataOption {
- /** 取值为 periodic */
+ /** 缓存数据类别,取值为 periodic 或 pre */
fetchType: string
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: GetBackgroundFetchDataCompleteCallback
@@ -1931,6 +5408,19 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
/** 接口调用成功的回调函数 */
success?: GetBackgroundFetchDataSuccessCallback
}
+ interface GetBackgroundFetchDataSuccessCallbackResult {
+ /** 缓存数据 */
+ fetchedData: string
+ /** 小程序页面路径 */
+ path: string
+ /** 传给页面的 query 参数 */
+ query: string
+ /** 进入小程序的场景值 */
+ scene: number
+ /** 客户端拿到缓存数据的时间戳 ms。(iOS 时间戳存在异常,8.0.27 修复) */
+ timeStamp: number
+ errMsg: string
+ }
interface GetBackgroundFetchTokenOption {
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: GetBackgroundFetchTokenCompleteCallback
@@ -1939,6 +5429,12 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
/** 接口调用成功的回调函数 */
success?: GetBackgroundFetchTokenSuccessCallback
}
+ interface GetBackgroundFetchTokenSuccessCallbackResult {
+ /** 接口调用结果 */
+ errMsg: string
+ /** 自定义的登录态 */
+ token: string
+ }
interface GetBatteryInfoOption {
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: GetBatteryInfoCompleteCallback
@@ -1950,15 +5446,23 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
interface GetBatteryInfoSuccessCallbackResult {
/** 是否正在充电中 */
isCharging: boolean
+ /** 需要基础库: `3.5.0`
+ *
+ * 是否处于省电模式 */
+ isLowPowerModeEnabled: boolean
/** 设备电量,范围 1 - 100 */
- level: string
+ level: number
errMsg: string
}
interface GetBatteryInfoSyncResult {
/** 是否正在充电中 */
isCharging: boolean
+ /** 需要基础库: `3.5.0`
+ *
+ * 是否处于省电模式 */
+ isLowPowerModeEnabled: boolean
/** 设备电量,范围 1 - 100 */
- level: string
+ level: number
}
interface GetBeaconsOption {
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
@@ -1969,8 +5473,8 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
success?: GetBeaconsSuccessCallback
}
interface GetBeaconsSuccessCallbackResult {
- /** iBeacon 设备列表 */
- beacons: IBeaconInfo[]
+ /** Beacon 设备列表 */
+ beacons: BeaconInfo[]
errMsg: string
}
interface GetBluetoothAdapterStateOption {
@@ -1997,15 +5501,34 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
success?: GetBluetoothDevicesSuccessCallback
}
interface GetBluetoothDevicesSuccessCallbackResult {
- /** uuid 对应的的已连接设备列表 */
+ /** UUID 对应的已连接设备列表 */
devices: BlueToothDevice[]
errMsg: string
}
+ interface GetBoundsOption {
+ /** 选区开始位置 */
+ index: number
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: GetBoundsCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: GetBoundsFailCallback
+ /** 选区长度 */
+ length?: number
+ /** 接口调用成功的回调函数 */
+ success?: GetBoundsSuccessCallback
+ }
+ interface GetBoundsSuccessCallbackResult {
+ /** 选区相对于视口的大小和位置 */
+ bounds: IAnyObject
+ errMsg: string
+ }
interface GetCenterLocationOption {
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: GetCenterLocationCompleteCallback
/** 接口调用失败的回调函数 */
fail?: GetCenterLocationFailCallback
+ /** 图标路径,支持网络路径、本地路径、代码包路径 */
+ iconPath?: string
/** 接口调用成功的回调函数 */
success?: GetCenterLocationSuccessCallback
}
@@ -2016,6 +5539,121 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
longitude: number
errMsg: string
}
+ interface GetChannelsLiveInfoOption {
+ /** 视频号 id,以“sph”开头的id,可在视频号助手获取 */
+ finderUserName: string
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: GetChannelsLiveInfoCompleteCallback
+ /** 需要基础库: `2.29.0`
+ *
+ * 结束时间,筛选指定时间段的直播。若上传了startTime,未上传endTime,则endTime默认取当前时间 */
+ endTime?: number
+ /** 接口调用失败的回调函数 */
+ fail?: GetChannelsLiveInfoFailCallback
+ /** 需要基础库: `2.29.0`
+ *
+ * 起始时间,筛选指定时间段的直播。若上传了endTime,未上传startTime,则startTime默认为0 */
+ startTime?: number
+ /** 接口调用成功的回调函数 */
+ success?: GetChannelsLiveInfoSuccessCallback
+ }
+ interface GetChannelsLiveInfoSuccessCallbackResult {
+ /** 直播主题 */
+ description: string
+ /** 直播 feedId */
+ feedId: string
+ /** 视频号头像 */
+ headUrl: string
+ /** 视频号昵称 */
+ nickname: string
+ /** 直播 nonceId */
+ nonceId: string
+ /** 需要基础库: `2.29.0`
+ *
+ * 除最近的一条直播外,其他的直播列表(注意:每次最多返回按时间戳增序排列的15个直播信息,其中时间最近的那个直播会在接口其他的返回参数中展示,其余的直播会在该字段中展示)。 */
+ otherInfos: any[]
+ /** 需要基础库: `2.29.0`
+ *
+ * 直播回放状态
+ *
+ * 可选值:
+ * - 0: 未生成;
+ * - 1: 已生成;
+ * - 3: 生成中;
+ * - 6: 已过期; */
+ replayStatus: 0 | 1 | 3 | 6
+ /** 直播状态
+ *
+ * 可选值:
+ * - 1: 直播状态不存在(针对未开过直播的主播);
+ * - 2: 直播中;
+ * - 3: 直播已结束;
+ * - 4: 直播准备中(未开播); */
+ status: 1 | 2 | 3 | 4
+ errMsg: string
+ }
+ interface GetChannelsLiveNoticeInfoOption {
+ /** 视频号 id,以“sph”开头的id,可在视频号助手获取 */
+ finderUserName: string
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: GetChannelsLiveNoticeInfoCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: GetChannelsLiveNoticeInfoFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: GetChannelsLiveNoticeInfoSuccessCallback
+ }
+ interface GetChannelsLiveNoticeInfoSuccessCallbackResult {
+ /** 直播封面 */
+ headUrl: string
+ /** 视频号昵称 */
+ nickname: string
+ /** 预告 id */
+ noticeId: string
+ /** 需要基础库: `2.24.6`
+ *
+ * 除最近的一条预告信息外,其他的预告信息列表(注意:每次最多返回按时间戳增序排列的15个预告信息,其中时间最近的那个预告信息会在接口其他的返回参数中展示,其余的预告信息会在该字段中展示)。 */
+ otherInfos: any[]
+ /** 是否可预约 */
+ reservable: boolean
+ /** 开始时间 */
+ startTime: string
+ /** 预告状态:0可用 1取消 2已用 */
+ status: number
+ errMsg: string
+ }
+ interface GetChannelsShareKeyOption {
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: GetChannelsShareKeyCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: GetChannelsShareKeyFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: GetChannelsShareKeySuccessCallback
+ }
+ interface GetChannelsShareKeySuccessCallbackResult {
+ /** 推广员 */
+ promoter: PromoterResult
+ /** 分享者 openid */
+ sharerOpenId: string
+ errMsg: string
+ }
+ interface GetChatToolInfoOption {
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: GetChatToolInfoCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: GetChatToolInfoFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: GetChatToolInfoSuccessCallback
+ }
+ interface GetChatToolInfoSuccessCallbackResult {
+ /** 敏感数据对应的云 ID,开通[云开发](https://developers.weixin.qq.com/miniprogram/dev/wxcloudservice/wxcloud/basis/getting-started.html)的小程序才会返回,可通过云调用直接获取开放数据,详细见[云调用直接获取开放数据](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#method-cloud) */
+ cloudID: string
+ /** 包括敏感数据在内的完整转发信息的加密数据,详细见[加密数据解密算法](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html) */
+ encryptedData: string
+ /** 错误信息 */
+ errMsg: string
+ /** 加密算法的初始向量,详细见[加密数据解密算法](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html) */
+ iv: string
+ }
interface GetClipboardDataOption {
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: GetClipboardDataCompleteCallback
@@ -2027,9 +5665,35 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
interface GetClipboardDataSuccessCallbackOption {
/** 剪贴板的内容 */
data: string
+ errMsg: string
+ }
+ interface GetCommonConfigOption {
+ /** 0:通用配置模式 1:实验模式, 参数与返回结果的使用等效于接口[wx.getExptInfoSync](https://developers.weixin.qq.com/miniprogram/dev/api/data-analysis/wx.getExptInfoSync.html) */
+ mode: number
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: GetCommonConfigCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: GetCommonConfigFailCallback
+ /** 需要获取的数据指标的对象数组,每个string的格式约定:配置类型_分表key */
+ keys?: string[]
+ /** 接口调用成功的回调函数 */
+ success?: GetCommonConfigSuccessCallback
+ }
+ interface GetCommonConfigSuccessCallbackResult {
+ /** 根据conf_type来确定conf内容,conf_type为1时conf是一个json数组, 类似"[{xxx},{xxx}]", 每一项对应表类型每一行配置内容, 其中conf_type为2时conf是一个json对象,类似"{xxxx}" */
+ conf: string
+ /** 配置类型, 1-表类型 2-kv类型 */
+ conf_type: number
+ /** 错误码 */
+ errcode: number
+ /** 错误信息 */
+ errmsg: string
+ /** 过期时间,单位秒. 0表示当次有效 */
+ expire_sec: number
+ errMsg: string
}
interface GetConnectedBluetoothDevicesOption {
- /** 蓝牙设备主 service 的 uuid 列表 */
+ /** 蓝牙设备主服务的 UUID 列表(支持 16/32/128 位 UUID) */
services: string[]
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: GetConnectedBluetoothDevicesCompleteCallback
@@ -2048,6 +5712,10 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
complete?: GetConnectedWifiCompleteCallback
/** 接口调用失败的回调函数 */
fail?: GetConnectedWifiFailCallback
+ /** 需要基础库: `2.22.0`
+ *
+ * 是否需要返回部分 Wi-Fi 信息 */
+ partialInfo?: boolean
/** 接口调用成功的回调函数 */
success?: GetConnectedWifiSuccessCallback
}
@@ -2075,6 +5743,37 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
text: string
errMsg: string
}
+ interface GetDeviceBenchmarkInfoOption {
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: GetDeviceBenchmarkInfoCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: GetDeviceBenchmarkInfoFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: GetDeviceBenchmarkInfoSuccessCallback
+ }
+ interface GetDeviceBenchmarkInfoSuccessCallbackResult {
+ /** 需要基础库: `3.4.5`
+ *
+ * 设备性能等级。-1(性能未知),>=1(设备性能值,该值越高,设备性能越好,目前最高不超过50) 注意:设备的benchmarkLevel值不会随着时间的推移而变化 */
+ benchmarkLevel: number
+ /** 需要基础库: `3.4.5`
+ *
+ * 设备机型档位。0(档位未知),1(高档机),2(中档机),3(低档机) 注意:设备的机型档位会随着时间的推移而变化,因此在使用时请谨慎对待;若业务逻辑依赖于机型档位,但担心受到机型档位变化的影响,请参考[设备档位映射文档](https://developers.weixin.qq.com/minigame/dev/guide/performance/perf-benchmarkLevel.html)自行判断机型档位 */
+ modelLevel: number
+ errMsg: string
+ }
+ interface GetDeviceVoIPListOption {
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: GetDeviceVoIPListCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: GetDeviceVoIPListFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: GetDeviceVoIPListSuccessCallback
+ }
+ interface GetDeviceVoIPListSuccessCallbackResult {
+ list: DeviceVoIPInfo[]
+ errMsg: string
+ }
interface GetExtConfigOption {
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: GetExtConfigCompleteCallback
@@ -2088,25 +5787,71 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
extConfig: IAnyObject
errMsg: string
}
- interface GetFileInfoFailCallbackResult {
- /** 错误信息
+ interface GetFileInfoOption {
+ /** 要读取的文件路径 (本地路径) */
+ filePath: string
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: GetFileInfoCompleteCallback
+ /** 计算文件摘要的算法
*
* 可选值:
- * - 'fail file not exist': 指定的 filePath 找不到文件; */
+ * - 'md5': md5 算法;
+ * - 'sha1': sha1 算法;
+ * - 'sha256': sha256 算法; */
+ digestAlgorithm?: 'md5' | 'sha1' | 'sha256'
+ /** 接口调用失败的回调函数 */
+ fail?: GetFileInfoFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: GetFileInfoSuccessCallback
+ }
+ interface GetFileInfoSuccessCallbackResult {
+ /** 按照传入的 digestAlgorithm 计算得出的的文件摘要 */
+ digest: string
+ /** 文件大小,以字节为单位 */
+ size: number
+ errMsg: string
+ }
+ interface GetFuzzyLocationOption {
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: GetFuzzyLocationCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: GetFuzzyLocationFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: GetFuzzyLocationSuccessCallback
+ /** 返回的坐标类型
+ *
+ * 可选值:
+ * - 'wgs84': 返回 gps 坐标;
+ * - 'gcj02': 返回 gcj02 坐标,可用于 wx.openLocation; */
+ type?: 'wgs84' | 'gcj02'
+ }
+ interface GetFuzzyLocationSuccessCallbackResult {
+ /** 纬度,范围为 -90~90,负数表示南纬 */
+ latitude: number
+ /** 经度,范围为 -180~180,负数表示西经 */
+ longitude: number
errMsg: string
}
interface GetGroupEnterInfoOption {
+ /** 需要基础库: `3.7.8`
+ *
+ * 开启后单聊下返回 open_single_roomid */
+ allowSingleChat?: boolean
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: GetGroupEnterInfoCompleteCallback
/** 接口调用失败的回调函数 */
fail?: GetGroupEnterInfoFailCallback
+ /** 需要基础库: `3.7.8`
+ *
+ * 开启后返回用户在群(含单聊)下的 group_openid */
+ needGroupOpenID?: boolean
/** 接口调用成功的回调函数 */
success?: GetGroupEnterInfoSuccessCallback
}
interface GetGroupEnterInfoSuccessCallbackResult {
- /** 敏感数据对应的云 ID,开通[云开发](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/basis/getting-started.html)的小程序才会返回,可通过云调用直接获取开放数据,详细见[云调用直接获取开放数据](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#method-cloud)
+ /** 需要基础库: `2.7.0`
*
- * 最低基础库: `2.7.0` */
+ * 敏感数据对应的云 ID,开通[云开发](https://developers.weixin.qq.com/miniprogram/dev/wxcloudservice/wxcloud/basis/getting-started.html)的小程序才会返回,可通过云调用直接获取开放数据,详细见[云调用直接获取开放数据](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#method-cloud) */
cloudID: string
/** 包括敏感数据在内的完整转发信息的加密数据,详细见[加密数据解密算法](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html) */
encryptedData: string
@@ -2136,6 +5881,14 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
histBytes: ArrayBuffer
errMsg: string
}
+ interface GetHistoryStateOption {
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: GetHistoryStateCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: GetHistoryStateFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: GetHistoryStateSuccessCallback
+ }
interface GetImageInfoOption {
/** 图片的路径,支持网络路径、本地路径、代码包路径 */
src: string
@@ -2149,7 +5902,9 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
interface GetImageInfoSuccessCallbackResult {
/** 图片原始高度,单位px。不考虑旋转。 */
height: number
- /** [拍照时设备方向](http://sylvana.net/jpegcrop/exif_orientation.html)
+ /** 需要基础库: `1.9.90`
+ *
+ * [拍照时设备方向](http://sylvana.net/jpegcrop/exif_orientation.html)
*
* 可选值:
* - 'up': 默认方向(手机横持拍照),对应 Exif 中的 1。或无 orientation 信息。;
@@ -2159,9 +5914,7 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
* - 'left-mirrored': 同 left,但镜像翻转,对应 Exif 中的 5;
* - 'right': 顺时针旋转90度,对应 Exif 中的 6;
* - 'right-mirrored': 同 right,但镜像翻转,对应 Exif 中的 7;
- * - 'left': 逆时针旋转90度,对应 Exif 中的 8;
- *
- * 最低基础库: `1.9.90` */
+ * - 'left': 逆时针旋转90度,对应 Exif 中的 8; */
orientation:
| 'up'
| 'up-mirrored'
@@ -2173,30 +5926,85 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
| 'left'
/** 图片的本地路径 */
path: string
- /** 图片格式
+ /** 需要基础库: `1.9.90`
*
- * 最低基础库: `1.9.90` */
- type: string
+ * 图片格式
+ *
+ * 可选值:
+ * - 'unknown': 未知格式;
+ * - 'jpeg': jpeg压缩格式;
+ * - 'png': png压缩格式;
+ * - 'gif': gif压缩格式;
+ * - 'tiff': tiff压缩格式; */
+ type: 'unknown' | 'jpeg' | 'png' | 'gif' | 'tiff'
/** 图片原始宽度,单位px。不考虑旋转。 */
width: number
errMsg: string
}
+ interface GetInferenceEnvInfoOption {
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: GetInferenceEnvInfoCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: GetInferenceEnvInfoFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: GetInferenceEnvInfoSuccessCallback
+ }
+ interface GetInferenceEnvInfoSuccessCallbackResult {
+ /** AI推理引擎版本 */
+ ver: string
+ errMsg: string
+ }
+ interface GetLatestUserKeyOption {
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: GetLatestUserKeyCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: GetLatestUserKeyFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: GetLatestUserKeySuccessCallback
+ }
+ interface GetLatestUserKeySuccessCallbackResult {
+ /** 用户加密密钥 */
+ encryptKey: string
+ /** 密钥过期时间 */
+ expireTime: number
+ /** 密钥初始向量 */
+ iv: string
+ /** 密钥版本 */
+ version: number
+ errMsg: string
+ }
+ interface GetLocalIPAddressOption {
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: GetLocalIPAddressCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: GetLocalIPAddressFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: GetLocalIPAddressSuccessCallback
+ }
+ interface GetLocalIPAddressSuccessCallbackResult {
+ /** 错误信息 */
+ errMsg: string
+ /** 本机局域网IP地址 */
+ localip: string
+ /** 本机局域网子网掩码,基础库 2.24.0 开始支持 */
+ netmask: string
+ }
interface GetLocationOption {
- /** 传入 true 会返回高度信息,由于获取高度需要较高精确度,会减慢接口返回速度
+ /** 需要基础库: `1.6.0`
*
- * 最低基础库: `1.6.0` */
- altitude?: string
+ * 传入 true 会返回高度信息,由于获取高度需要较高精确度,会减慢接口返回速度 */
+ altitude?: boolean
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: GetLocationCompleteCallback
/** 接口调用失败的回调函数 */
fail?: GetLocationFailCallback
- /** 高精度定位超时时间(ms),指定时间内返回最高精度,该值3000ms以上高精度定位才有效果
+ /** 需要基础库: `2.9.0`
*
- * 最低基础库: `2.9.0` */
+ * 高精度定位超时时间(ms),指定时间内返回最高精度,该值3000ms以上高精度定位才有效果 */
highAccuracyExpireTime?: number
- /** 开启高精度定位
+ /** 需要基础库: `2.9.0`
*
- * 最低基础库: `2.9.0` */
+ * 开启高精度定位 */
isHighAccuracy?: boolean
/** 接口调用成功的回调函数 */
success?: GetLocationSuccessCallback
@@ -2204,15 +6012,15 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
type?: string
}
interface GetLocationSuccessCallbackResult {
- /** 位置的精确度 */
+ /** 位置的精确度,反应与真实位置之间的接近程度,可以理解成10即与真实位置相差10m,越小越精确 */
accuracy: number
- /** 高度,单位 m
+ /** 需要基础库: `1.2.0`
*
- * 最低基础库: `1.2.0` */
+ * 高度,单位 m */
altitude: number
- /** 水平精度,单位 m
+ /** 需要基础库: `1.2.0`
*
- * 最低基础库: `1.2.0` */
+ * 水平精度,单位 m */
horizontalAccuracy: number
/** 纬度,范围为 -90~90,负数表示南纬 */
latitude: number
@@ -2220,16 +6028,16 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
longitude: number
/** 速度,单位 m/s */
speed: number
- /** 垂直精度,单位 m(Android 无法获取,返回 0)
+ /** 需要基础库: `1.2.0`
*
- * 最低基础库: `1.2.0` */
+ * 垂直精度,单位 m(Android 无法获取,返回 0) */
verticalAccuracy: number
errMsg: string
}
interface GetLogManagerOption {
- /** 取值为0/1,取值为0表示是否会把 `App`、`Page` 的生命周期函数和 `wx` 命名空间下的函数调用写入日志,取值为1则不会。默认值是 0
+ /** 需要基础库: `2.3.2`
*
- * 最低基础库: `2.3.2` */
+ * 取值为0/1,取值为0表示会把 `App`、`Page` 的生命周期函数和 `wx` 命名空间下的函数调用写入日志,取值为1则不会。默认值是 0 */
level?: number
}
interface GetMaxTransceiveLengthOption {
@@ -2245,6 +6053,19 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
length: number
errMsg: string
}
+ interface GetMaxZoomOption {
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: GetMaxZoomCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: GetMaxZoomFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: GetMaxZoomSuccessCallback
+ }
+ interface GetMaxZoomSuccessCallbackResult {
+ /** 最大放缩级别 */
+ maxZoom: string
+ errMsg: string
+ }
interface GetNetworkTypeOption {
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: GetNetworkTypeCompleteCallback
@@ -2254,6 +6075,10 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
success?: GetNetworkTypeSuccessCallback
}
interface GetNetworkTypeSuccessCallbackResult {
+ /** 需要基础库: `2.22.1`
+ *
+ * 设备是否使用了网络代理 */
+ hasSystemProxy: boolean
/** 网络类型
*
* 可选值:
@@ -2265,6 +6090,27 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
* - 'unknown': Android 下不常见的网络类型;
* - 'none': 无网络; */
networkType: 'wifi' | '2g' | '3g' | '4g' | '5g' | 'unknown' | 'none'
+ /** 信号强弱,单位 dbm */
+ signalStrength: number
+ /** 需要基础库: `3.5.3`
+ *
+ * 是否处于弱网环境 */
+ weakNet: boolean
+ errMsg: string
+ }
+ interface GetPrivacySettingOption {
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: GetPrivacySettingCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: GetPrivacySettingFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: GetPrivacySettingSuccessCallback
+ }
+ interface GetPrivacySettingSuccessCallbackResult {
+ /** 是否需要用户授权隐私协议(如果开发者没有在「MP后台-设置-服务内容声明-用户隐私保护指引」中声明隐私收集类型则会返回false;如果开发者声明了隐私收集,且用户之前同意过隐私协议则会返回false;如果开发者声明了隐私收集,且用户还没同意过则返回true;如果用户之前同意过、但后来小程序又新增了隐私收集类型也会返回true) */
+ needAuthorization: boolean
+ /** 隐私授权协议的名称 */
+ privacyContractName: string
errMsg: string
}
interface GetRandomValuesOption {
@@ -2297,6 +6143,14 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
southwest: MapPostion
errMsg: string
}
+ interface GetRendererUserAgentOption {
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: GetRendererUserAgentCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: GetRendererUserAgentFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: GetRendererUserAgentSuccessCallback
+ }
interface GetRotateOption {
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: GetRotateCompleteCallback
@@ -2323,21 +6177,17 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
sak: number
errMsg: string
}
- interface GetSavedFileInfoOption {
- /** 文件路径 (本地路径) */
- filePath: string
+ interface GetSavedFileListOption {
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
- complete?: GetSavedFileInfoCompleteCallback
+ complete?: GetSavedFileListCompleteCallback
/** 接口调用失败的回调函数 */
- fail?: GetSavedFileInfoFailCallback
+ fail?: GetSavedFileListFailCallback
/** 接口调用成功的回调函数 */
- success?: GetSavedFileInfoSuccessCallback
+ success?: GetSavedFileListSuccessCallback
}
- interface GetSavedFileInfoSuccessCallbackResult {
- /** 文件保存时的时间戳,从1970/01/01 08:00:00 到该时刻的秒数 */
- createTime: number
- /** 文件大小,单位 B */
- size: number
+ interface GetSavedFileListSuccessCallbackResult {
+ /** 文件数组 */
+ fileList: FileItem[]
errMsg: string
}
interface GetScaleOption {
@@ -2364,6 +6214,41 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
interface GetScreenBrightnessSuccessCallbackOption {
/** 屏幕亮度值,范围 0 ~ 1,0 最暗,1 最亮 */
value: number
+ errMsg: string
+ }
+ interface GetScreenRecordingStateOption {
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: GetScreenRecordingStateCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: GetScreenRecordingStateFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: GetScreenRecordingStateSuccessCallback
+ }
+ interface GetScreenRecordingStateSuccessCallbackResult {
+ /** 录屏状态
+ *
+ * 可选值:
+ * - 'on': 开启;
+ * - 'off': 关闭; */
+ state: 'on' | 'off'
+ errMsg: string
+ }
+ interface GetSecureElementPassesOption {
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: GetSecureElementPassesCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: GetSecureElementPassesFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: GetSecureElementPassesSuccessCallback
+ }
+ interface GetSecureElementPassesSuccessCallbackOption {
+ /** 错误信息 */
+ errorMsg: string
+ /** SimplePKPass 的 JSON字符串,这里给出定义,需要进行 JSON.parse 后才可使用 */
+ passes: SimplePKPass[]
+ /** 返回值 */
+ result: string
+ errMsg: string
}
interface GetSelectedTextRangeOption {
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
@@ -2380,6 +6265,21 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
start: number
errMsg: string
}
+ interface GetSelectionOption {
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: GetSelectionCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: GetSelectionFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: GetSelectionSuccessCallback
+ }
+ interface GetSelectionSuccessCallbackResult {
+ /** 选区相对于视口的大小和位置 */
+ bounds: IAnyObject
+ /** 选区位置,index 为开始位置,length 为选区长度 */
+ range: IAnyObject
+ errMsg: string
+ }
interface GetSelectionTextOption {
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: GetSelectionTextCompleteCallback
@@ -2400,9 +6300,9 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
fail?: GetSettingFailCallback
/** 接口调用成功的回调函数 */
success?: GetSettingSuccessCallback
- /** 是否同时获取用户订阅消息的订阅状态,默认不获取。注意:withSubscriptions 只返回用户勾选过订阅面板中的“总是保持以上选择,不再询问”的订阅消息。
+ /** 需要基础库: `2.10.1`
*
- * 最低基础库: `2.10.1` */
+ * 是否同时获取用户订阅消息的订阅状态,默认不获取。注意:withSubscriptions 只返回用户勾选过订阅面板中的“总是保持以上选择,不再询问”的订阅消息。 */
withSubscriptions?: boolean
}
interface GetSettingSuccessCallbackResult {
@@ -2412,9 +6312,9 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
authSetting: AuthSetting
/** [SubscriptionsSetting](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/setting/SubscriptionsSetting.html)
*
- * 用户订阅消息设置,接口参数`withSubscriptions`值为`true`时才会返回。
+ * 需要基础库: `2.10.1`
*
- * 最低基础库: `2.10.1` */
+ * 用户订阅消息设置,接口参数`withSubscriptions`值为`true`时才会返回。 */
subscriptionsSetting: SubscriptionsSetting
/** [AuthSetting](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/setting/AuthSetting.html)
*
@@ -2423,7 +6323,7 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
errMsg: string
}
interface GetShareInfoOption {
- /** shareTicket */
+ /** shareTicket,详见[获取更多转发信息](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html#获取更多转发信息) */
shareTicket: string
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: GetShareInfoCompleteCallback
@@ -2431,11 +6331,38 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
fail?: GetShareInfoFailCallback
/** 接口调用成功的回调函数 */
success?: GetShareInfoSuccessCallback
- /** 超时时间,单位 ms
+ /** 需要基础库: `1.9.90`
*
- * 最低基础库: `1.9.90` */
+ * 超时时间,单位 ms */
timeout?: number
}
+ interface GetShowSplashAdStatusOption {
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: GetShowSplashAdStatusCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: GetShowSplashAdStatusFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: GetShowSplashAdStatusSuccessCallback
+ }
+ interface GetShowSplashAdStatusSuccessCallbackResult {
+ /** 封面广告组件展示状态码
+ *
+ * 可选值:
+ * - -1: 初始值,状态未知;
+ * - 1: 展示成功;
+ * - 2: 主动拦截过滤,不展示广告;
+ * - 3: 展示超时; */
+ code: -1 | 1 | 2 | 3
+ /** 封面广告组件展示状态
+ *
+ * 可选值:
+ * - 'unknown': 初始值,状态未知;
+ * - 'pending': 进行展示中;
+ * - 'success': 展示成功;
+ * - 'fail': 展示失败; */
+ status: 'unknown' | 'pending' | 'success' | 'fail'
+ errMsg: string
+ }
interface GetSkewOption {
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: GetSkewCompleteCallback
@@ -2449,6 +6376,14 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
skew: number
errMsg: string
}
+ interface GetSkylineInfoOption {
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: GetSkylineInfoCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: GetSkylineInfoFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: GetSkylineInfoSuccessCallback
+ }
interface GetStorageInfoOption {
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: GetStorageInfoCompleteCallback
@@ -2464,6 +6399,7 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
keys: string[]
/** 限制的空间大小,单位 KB */
limitSize: number
+ errMsg: string
}
interface GetStorageInfoSyncOption {
/** 当前占用的空间大小, 单位 KB */
@@ -2478,6 +6414,10 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
key: string
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: GetStorageCompleteCallback
+ /** 需要基础库: `2.21.3`
+ *
+ * 是否开启加密存储。只有异步的 getStorage 接口支持开启加密存储。开启后,将会对 data 使用 AES128 解密,接口回调耗时将会增加。若开启加密存储,setStorage 和 getStorage 需要同时声明 encrypt 的值为 true */
+ encrypt?: boolean
/** 接口调用失败的回调函数 */
fail?: GetStorageFailCallback
/** 接口调用成功的回调函数 */
@@ -2522,13 +6462,13 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
withCredentials?: boolean
}
interface GetUserInfoSuccessCallbackResult {
- /** 敏感数据对应的云 ID,开通[云开发](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/basis/getting-started.html)的小程序才会返回,可通过云调用直接获取开放数据,详细见[云调用直接获取开放数据](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#method-cloud)
+ /** 需要基础库: `2.7.0`
*
- * 最低基础库: `2.7.0` */
+ * 敏感数据对应的云 ID,开通[云开发](https://developers.weixin.qq.com/miniprogram/dev/wxcloudservice/wxcloud/basis/getting-started.html)的小程序才会返回,可通过云调用直接获取开放数据,详细见[云调用直接获取开放数据](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#method-cloud) */
cloudID: string
- /** 包括敏感数据在内的完整用户信息的加密数据,详见 [用户数据的签名验证和加解密]((signature#加密数据解密算法)) */
+ /** 包括敏感数据在内的完整用户信息的加密数据,详见 [用户数据的签名验证和加解密](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#加密数据解密算法) */
encryptedData: string
- /** 加密算法的初始向量,详见 [用户数据的签名验证和加解密]((signature#加密数据解密算法)) */
+ /** 加密算法的初始向量,详见 [用户数据的签名验证和加解密](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#加密数据解密算法) */
iv: string
/** 不包括敏感信息的原始数据字符串,用于计算签名 */
rawData: string
@@ -2558,7 +6498,29 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
success?: GetUserProfileSuccessCallback
}
interface GetUserProfileSuccessCallbackResult {
+ /** 需要基础库: `2.10.4`
+ *
+ * 敏感数据对应的云 ID,开通[云开发](https://developers.weixin.qq.com/miniprogram/dev/wxcloudservice/wxcloud/basis/getting-started.html)的小程序才会返回,可通过云调用直接获取开放数据,详细见[云调用直接获取开放数据](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#method-cloud) */
+ cloudID: string
+ /** 需要基础库: `2.10.4`
+ *
+ * 包括敏感数据在内的完整用户信息的加密数据,详见 [用户数据的签名验证和加解密](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#加密数据解密算法) */
+ encryptedData: string
+ /** 需要基础库: `2.10.4`
+ *
+ * 加密算法的初始向量,详见 [用户数据的签名验证和加解密](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#加密数据解密算法) */
+ iv: string
+ /** 需要基础库: `2.10.4`
+ *
+ * 不包括敏感信息的原始数据字符串,用于计算签名 */
+ rawData: string
+ /** 需要基础库: `2.10.4`
+ *
+ * 使用 sha1( rawData + sessionkey ) 得到字符串,用于校验用户信息,详见 [用户数据的签名验证和加解密](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html) */
+ signature: string
/** [UserInfo](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/user-info/UserInfo.html)
+ *
+ * 需要基础库: `2.10.4`
*
* 用户信息对象 */
userInfo: UserInfo
@@ -2620,9 +6582,9 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
success?: GetWeRunDataSuccessCallback
}
interface GetWeRunDataSuccessCallbackResult {
- /** 敏感数据对应的云 ID,开通云开发的小程序才会返回,可通过云调用直接获取开放数据,详细见[云调用直接获取开放数据](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#method-cloud)
+ /** 需要基础库: `2.7.0`
*
- * 最低基础库: `2.7.0` */
+ * 敏感数据对应的云 ID,开通云开发的小程序才会返回,可通过云调用直接获取开放数据,详细见[云调用直接获取开放数据](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#method-cloud) */
cloudID: string
/** 包括敏感数据在内的完整用户信息的加密数据,详细见[加密数据解密算法](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html)。解密后得到的数据结构见后文 */
encryptedData: string
@@ -2638,6 +6600,127 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
/** 接口调用成功的回调函数 */
success?: GetWifiListSuccessCallback
}
+ /** 全球收银对象 GlobalPayment */
+ interface GlobalPayment {
+ /** 初始值为null。当开发者调用 openMethodPicker 用户选中具体支付方式后确定,后续不再改变。
+*
+* ```js
+
+const goods = {
+ goods_id: `goods_1`,
+ goods_name: `拿铁`,
+ goods_unit_price: {
+ currency: 'SGD',
+ total: 10,
+ },
+ goods_quantity: '1',
+ goods_category: '1',
+}
+
+const globalPay = async () => {
+ if (typeof wx.createGlobalPayment !== 'function') {
+ // 基础库版本不支持
+ // 方案一、微信支付做兜底
+ wx.requestPayment({
+ timeStamp: '',
+ nonceStr: '',
+ package: '',
+ signType: '',
+ paySign: '',
+ })
+ // 方案二、引导用户更新
+ // 方案三、mp后台设置最低基础库版本 3.7.3
+ return
+ }
+
+ const payment = wx.createGlobalPayment({ mchRegion: 'SG', isSandbox: true })
+
+ try {
+ const pickerResp = await payment.openMethodPicker({
+ amount: goods.goods_unit_price,
+ })
+
+ console.log(`openMethodPicker resp: `, pickerResp)
+
+ if (pickerResp.methodKey === 'WECHAT_PAY') {
+ // 发起微信支付
+ } else {
+ // 后台接口发起预下单
+ const preOrderResp = await preOrder(
+ goods.goods_unit_price,
+ [goods],
+ pickerResp.methodKey
+ )
+
+ console.log(`preOrder resp: `, preOrderResp)
+
+ const { payment_id, prepay_info } = preOrderResp
+
+ const requestPaymentResp = await payment.requestGlobalPayment({
+ paymentId: payment_id,
+ prepayInfo: prepay_info,
+ })
+
+ console.log(`requestGlobalPayment resp: `, requestPaymentResp)
+ }
+ } catch (error) {
+ console.log(error)
+ }
+}
+
+``` */
+ methodKey: string
+ /** [Promise GlobalPayment.abort()](https://developers.weixin.qq.com/miniprogram/dev/api/payment/GlobalPayment.abort.html)
+ *
+ * 需要基础库: `3.7.3`
+ *
+ * 在插件中使用:不支持
+ *
+ * 用户选择TPG的支付方式,界面会进入加载的Toast,等待开发者前往TPG完成预下单后携带预支付信息和交易单号调用 requestGlobalPayment,若开发者在
+ * TPG预下单未成功或出现异常情况,可调用该接口主动终止TPG支付流程,界面加载的Toast将会隐藏,提示用户下单失败。 */
+ abort(): Promise
+ /** [Promise GlobalPayment.openMethodPicker(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/payment/GlobalPayment.openMethodPicker.html)
+ *
+ * 需要基础库: `3.7.3`
+ *
+ * 在插件中使用:不支持
+ *
+ * 拉起全球收银的支付方式选择面板。当用户选择支付方式或者关闭选择面板后,返回相应结果。
+ * 当用户选定支付方式后,globalPayment上的属性 methodKey 也会更新,后续该对象再次调用将直接失败,不再拉起选择面板。
+ * 若用户选择微信支付,请开发者按原微信支付接口 wx.requestPayment 调用完成后续支付流程。
+ * 若用户选择TPG的支付方式,流程会等待开发者前往TPG完成预下单后,携带预支付信息和交易单号调用 requestGlobalPayment,若开发者超时未调用,则会提示用户加载超时(超时时间暂定为30s)。
+ * 当用户关闭选择面板,即未选择支付方式,开发者后续仍可继续调用接口拉起支付方式选择面板。 */
+ openMethodPicker(option: OpenMethodPickerOption): Promise
+ /** [Promise GlobalPayment.requestGlobalPayment(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/payment/GlobalPayment.requestGlobalPayment.html)
+ *
+ * 需要基础库: `3.7.3`
+ *
+ * 在插件中使用:不支持
+ *
+ * 开发者调用 openMethodPicker 并在返回值 methodKey 中接受到用户选择了TPG的支付方式后,可调用此接口接入TPG的支付流程。
+ * 当用户已成功完成当前订单支付后,再次调用该对象的 requestGlobalPayment 会失败。即每次支付都需创建新的 globalPayment 对象重走流程。
+ * 仅在 methodKey 为TPG支付类型才能进入全球收银的支付流程,其他情况会失败。
+ * 建议在接口返回后,不论成功或失败,均通过 TPG 接口 inquiry-payment 对订单状态进行查询。 */
+ requestGlobalPayment(option: RequestGlobalPaymentOption): Promise
+ }
+ interface GroupMemberInfo {
+ /** 所选用户在此聊天室下的唯一标识,同一个用户在不同的聊天室下id不同 */
+ members: string[]
+ errMsg: string
+ }
+ /** 需要基础库: `2.28.0`
+ *
+ * 手势检测配置。用法详情[指南文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/visionkit/hand.html)。 */
+ interface HandTrack {
+ /** 需要基础库: `2.28.0`
+ *
+ * 手势检测模式
+ *
+ * 可选值:
+ * - 1: 通过摄像头实时检测;
+ * - 2: 静态图片检测; */
+ mode: 1 | 2
+ }
interface HideHomeButtonOption {
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: HideHomeButtonCompleteCallback
@@ -2659,6 +6742,10 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
complete?: HideLoadingCompleteCallback
/** 接口调用失败的回调函数 */
fail?: HideLoadingFailCallback
+ /** 需要基础库: `2.22.1`
+ *
+ * 目前 toast 和 loading 相关接口可以相互混用,此参数可用于取消混用特性 */
+ noConflict?: boolean
/** 接口调用成功的回调函数 */
success?: HideLoadingSuccessCallback
}
@@ -2670,14 +6757,27 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
/** 接口调用成功的回调函数 */
success?: HideNavigationBarLoadingSuccessCallback
}
+ /** 切后台参数 */
+ interface HideOptionsApp {
+ /** 需要基础库: `3.5.7`
+ *
+ * 原因
+ *
+ * 可选值:
+ * - 0: 用户退出小程序;
+ * - 1: 进入其他小程序;
+ * - 2: 打开原生功能页;
+ * - 3: 其他; */
+ reason?: 0 | 1 | 2 | 3
+ }
interface HideShareMenuOption {
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: HideShareMenuCompleteCallback
/** 接口调用失败的回调函数 */
fail?: HideShareMenuFailCallback
- /** 本接口为 Beta 版本,暂只在 Android 平台支持。需要隐藏的转发按钮名称列表,默认['shareAppMessage', 'shareTimeline']。按钮名称合法值包含 "shareAppMessage"、"shareTimeline" 两种
+ /** 需要基础库: `2.11.3`
*
- * 最低基础库: `2.11.3` */
+ * 本接口为 Beta 版本,暂只在 Android 平台支持。需要隐藏的转发按钮名称列表,默认['shareAppMessage', 'shareTimeline']。按钮名称合法值包含 "shareAppMessage"、"shareTimeline" 两种 */
menus?: string[]
/** 接口调用成功的回调函数 */
success?: HideShareMenuSuccessCallback
@@ -2707,26 +6807,38 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
complete?: HideToastCompleteCallback
/** 接口调用失败的回调函数 */
fail?: HideToastFailCallback
+ /** 需要基础库: `2.22.1`
+ *
+ * 目前 toast 和 loading 相关接口可以相互混用,此参数可用于取消混用特性 */
+ noConflict?: boolean
/** 接口调用成功的回调函数 */
success?: HideToastSuccessCallback
}
- interface IBeaconInfo {
- /** iBeacon 设备的距离 */
- accuracy: number
- /** iBeacon 设备的主 id */
- major: string
- /** iBeacon 设备的次 id */
- minor: string
- /** 表示设备距离的枚举值 */
- proximity: number
- /** 表示设备的信号强度 */
- rssi: number
- /** iBeacon 设备广播的 uuid */
- uuid: string
+ /** 检测结果 */
+ interface HitTestRes {
+ /** 包含位置、旋转、放缩信息的矩阵,以列为主序 */
+ transform: Float32Array
}
- /** 图片对象
+ /** 宿主传递的数据,第三方 app 中运行小程序时返回 */
+ interface HostExtraData {
+ /** 宿主app对应的场景值 */
+ host_scene: string
+ }
+ /** 需要基础库: `3.3.0`
*
- * 最低基础库: `2.7.0` */
+ * 身份证检测配置。用法详情[指南文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/visionkit/idcard.html)。 */
+ interface IDCardTrack {
+ /** 需要基础库: `3.3.0`
+ *
+ * 身份证检测模式
+ *
+ * 可选值:
+ * - 2: 静态图片检测; */
+ mode: 2
+ }
+ /** 需要基础库: `2.7.0`
+ *
+ * 图片对象 */
interface Image {
/** 图片的真实高度 */
height: number
@@ -2734,14 +6846,18 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
onerror: (...args: any[]) => any
/** 图片加载完成后触发的回调函数 */
onload: (...args: any[]) => any
+ /** 需要基础库: `2.13.0`
+ *
+ * `origin`: 发送完整的referrer; `no-referrer`: 不发送。格式固定为 `https://servicewechat.com/{appid}/{version}/page-frame.html`,其中 {appid} 为小程序的 appid,{version} 为小程序的版本号,版本号为 0 表示为开发版、体验版以及审核版本,版本号为 devtools 表示为开发者工具,其余为正式版本; */
+ referrerPolicy: string
/** 图片的 URL。v2.11.0 起支持传递 base64 Data URI */
src: string
/** 图片的真实宽度 */
width: number
}
- /** ImageData 对象
+ /** 需要基础库: `2.9.0`
*
- * 最低基础库: `2.9.0` */
+ * ImageData 对象 */
interface ImageData {
/** 一维数组,包含以 RGBA 顺序的数据,数据使用 0 至 255(包含)的整数表示 */
data: Uint8ClampedArray
@@ -2750,9 +6866,9 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
/** 使用像素描述 ImageData 的实际宽度 */
width: number
}
- /** 图片的本地临时文件列表
+ /** 需要基础库: `1.2.0`
*
- * 最低基础库: `1.2.0` */
+ * 图片的本地临时文件列表 */
interface ImageFile {
/** 本地临时文件路径 (本地路径) */
path: string
@@ -2766,11 +6882,19 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
complete?: IncludePointsCompleteCallback
/** 接口调用失败的回调函数 */
fail?: IncludePointsFailCallback
- /** 坐标点形成的矩形边缘到地图边缘的距离,单位像素。格式为[上,右,下,左],安卓上只能识别数组第一项,上下左右的padding一致。开发者工具暂不支持padding参数。 */
+ /** 坐标点形成的矩形边缘到地图边缘的距离,单位像素。格式为[上,右,下,左]。开发者工具暂不支持padding参数。 */
padding?: number[]
/** 接口调用成功的回调函数 */
success?: IncludePointsSuccessCallback
}
+ interface InitFaceDetectOption {
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: InitFaceDetectCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: InitFaceDetectFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: InitFaceDetectSuccessCallback
+ }
interface InitMarkerClusterOption {
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: InitMarkerClusterCompleteCallback
@@ -2779,7 +6903,7 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
/** 接口调用失败的回调函数 */
fail?: InitMarkerClusterFailCallback
/** 聚合算法的可聚合距离,即距离小于该值的点会聚合至一起,以像素为单位 */
- gridSize?: boolean
+ gridSize?: number
/** 接口调用成功的回调函数 */
success?: InitMarkerClusterSuccessCallback
/** 点击已经聚合的标记点时是否实现聚合分离 */
@@ -2789,7 +6913,6 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
*
* **支持格式**
*
-*
* | 格式 | iOS | Android |
* | ---- | ---- | ------- |
* | flac | x | √ |
@@ -2807,11 +6930,10 @@ backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb
*
* **示例代码**
*
-*
* ```js
const innerAudioContext = wx.createInnerAudioContext()
innerAudioContext.autoplay = true
-innerAudioContext.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb.mp3?guid=ffffffff82def4af4b12b3cd9337d5e7&uin=346897220&vkey=6292F51E1E384E061FF02C31F716658E5C81F5594D561F2E88B854E81CAAB7806D5E4F103E55D33C16F3FAC506D1AB172DE8600B37E43FAD&fromtag=46'
+innerAudioContext.src = 'https://wx_test.mp3'
innerAudioContext.onPlay(() => {
console.log('开始播放')
})
@@ -2825,7 +6947,7 @@ innerAudioContext.onError((res) => {
autoplay: boolean
/** 音频缓冲的时间点,仅保证当前播放时间点到此时间点内容已缓冲(只读) */
buffered: number
- /** 当前音频的播放位置(单位 s)。只有在当前有合法的 src 时返回,时间保留小数点后 6 位(只读) */
+ /** 当前音频的播放位置(单位 s)。只有在当前有合法的 src 时返回,时间保留小数点后 6 位(currentTime 属性在基础库 2.26.2 之前只读,基础库 2.26.2 开始可读可写,改变 currentTime 值等同于调用 seek) */
currentTime: number
/** 当前音频的长度(单位 s)。只有在当前有合法的 src 时返回(只读) */
duration: number
@@ -2835,23 +6957,353 @@ innerAudioContext.onError((res) => {
obeyMuteSwitch: boolean
/** 当前是是否暂停或停止状态(只读) */
paused: boolean
- /** 播放速度。范围 0.5-2.0,默认为 1。(Android 需要 6 及以上版本)
+ /** 需要基础库: `2.11.0`
*
- * 最低基础库: `2.11.0` */
+ * 播放速度。范围 0.5-2.0,默认为 1。(Android 需要 6 及以上版本) */
playbackRate: number
+ /** 需要基础库: `2.13.0`
+ *
+ * `origin`: 发送完整的referrer; `no-referrer`: 不发送。格式固定为 `https://servicewechat.com/{appid}/{version}/page-frame.html`,其中 {appid} 为小程序的 appid,{version} 为小程序的版本号,版本号为 0 表示为开发版、体验版以及审核版本,版本号为 devtools 表示为开发者工具,其余为正式版本; */
+ referrerPolicy: string
/** 音频资源的地址,用于直接播放。[2.2.3](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 开始支持云文件ID */
src: string
/** 开始播放的位置(单位:s),默认为 0 */
startTime: number
- /** 音量。范围 0~1。默认为 1
+ /** 需要基础库: `1.9.90`
*
- * 最低基础库: `1.9.90` */
+ * 音量。范围 0~1。默认为 1 */
volume: number
- }
- interface InnerAudioContextOnErrorCallbackResult {
- /**
+ /** [InnerAudioContext.destroy()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.destroy.html)
*
- * 可选值:
+ * 在插件中使用:支持
+ *
+ * 销毁当前实例 */
+ destroy(): void
+ /** [InnerAudioContext.offCanplay(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offCanplay.html)
+*
+* 需要基础库: `1.9.0`
+*
+* 在插件中使用:支持
+*
+* 移除音频进入可以播放状态的事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+InnerAudioContext.onCanplay(listener)
+InnerAudioContext.offCanplay(listener) // 需传入与监听时同一个的函数对象
+``` */
+ offCanplay(
+ /** onCanplay 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffCanplayCallback
+ ): void
+ /** [InnerAudioContext.offEnded(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offEnded.html)
+*
+* 需要基础库: `1.9.0`
+*
+* 在插件中使用:支持
+*
+* 移除音频自然播放至结束的事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+InnerAudioContext.onEnded(listener)
+InnerAudioContext.offEnded(listener) // 需传入与监听时同一个的函数对象
+``` */
+ offEnded(
+ /** onEnded 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffEndedCallback
+ ): void
+ /** [InnerAudioContext.offError(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offError.html)
+*
+* 需要基础库: `1.9.0`
+*
+* 在插件中使用:支持
+*
+* 移除音频播放错误事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+InnerAudioContext.onError(listener)
+InnerAudioContext.offError(listener) // 需传入与监听时同一个的函数对象
+``` */
+ offError(
+ /** onError 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: InnerAudioContextOffErrorCallback
+ ): void
+ /** [InnerAudioContext.offPause(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offPause.html)
+*
+* 需要基础库: `1.9.0`
+*
+* 在插件中使用:支持
+*
+* 移除音频暂停事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+InnerAudioContext.onPause(listener)
+InnerAudioContext.offPause(listener) // 需传入与监听时同一个的函数对象
+``` */
+ offPause(
+ /** onPause 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffPauseCallback
+ ): void
+ /** [InnerAudioContext.offPlay(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offPlay.html)
+*
+* 需要基础库: `1.9.0`
+*
+* 在插件中使用:支持
+*
+* 移除音频播放事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+InnerAudioContext.onPlay(listener)
+InnerAudioContext.offPlay(listener) // 需传入与监听时同一个的函数对象
+``` */
+ offPlay(
+ /** onPlay 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffPlayCallback
+ ): void
+ /** [InnerAudioContext.offSeeked(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offSeeked.html)
+*
+* 需要基础库: `1.9.0`
+*
+* 在插件中使用:支持
+*
+* 移除音频完成跳转操作的事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+InnerAudioContext.onSeeked(listener)
+InnerAudioContext.offSeeked(listener) // 需传入与监听时同一个的函数对象
+``` */
+ offSeeked(
+ /** onSeeked 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffSeekedCallback
+ ): void
+ /** [InnerAudioContext.offSeeking(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offSeeking.html)
+*
+* 需要基础库: `1.9.0`
+*
+* 在插件中使用:支持
+*
+* 移除音频进行跳转操作的事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+InnerAudioContext.onSeeking(listener)
+InnerAudioContext.offSeeking(listener) // 需传入与监听时同一个的函数对象
+``` */
+ offSeeking(
+ /** onSeeking 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffSeekingCallback
+ ): void
+ /** [InnerAudioContext.offStop(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offStop.html)
+*
+* 需要基础库: `1.9.0`
+*
+* 在插件中使用:支持
+*
+* 移除音频停止事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+InnerAudioContext.onStop(listener)
+InnerAudioContext.offStop(listener) // 需传入与监听时同一个的函数对象
+``` */
+ offStop(
+ /** onStop 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffStopCallback
+ ): void
+ /** [InnerAudioContext.offTimeUpdate(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offTimeUpdate.html)
+*
+* 需要基础库: `1.9.0`
+*
+* 在插件中使用:支持
+*
+* 移除音频播放进度更新事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+InnerAudioContext.onTimeUpdate(listener)
+InnerAudioContext.offTimeUpdate(listener) // 需传入与监听时同一个的函数对象
+``` */
+ offTimeUpdate(
+ /** onTimeUpdate 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffTimeUpdateCallback
+ ): void
+ /** [InnerAudioContext.offWaiting(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offWaiting.html)
+*
+* 需要基础库: `1.9.0`
+*
+* 在插件中使用:支持
+*
+* 移除音频加载中事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+InnerAudioContext.onWaiting(listener)
+InnerAudioContext.offWaiting(listener) // 需传入与监听时同一个的函数对象
+``` */
+ offWaiting(
+ /** onWaiting 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffWaitingCallback
+ ): void
+ /** [InnerAudioContext.onCanplay(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onCanplay.html)
+ *
+ * 在插件中使用:支持
+ *
+ * 监听音频进入可以播放状态的事件。但不保证后面可以流畅播放 */
+ onCanplay(
+ /** 音频进入可以播放状态的事件的监听函数 */
+ listener: OnCanplayCallback
+ ): void
+ /** [InnerAudioContext.onEnded(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onEnded.html)
+ *
+ * 在插件中使用:支持
+ *
+ * 监听音频自然播放至结束的事件 */
+ onEnded(
+ /** 音频自然播放至结束的事件的监听函数 */
+ listener: OnEndedCallback
+ ): void
+ /** [InnerAudioContext.onError(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onError.html)
+ *
+ * 在插件中使用:支持
+ *
+ * 监听音频播放错误事件
+ *
+ * **Tips**
+ *
+ * 1. errCode=100001 时,如若 errMsg 中有 INNERCODE -11828 ,请先检查 response header 是否缺少 Content-Length
+ * 2. errCode=100001 时,如若 errMsg 中有 systemErrCode:200333420,请检查文件编码格式和 fileExtension 是否一致 */
+ onError(
+ /** 音频播放错误事件的监听函数 */
+ listener: InnerAudioContextOnErrorCallback
+ ): void
+ /** [InnerAudioContext.onPause(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onPause.html)
+ *
+ * 在插件中使用:支持
+ *
+ * 监听音频暂停事件 */
+ onPause(
+ /** 音频暂停事件的监听函数 */
+ listener: OnPauseCallback
+ ): void
+ /** [InnerAudioContext.onPlay(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onPlay.html)
+ *
+ * 在插件中使用:支持
+ *
+ * 监听音频播放事件 */
+ onPlay(
+ /** 音频播放事件的监听函数 */
+ listener: OnPlayCallback
+ ): void
+ /** [InnerAudioContext.onSeeked(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onSeeked.html)
+ *
+ * 在插件中使用:支持
+ *
+ * 监听音频完成跳转操作的事件 */
+ onSeeked(
+ /** 音频完成跳转操作的事件的监听函数 */
+ listener: OnSeekedCallback
+ ): void
+ /** [InnerAudioContext.onSeeking(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onSeeking.html)
+ *
+ * 在插件中使用:支持
+ *
+ * 监听音频进行跳转操作的事件 */
+ onSeeking(
+ /** 音频进行跳转操作的事件的监听函数 */
+ listener: OnSeekingCallback
+ ): void
+ /** [InnerAudioContext.onStop(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onStop.html)
+ *
+ * 在插件中使用:支持
+ *
+ * 监听音频停止事件 */
+ onStop(
+ /** 音频停止事件的监听函数 */
+ listener: InnerAudioContextOnStopCallback
+ ): void
+ /** [InnerAudioContext.onTimeUpdate(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onTimeUpdate.html)
+ *
+ * 在插件中使用:支持
+ *
+ * 监听音频播放进度更新事件 */
+ onTimeUpdate(
+ /** 音频播放进度更新事件的监听函数 */
+ listener: OnTimeUpdateCallback
+ ): void
+ /** [InnerAudioContext.onWaiting(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onWaiting.html)
+ *
+ * 在插件中使用:支持
+ *
+ * 监听音频加载中事件。当音频因为数据不足,需要停下来加载时会触发 */
+ onWaiting(
+ /** 音频加载中事件的监听函数 */
+ listener: OnWaitingCallback
+ ): void
+ /** [InnerAudioContext.pause()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.pause.html)
+ *
+ * 在插件中使用:支持
+ *
+ * 暂停。暂停后的音频再播放会从暂停处开始播放 */
+ pause(): void
+ /** [InnerAudioContext.play()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.play.html)
+ *
+ * 在插件中使用:支持
+ *
+ * 播放 */
+ play(): void
+ /** [InnerAudioContext.seek(number position)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.seek.html)
+ *
+ * 在插件中使用:支持
+ *
+ * 跳转到指定位置 */
+ seek(
+ /** 跳转的时间,单位 s。精确到小数点后 3 位,即支持 ms 级别精确度 */
+ position: number
+ ): void
+ /** [InnerAudioContext.stop()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.stop.html)
+ *
+ * 在插件中使用:支持
+ *
+ * 停止。停止后的音频再播放会从头开始播放。 */
+ stop(): void
+ }
+ interface InnerAudioContextOnErrorListenerResult {
+ /** 可选值:
* - 10001: 系统错误;
* - 10002: 网络错误;
* - 10003: 文件错误;
@@ -2860,6 +7312,21 @@ innerAudioContext.onError((res) => {
errCode: 10001 | 10002 | 10003 | 10004 | -1
errMsg: string
}
+ interface InsertCustomBlockOption {
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: InsertCustomBlockCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: InsertCustomBlockFailCallback
+ /** 插入自定义块后是否自动换行,默认换行 */
+ nowrap?: boolean
+ /** 接口调用成功的回调函数 */
+ success?: InsertCustomBlockSuccessCallback
+ }
+ interface InsertCustomBlockSuccessCallbackResult {
+ /** 自定义区块标识符,需结合 [editor-portal](https://developers.weixin.qq.com/miniprogram/dev/component/editor-portal.html) 组件一起使用。 */
+ blockId: string
+ errMsg: string
+ }
interface InsertDividerOption {
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: InsertDividerCompleteCallback
@@ -2883,6 +7350,8 @@ innerAudioContext.onError((res) => {
fail?: InsertImageFailCallback
/** 图片高度 (pixels/百分比) */
height?: string
+ /** 插入图片后是否自动换行,默认换行 */
+ nowrap?: boolean
/** 接口调用成功的回调函数 */
success?: InsertImageSuccessCallback
/** 图片宽度(pixels/百分比) */
@@ -2901,6 +7370,10 @@ innerAudioContext.onError((res) => {
interface IntersectionObserverObserveCallbackResult {
/** 目标边界 */
boundingClientRect: BoundingClientRectResult
+ /** 节点自定义数据属性 */
+ dataset: Record
+ /** 节点 ID */
+ id: string
/** 相交比例 */
intersectionRatio: number
/** 相交区域的边界 */
@@ -2925,7 +7398,7 @@ innerAudioContext.onError((res) => {
/** 宽度 */
width: number
}
- interface InterstitialAdOnErrorCallbackResult {
+ interface InterstitialAdOnErrorListenerResult {
/** 错误码
*
* 可选值:
@@ -2942,6 +7415,16 @@ innerAudioContext.onError((res) => {
/** 错误信息 */
errMsg: string
}
+ interface IsBluetoothDevicePairedOption {
+ /** 蓝牙设备 id */
+ deviceId: string
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: IsBluetoothDevicePairedCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: IsBluetoothDevicePairedFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: IsBluetoothDevicePairedSuccessCallback
+ }
interface IsConnectedOption {
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: IsConnectedCompleteCallback
@@ -2950,6 +7433,38 @@ innerAudioContext.onError((res) => {
/** 接口调用成功的回调函数 */
success?: IsConnectedSuccessCallback
}
+ interface Join1v1ChatOption {
+ /** 呼叫方信息 */
+ caller: VoIP1v1ChatUser
+ /** 接听方信息 */
+ listener: VoIP1v1ChatUser
+ /** 窗口背景色(音频通话背景以及小窗模式背景)
+ *
+ * 可选值:
+ * - 0: #262930;
+ * - 1: #FA5151;
+ * - 2: #FA9D3B;
+ * - 3: #3D7257;
+ * - 4: #1485EE;
+ * - 5: #6467F0; */
+ backgroundType?: 0 | 1 | 2 | 3 | 4 | 5
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: Join1v1ChatCompleteCallback
+ /** 不允许切换到语音通话 */
+ disableSwitchVoice?: boolean
+ /** 接口调用失败的回调函数 */
+ fail?: Join1v1ChatFailCallback
+ /** 小窗样式 */
+ minWindowType?: number
+ /** 通话类型
+ *
+ * 可选值:
+ * - 'voice': 语音通话;
+ * - 'video': 视频通话; */
+ roomType?: 'voice' | 'video'
+ /** 接口调用成功的回调函数 */
+ success?: Join1v1ChatSuccessCallback
+ }
interface JoinVoIPChatOption {
/** 小游戏内此房间/群聊的 ID。同一时刻传入相同 groupId 的用户会进入到同个实时语音房间。 */
groupId: string
@@ -2963,6 +7478,10 @@ innerAudioContext.onError((res) => {
complete?: JoinVoIPChatCompleteCallback
/** 接口调用失败的回调函数 */
fail?: JoinVoIPChatFailCallback
+ /** 需要基础库: `2.29.0`
+ *
+ * 开启后,joinVoIPChat 会同时走 Wi-Fi 和蜂窝网络2种网络模式,保证实时通话体验。 */
+ forceCellularNetwork?: boolean
/** 静音设置 */
muteConfig?: MuteConfig
/** 房间类型
@@ -2982,21 +7501,67 @@ innerAudioContext.onError((res) => {
/** 在此通话中的成员 openId 名单 */
openIdList: string[]
}
+ interface KvList {
+ /** key 本地缓存中指定的 key */
+ key: string
+ /** data 需要存储的内容。只支持原生类型、Date、及能够通过`JSON.stringify`序列化的对象。 */
+ value: any
+ }
/** 启动参数 */
interface LaunchOptionsApp {
+ /** 需要基础库: `2.20.0`
+ *
+ * API 类别
+ *
+ * 可选值:
+ * - 'default': 默认类别;
+ * - 'nativeFunctionalized': 原生功能化,视频号直播商品、商品橱窗等场景打开的小程序;
+ * - 'browseOnly': 仅浏览,朋友圈快照页等场景打开的小程序;
+ * - 'embedded': 内嵌,通过打开半屏小程序能力打开的小程序;
+ * - 'chatTool': 聊天工具,通过打开聊天工具能力打开的小程序; */
+ apiCategory:
+ | 'default'
+ | 'nativeFunctionalized'
+ | 'browseOnly'
+ | 'embedded'
+ | 'chatTool'
/** 打开的文件信息数组,只有从聊天素材场景打开(scene为1173)才会携带该参数 */
forwardMaterials: ForwardMaterials[]
+ /** 宿主传递的数据,第三方 app 中运行小程序时返回 */
+ hostExtraData: HostExtraData
/** 启动小程序的路径 (代码包路径) */
path: string
/** 启动小程序的 query 参数 */
- query: IAnyObject
+ query: Record
/** 来源信息。从另一个小程序、公众号或 App 进入小程序时返回。否则返回 `{}`。(参见后文注意) */
referrerInfo: ReferrerInfo
/** 启动小程序的[场景值](https://developers.weixin.qq.com/miniprogram/dev/framework/app-service/scene.html) */
scene: number
- /** shareTicket,详见[获取更多转发信息](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html) */
+ /** 从微信群聊/单聊打开小程序时,chatType 表示具体微信群聊/单聊类型
+ *
+ * 可选值:
+ * - 1: 微信联系人单聊;
+ * - 2: 企业微信联系人单聊;
+ * - 3: 普通微信群聊;
+ * - 4: 企业微信互通群聊; */
+ chatType?: 1 | 2 | 3 | 4
+ /** shareTicket,详见[获取更多转发信息](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html#获取更多转发信息) */
shareTicket?: string
}
+ /** 帧深度纹理buffer对象,width * height 大小的 深度值(float32) */
+ interface LegSegmentBufferRes {
+ /** 腿部分割纹理buffer,width * height 大小的 裁剪值(0 为不是脚,越靠近 255 越接近腿部区域)(uint8) */
+ DepthAddress: ArrayBuffer
+ /** 腿部分割纹理高 */
+ height: number
+ /** 腿部分割纹理宽 */
+ width: number
+ }
+ /** 错误 */
+ interface ListenerError {
+ /** 错误信息,包含堆栈 */
+ message: string
+ }
interface LivePlayerContextRequestFullScreenOption {
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: RequestFullScreenCompleteCallback
@@ -3017,10 +7582,22 @@ innerAudioContext.onError((res) => {
complete?: SnapshotCompleteCallback
/** 接口调用失败的回调函数 */
fail?: SnapshotFailCallback
- /** 图片的质量,默认原图。有效值为 raw、compressed
+ /** 需要基础库: `2.10.0`
*
- * 最低基础库: `2.10.0` */
- quality?: string
+ * 图片的质量
+ *
+ * 可选值:
+ * - 'raw': 原图;
+ * - 'compressed': 压缩图; */
+ quality?: 'raw' | 'compressed'
+ /** 需要基础库: `2.25.0`
+ *
+ * 截取的源类型
+ *
+ * 可选值:
+ * - 'stream': 截取视频源;
+ * - 'view': 截取渲染后的画面; */
+ sourceType?: 'stream' | 'view'
/** 接口调用成功的回调函数 */
success?: LivePlayerContextSnapshotSuccessCallback
}
@@ -3033,15 +7610,37 @@ innerAudioContext.onError((res) => {
width: string
errMsg: string
}
+ interface LivePusherContextSetZoomOption {
+ /** 缩放级别,范围[1, maxZoom]。zoom 可取小数,精确到小数后一位。 */
+ zoom: number
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: SetZoomCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: SetZoomFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: LivePusherContextSetZoomSuccessCallback
+ }
interface LivePusherContextSnapshotOption {
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: SnapshotCompleteCallback
/** 接口调用失败的回调函数 */
fail?: SnapshotFailCallback
- /** 图片的质量,默认原图。有效值为 raw、compressed
+ /** 需要基础库: `2.10.0`
*
- * 最低基础库: `2.10.0` */
- quality?: string
+ * 图片的质量
+ *
+ * 可选值:
+ * - 'raw': 原图;
+ * - 'compressed': 压缩图; */
+ quality?: 'raw' | 'compressed'
+ /** 需要基础库: `2.25.0`
+ *
+ * 截取的源类型
+ *
+ * 可选值:
+ * - 'stream': 截取视频源;
+ * - 'view': 截取渲染后的画面; */
+ sourceType?: 'stream' | 'view'
/** 接口调用成功的回调函数 */
success?: LivePusherContextSnapshotSuccessCallback
}
@@ -3054,6 +7653,34 @@ innerAudioContext.onError((res) => {
width: string
errMsg: string
}
+ interface LivePusherContextStartOption {
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: StartCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: StartFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: StartSuccessCallback
+ }
+ interface LoadBuiltInFontFaceOption {
+ /** 定义的字体名称 */
+ family: string
+ /** 要加载的内置字体名字
+ *
+ * 可选值:
+ * - 'WeChatSansSS': WeChatSansSS 字体;
+ * - 'WeChatSansStd': WeChatSansStd 字体; */
+ source: 'WeChatSansSS' | 'WeChatSansStd'
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: LoadBuiltInFontFaceCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: LoadBuiltInFontFaceFailCallback
+ /** <是否全局生效 */
+ global?: boolean
+ /** 字体作用范围,可选值为 webview / native / skyline,默认全选,设置 native 可在 Canvas 2D 下使用 */
+ scopes?: any[]
+ /** 接口调用成功的回调函数 */
+ success?: LoadBuiltInFontFaceSuccessCallback
+ }
interface LoadFontFaceCompleteCallbackResult {
/** 加载字体结果 */
status: string
@@ -3061,7 +7688,7 @@ innerAudioContext.onError((res) => {
interface LoadFontFaceOption {
/** 定义的字体名称 */
family: string
- /** 字体资源的地址。建议格式为 TTF 和 WOFF,WOFF2 在低版本的iOS上会不兼容。 */
+ /** 字体资源的地址,可以为 https 链接或者 Data URL。 */
source: string
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: LoadFontFaceCompleteCallback
@@ -3069,15 +7696,23 @@ innerAudioContext.onError((res) => {
desc?: DescOption
/** 接口调用失败的回调函数 */
fail?: LoadFontFaceFailCallback
- /** 是否全局生效
+ /** 需要基础库: `2.10.0`
*
- * 最低基础库: `2.10.0` */
+ * 是否全局生效 */
global?: boolean
- /** 字体作用范围,可选值为 webview / native,默认 webview,设置 native 可在 Canvas 2D 下使用 */
+ /** 字体作用范围,可选值为 webview / native / skyline,默认全选,设置 native 可在 Canvas 2D 下使用 */
scopes?: any[]
/** 接口调用成功的回调函数 */
success?: LoadFontFaceSuccessCallback
}
+ interface LoginFailCallbackErr {
+ /** 错误信息 */
+ errMsg: string
+ /** 需要基础库: `2.24.0`
+ *
+ * errno 错误码,错误码的详细说明参考 [Errno错误码](https://developers.weixin.qq.com/miniprogram/dev/framework/usability/PublicErrno.html) */
+ errno: number
+ }
interface LoginOption {
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: LoginCompleteCallback
@@ -3085,13 +7720,13 @@ innerAudioContext.onError((res) => {
fail?: LoginFailCallback
/** 接口调用成功的回调函数 */
success?: LoginSuccessCallback
- /** 超时时间,单位ms
+ /** 需要基础库: `1.9.90`
*
- * 最低基础库: `1.9.90` */
+ * 超时时间,单位ms */
timeout?: number
}
interface LoginSuccessCallbackResult {
- /** 用户登录凭证(有效期五分钟)。开发者需要在开发者服务器后台调用 [auth.code2Session](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/login/auth.code2Session.html),使用 code 换取 openid 和 session_key 等信息 */
+ /** 用户登录凭证(有效期五分钟)。开发者需要在开发者服务器后台调用 [code2Session](https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/user-login/code2Session.html),使用 code 换取 openid、unionid、session_key 等信息 */
code: string
errMsg: string
}
@@ -3106,7 +7741,7 @@ innerAudioContext.onError((res) => {
fail?: MakeBluetoothPairFailCallback
/** 接口调用成功的回调函数 */
success?: MakeBluetoothPairSuccessCallback
- /** 超时时间 */
+ /** 超时时间,单位 ms */
timeout?: number
}
interface MakePhoneCallOption {
@@ -3119,7 +7754,7 @@ innerAudioContext.onError((res) => {
/** 接口调用成功的回调函数 */
success?: MakePhoneCallSuccessCallback
}
- /** 广播的制造商信息, 仅安卓支持 */
+ /** 广播的制造商信息。仅安卓支持,iOS 因系统限制无法定制。 */
interface ManufacturerData {
/** 制造商ID,0x 开头的十六进制 */
manufacturerId: string
@@ -3150,15 +7785,74 @@ innerAudioContext.onError((res) => {
/** 节点布局区域的上边界 */
top?: number
}
+ /** 匹配到的缓存 */
+ interface MatchCache {
+ /** 缓存 id */
+ cacheId: string
+ /** 缓存创建时间 */
+ createTime: number
+ /** 缓存内容,会带有 fromCache 标记,方便开发者区分内容是否来自缓存 */
+ data: any
+ /** 缓存有效时间 */
+ maxAge: number
+ /** 命中的规则 id */
+ ruleId: string
+ }
/** MediaAudioPlayer 实例,可通过 [wx.createMediaAudioPlayer](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.createMediaAudioPlayer.html) 接口获取实例。 */
interface MediaAudioPlayer {
/** 音量。范围 0~1。默认为 1 */
volume: number
+ /** [Promise MediaAudioPlayer.addAudioSource([VideoDecoder](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.html) source)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/MediaAudioPlayer.addAudioSource.html)
+ *
+ * 在插件中使用:支持
+ *
+ * 添加音频源 */
+ addAudioSource(
+ /** [VideoDecoder](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.html)
+ *
+ * 视频解码器实例。作为音频源添加到音频播放器中 */
+ source: VideoDecoder
+ ): Promise
+ /** [Promise MediaAudioPlayer.destroy()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/MediaAudioPlayer.destroy.html)
+ *
+ * 在插件中使用:支持
+ *
+ * 销毁播放器 */
+ destroy(): Promise
+ /** [Promise MediaAudioPlayer.removeAudioSource([VideoDecoder](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.html) source)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/MediaAudioPlayer.removeAudioSource.html)
+ *
+ * 在插件中使用:支持
+ *
+ * 移除音频源 */
+ removeAudioSource(
+ /** [VideoDecoder](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.html)
+ *
+ * 视频解码器实例 */
+ source: VideoDecoder
+ ): Promise
+ /** [Promise MediaAudioPlayer.start()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/MediaAudioPlayer.start.html)
+ *
+ * 在插件中使用:支持
+ *
+ * 启动播放器 */
+ start(): Promise
+ /** [Promise MediaAudioPlayer.stop()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/MediaAudioPlayer.stop.html)
+ *
+ * 在插件中使用:支持
+ *
+ * 停止播放器 */
+ stop(): Promise
}
/** 本地临时文件列表 */
interface MediaFile {
/** 视频的时间长度 */
duration: number
+ /** 文件类型
+ *
+ * 可选值:
+ * - 'image': 图片;
+ * - 'video': 视频; */
+ fileType: 'image' | 'video'
/** 视频的高度 */
height: number
/** 本地临时文件大小,单位 B */
@@ -3187,11 +7881,11 @@ innerAudioContext.onError((res) => {
* - 'video': 视频; */
type?: 'image' | 'video'
}
- /** 可通过 [MediaContainer.extractDataSource](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaContainer.extractDataSource.html) 返回。
+ /** 需要基础库: `2.9.0`
*
- * [MediaTrack](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaTrack.html) 音频或视频轨道,可以对轨道进行一些操作
+ * 可通过 [MediaContainer.extractDataSource](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaContainer.extractDataSource.html) 返回。
*
- * 最低基础库: `2.9.0` */
+ * [MediaTrack](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaTrack.html) 音频或视频轨道,可以对轨道进行一些操作 */
interface MediaTrack {
/** 轨道长度,只读 */
duration: number
@@ -3204,34 +7898,24 @@ innerAudioContext.onError((res) => {
/** 音量,音频轨道下有效,可写 */
volume: number
}
- /** 小程序帐号信息 */
+ /** 小程序账号信息 */
interface MiniProgram {
/** 小程序 appId */
appId: string
- /** 小程序版本
+ /** 需要基础库: `2.10.0`
+ *
+ * 小程序版本
*
* 可选值:
- * - 'develop': 开发版;
+ * - 'develop': 开发版,提交代码审核时默认使用开发版进行审核。;
* - 'trial': 体验版;
- * - 'release': 正式版;
- *
- * 最低基础库: `2.10.0` */
+ * - 'release': 正式版; */
envVersion: 'develop' | 'trial' | 'release'
- /** 线上小程序版本号
+ /** 需要基础库: `2.10.2`
*
- * 最低基础库: `2.10.2` */
+ * 线上小程序版本号 */
version: string
}
- interface MkdirFailCallbackResult {
- /** 错误信息
- *
- * 可选值:
- * - 'fail no such file or directory ${dirPath}': 上级目录不存在;
- * - 'fail permission denied, open ${dirPath}': 指定的 filePath 路径没有写权限;
- * - 'fail file already exists ${dirPath}': 有同名文件或目录;
- * - 'fail sdcard not mounted': Android sdcard 挂载失败; */
- errMsg: string
- }
interface MkdirOption {
/** 创建的目录路径 (本地路径) */
dirPath: string
@@ -3239,9 +7923,9 @@ innerAudioContext.onError((res) => {
complete?: MkdirCompleteCallback
/** 接口调用失败的回调函数 */
fail?: MkdirFailCallback
- /** 是否在递归创建该目录的上级目录后再创建该目录。如果对应的上级目录已经存在,则不创建该上级目录。如 dirPath 为 a/b/c/d 且 recursive 为 true,将创建 a 目录,再在 a 目录下创建 b 目录,以此类推直至创建 a/b/c 目录下的 d 目录。
+ /** 需要基础库: `2.3.0`
*
- * 最低基础库: `2.3.0` */
+ * 是否在递归创建该目录的上级目录后再创建该目录。如果对应的上级目录已经存在,则不创建该上级目录。如 dirPath 为 a/b/c/d 且 recursive 为 true,将创建 a 目录,再在 a 目录下创建 b 目录,以此类推直至创建 a/b/c 目录下的 d 目录。 */
recursive?: boolean
/** 接口调用成功的回调函数 */
success?: MkdirSuccessCallback
@@ -3253,6 +7937,8 @@ innerAudioContext.onError((res) => {
markerId: number
/** 移动路径的坐标串,坐标点格式 `{longitude, latitude}` */
path: any[]
+ /** 平滑移动触发 map 组件 interpolatepoint 事件的插值精度,单位为 m。默认不触发。 */
+ precision: IAnyObject
/** 根据路径方向自动改变 marker 的旋转角度 */
autoRotate?: boolean
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
@@ -3267,13 +7953,13 @@ innerAudioContext.onError((res) => {
complete?: MoveToLocationCompleteCallback
/** 接口调用失败的回调函数 */
fail?: MoveToLocationFailCallback
- /** 纬度
+ /** 需要基础库: `2.8.0`
*
- * 最低基础库: `2.8.0` */
+ * 纬度 */
latitude?: number
- /** 经度
+ /** 需要基础库: `2.8.0`
*
- * 最低基础库: `2.8.0` */
+ * 经度 */
longitude?: number
/** 接口调用成功的回调函数 */
success?: MoveToLocationSuccessCallback
@@ -3293,12 +7979,117 @@ innerAudioContext.onError((res) => {
/** 接口调用成功的回调函数 */
success?: MuteSuccessCallback
}
- /**
- *
- * 最低基础库: `2.11.2` */
+ /** 需要基础库: `2.11.2` */
interface NFCAdapter {
/** 标签类型枚举 */
tech: TechType
+ /** [NFCAdapter.offDiscovered(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.offDiscovered.html)
+*
+* 需要基础库: `2.11.2`
+*
+* 在插件中使用:支持
+*
+* 移除 NFC Tag的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+NFCAdapter.onDiscovered(listener)
+NFCAdapter.offDiscovered(listener) // 需传入与监听时同一个的函数对象
+``` */
+ offDiscovered(
+ /** onDiscovered 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffDiscoveredCallback
+ ): void
+ /** [NFCAdapter.onDiscovered(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.onDiscovered.html)
+ *
+ * 需要基础库: `2.11.2`
+ *
+ * 在插件中使用:支持
+ *
+ * 监听 NFC Tag */
+ onDiscovered(
+ /** 的监听函数 */
+ listener: OnDiscoveredCallback
+ ): void
+ /** [NFCAdapter.startDiscovery(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.startDiscovery.html)
+ *
+ * 需要基础库: `2.11.2`
+ *
+ * 在插件中使用:支持 */
+ startDiscovery(option?: StartDiscoveryOption): void
+ /** [NFCAdapter.stopDiscovery(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.stopDiscovery.html)
+ *
+ * 需要基础库: `2.11.2`
+ *
+ * 在插件中使用:支持 */
+ stopDiscovery(option?: StopDiscoveryOption): void
+ /** [[IsoDep](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.html) NFCAdapter.getIsoDep()](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getIsoDep.html)
+ *
+ * 需要基础库: `2.11.2`
+ *
+ * 在插件中使用:支持
+ *
+ * 获取IsoDep实例,实例支持ISO-DEP (ISO 14443-4)标准的读写 */
+ getIsoDep(): IsoDep
+ /** [[MifareClassic](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareClassic.html) NFCAdapter.getMifareClassic()](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getMifareClassic.html)
+ *
+ * 需要基础库: `2.11.2`
+ *
+ * 在插件中使用:支持
+ *
+ * 获取MifareClassic实例,实例支持MIFARE Classic标签的读写 */
+ getMifareClassic(): MifareClassic
+ /** [[MifareUltralight](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareUltralight.html) NFCAdapter.getMifareUltralight()](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getMifareUltralight.html)
+ *
+ * 需要基础库: `2.11.2`
+ *
+ * 在插件中使用:支持
+ *
+ * 获取MifareUltralight实例,实例支持MIFARE Ultralight标签的读写 */
+ getMifareUltralight(): MifareUltralight
+ /** [[Ndef](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/Ndef.html) NFCAdapter.getNdef()](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getNdef.html)
+ *
+ * 需要基础库: `2.11.2`
+ *
+ * 在插件中使用:支持
+ *
+ * 获取Ndef实例,实例支持对NDEF格式的NFC标签上的NDEF数据的读写 */
+ getNdef(): Ndef
+ /** [[NfcA](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.html) NFCAdapter.getNfcA()](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getNfcA.html)
+ *
+ * 需要基础库: `2.11.2`
+ *
+ * 在插件中使用:支持
+ *
+ * 获取NfcA实例,实例支持NFC-A (ISO 14443-3A)标准的读写 */
+ getNfcA(): NfcA
+ /** [[NfcB](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcB.html) NFCAdapter.getNfcB()](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getNfcB.html)
+ *
+ * 需要基础库: `2.11.2`
+ *
+ * 在插件中使用:支持
+ *
+ * 获取NfcB实例,实例支持NFC-B (ISO 14443-3B)标准的读写 */
+ getNfcB(): NfcB
+ /** [[NfcF](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcF.html) NFCAdapter.getNfcF()](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getNfcF.html)
+ *
+ * 需要基础库: `2.11.2`
+ *
+ * 在插件中使用:支持
+ *
+ * 获取NfcF实例,实例支持NFC-F (JIS 6319-4)标准的读写 */
+ getNfcF(): NfcF
+ /** [[NfcV](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcV.html) NFCAdapter.getNfcV()](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getNfcV.html)
+ *
+ * 需要基础库: `2.11.2`
+ *
+ * 在插件中使用:支持
+ *
+ * 获取NfcV实例,实例支持NFC-V (ISO 15693)标准的读写 */
+ getNfcV(): NfcV
}
interface NavigateBackMiniProgramOption {
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
@@ -3313,7 +8104,7 @@ innerAudioContext.onError((res) => {
interface NavigateBackOption {
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: NavigateBackCompleteCallback
- /** 返回的页面数,如果 delta 大于现有页面数,则返回到首页。 */
+ /** 返回的页面数,如果 delta 大于现有页面数,则返回到页面栈中只剩一个页面为止。 */
delta?: number
/** 接口调用失败的回调函数 */
fail?: NavigateBackFailCallback
@@ -3322,7 +8113,7 @@ innerAudioContext.onError((res) => {
}
interface NavigateToMiniProgramOption {
/** 要打开的小程序 appId */
- appId: string
+ appId?: string
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: NavigateToMiniProgramCompleteCallback
/** 要打开的小程序版本。仅在当前小程序为开发版或体验版时此参数有效。如果当前小程序是正式版,则打开的小程序必定是正式版。
@@ -3332,12 +8123,20 @@ innerAudioContext.onError((res) => {
* - 'trial': 体验版;
* - 'release': 正式版; */
envVersion?: 'develop' | 'trial' | 'release'
- /** 需要传递给目标小程序的数据,目标小程序可在 `App.onLaunch`,`App.onShow` 中获取到这份数据。如果跳转的是小游戏,可以在 [wx.onShow](#)、[wx.getLaunchOptionsSync](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/life-cycle/wx.getLaunchOptionsSync.html) 中可以获取到这份数据数据。 */
+ /** 需要传递给目标小程序的数据,目标小程序可在 `App.onLaunch`,`App.onShow` 中获取到这份数据。如果跳转的是小游戏,可以在 [wx.onShow](#)、[wx.getLaunchOptionsSync](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/life-cycle/wx.getLaunchOptionsSync.html) 中可以获取到这份数据。 */
extraData?: IAnyObject
/** 接口调用失败的回调函数 */
fail?: NavigateToMiniProgramFailCallback
+ /** 需要基础库: `2.24.0`
+ *
+ * 不reLaunch目标小程序,直接打开目标跳转的小程序退后台时的页面,需满足以下条件:1. 目标跳转的小程序生命周期未被销毁;2. 且目标当次启动的path、query与上次启动相同,apiCategory以wx.getApiCategory接口的返回结果为准。 */
+ noRelaunchIfPathUnchanged?: boolean
/** 打开的页面路径,如果为空则打开首页。path 中 ? 后面的部分会成为 query,在小程序的 `App.onLaunch`、`App.onShow` 和 `Page.onLoad` 的回调函数或小游戏的 [wx.onShow](#) 回调函数、[wx.getLaunchOptionsSync](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/life-cycle/wx.getLaunchOptionsSync.html) 中可以获取到 query 数据。对于小游戏,可以只传入 query 部分,来实现传参效果,如:传入 "?foo=bar"。 */
path?: string
+ /** 需要基础库: `2.18.1`
+ *
+ * 小程序链接,当传递该参数后,可以不传 appId 和 path。链接可以通过【小程序菜单】->【复制链接】获取。 */
+ shortLink?: string
/** 接口调用成功的回调函数 */
success?: NavigateToMiniProgramSuccessCallback
}
@@ -3350,6 +8149,12 @@ innerAudioContext.onError((res) => {
events?: IAnyObject
/** 接口调用失败的回调函数 */
fail?: NavigateToFailCallback
+ /** 3.4.0 自定义路由配置,相关文档 [自定义路由](https://developers.weixin.qq.com/miniprogram/dev/framework/runtime/skyline/custom-route.html) */
+ routeConfig?: IAnyObject
+ /** 3.4.0 自定义路由参数,相关文档 [自定义路由](https://developers.weixin.qq.com/miniprogram/dev/framework/runtime/skyline/custom-route.html) */
+ routeOptions?: IAnyObject
+ /** 2.29.2 自定义路由类型,相关文档 [自定义路由](https://developers.weixin.qq.com/miniprogram/dev/framework/runtime/skyline/custom-route.html) */
+ routeType?: string
/** 接口调用成功的回调函数 */
success?: NavigateToSuccessCallback
}
@@ -3368,16 +8173,24 @@ innerAudioContext.onError((res) => {
/** 接口调用成功的回调函数 */
success?: NdefCloseSuccessCallback
}
+ interface NdefConnectOption {
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: ConnectCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: ConnectFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: ConnectSuccessCallback
+ }
interface NodeCallbackResult {
/** 节点对应的 Node 实例 */
node: IAnyObject
}
interface NotifyBLECharacteristicValueChangeOption {
- /** 蓝牙特征值的 uuid */
+ /** 蓝牙特征的 UUID */
characteristicId: string
/** 蓝牙设备 id */
deviceId: string
- /** 蓝牙特征值对应服务的 uuid */
+ /** 蓝牙特征对应服务的 UUID */
serviceId: string
/** 是否启用 notify */
state: boolean
@@ -3387,25 +8200,115 @@ innerAudioContext.onError((res) => {
fail?: NotifyBLECharacteristicValueChangeFailCallback
/** 接口调用成功的回调函数 */
success?: NotifyBLECharacteristicValueChangeSuccessCallback
+ /** 需要基础库: `2.4.0`
+ *
+ * 设置特征订阅类型,有效值有 `notification` 和 `indication` */
+ type?: string
+ }
+ interface NotifyGroupMembersOption {
+ /** 文字链跳转路径 */
+ entrancePath: string
+ /** 需要提醒的用户 group_openid 列表 */
+ members: string[]
+ /** 文字链标题,发送的内容将由微信拼接为:@的成员列表+“请完成:”/"请参与:"+打开小程序的文字链,如「@alex @cindy 请完成:团建报名统计」。 */
+ title: string
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: NotifyGroupMembersCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: NotifyGroupMembersFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: NotifyGroupMembersSuccessCallback
+ /** 展示的动词
+ *
+ * 可选值:
+ * - 'participate': 请参与;
+ * - 'complete': 请完成; */
+ type?: 'participate' | 'complete'
+ }
+ /** 需要基础库: `2.27.0`
+ *
+ * OCR检测配置。用法详情[指南文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/visionkit/ocr.html)。 */
+ interface OCRTrack {
+ /** 需要基础库: `2.27.0`
+ *
+ * OCR检测模式
+ *
+ * 可选值:
+ * - 1: 通过摄像头实时检测;
+ * - 2: 静态图片检测; */
+ mode: 1 | 2
}
/** media query 描述符 */
interface ObserveDescriptor {
/** 页面高度( px 为单位) */
- height: number
+ height?: number
/** 页面最大高度( px 为单位) */
- maxHeight: number
+ maxHeight?: number
/** 页面最大宽度( px 为单位) */
- maxWidth: number
+ maxWidth?: number
/** 页面最小高度( px 为单位) */
- minHeight: number
+ minHeight?: number
/** 页面最小宽度( px 为单位) */
- minWidth: number
+ minWidth?: number
/** 屏幕方向( `landscape` 或 `portrait` ) */
- orientation: string
+ orientation?: string
/** 页面宽度( px 为单位) */
- width: number
+ width?: number
}
- interface OnAccelerometerChangeCallbackResult {
+ /** 设置 type 监听单个类型的指标,设置 entryTypes 监听多个类型指标。 */
+ interface ObserveOption {
+ /** 指标类型列表。不能和 type 同时使用。 */
+ entryTypes?: string[]
+ /** 指标类型。不能和 entryTypes 同时使用
+ *
+ * 可选值:
+ * - 'navigation': 路由;
+ * - 'render': 渲染;
+ * - 'script': 脚本;
+ * - 'loadPackage': 代码包下载; */
+ type?: 'navigation' | 'render' | 'script' | 'loadPackage'
+ }
+ /** 需要基础库: `2.7.0`
+ *
+ * 离屏 canvas 实例,可通过 [wx.createOffscreenCanvas](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/wx.createOffscreenCanvas.html) 创建。 */
+ interface OffscreenCanvas {
+ /** 画布高度 */
+ height: number
+ /** 画布宽度 */
+ width: number
+ /** [[Image](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Image.html) OffscreenCanvas.createImage()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/OffscreenCanvas.createImage.html)
+ *
+ * 需要基础库: `2.7.3`
+ *
+ * 在插件中使用:需要基础库 `2.16.1`
+ *
+ * 创建一个图片对象。支持在 2D Canvas 和 WebGL Canvas 下使用, 但不支持混用 2D 和 WebGL 的方法。
+ *
+ * ****
+ *
+ * 注意不允许混用 webgl 和 2d 画布创建的图片对象,使用时请注意尽量使用 canvas 自身的 `createImage` 创建图片对象。 */
+ createImage(): Image
+ /** [[RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) OffscreenCanvas.getContext(string contextType)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/OffscreenCanvas.getContext.html)
+ *
+ * 需要基础库: `2.7.0`
+ *
+ * 在插件中使用:需要基础库 `2.16.1`
+ *
+ * 该方法返回 OffscreenCanvas 的绘图上下文
+ *
+ * ****
+ *
+ * 注意不允许混用 webgl 和 2d 绘图上下文,传入的 contextType 必须要与 `wx.createOffscreenCanvas` 传入的 type 类型一致。 */
+ getContext(
+ /** 绘图上下文类型,需要与 createOffscreenCanvas 时传入的 type 一致
+ *
+ * 参数 contextType 可选值:
+ * - 'webgl': webgl类型上下文;
+ * - '2d': 2d类型上下文; */
+ contextType: 'webgl' | '2d'
+ ): any
+ }
+ interface OnAccelerometerChangeListenerResult {
/** X 轴 */
x: number
/** Y 轴 */
@@ -3413,69 +8316,205 @@ innerAudioContext.onError((res) => {
/** Z 轴 */
z: number
}
- interface OnAppShowCallbackResult {
- /** 打开的文件信息数组,只有从聊天素材场景打开(scene为1173)才会携带该参数 */
- forwardMaterials: ForwardMaterials[]
- /** 小程序切前台的路径 (代码包路径) */
+ interface OnAfterPageLoadListenerResult {
+ /** 组件框架
+ *
+ * 可选值:
+ * - 'exparser': 旧版小程序组件框架;
+ * - 'glass-easel': 新版小程序组件框架; */
+ componentFramework: 'exparser' | 'glass-easel'
+ /** 路由打开类型 */
+ openType: string
+ /** 页面实例 */
+ page: IAnyObject
+ /** 页面路径 */
path: string
- /** 小程序切前台的 query 参数 */
+ /** 路由参数 */
query: IAnyObject
- /** 来源信息。从另一个小程序、公众号或 App 进入小程序时返回。否则返回 `{}`。(参见后文注意) */
- referrerInfo: ReferrerInfo
- /** 小程序切前台的[场景值](https://developers.weixin.qq.com/miniprogram/dev/framework/app-service/scene.html) */
- scene: number
- /** shareTicket,详见[获取更多转发信息](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html) */
- shareTicket?: string
+ /** 路由事件 id */
+ routeEventId: string
}
- interface OnBLECharacteristicValueChangeCallbackResult {
- /** 蓝牙特征值的 uuid */
+ interface OnAfterPageUnloadListenerResult {
+ /** 页面路径 */
+ path: string
+ /** 路由事件 id */
+ routeEventId: string
+ }
+ interface OnApiCategoryChangeListenerResult {
+ /** API 类别
+ *
+ * 可选值:
+ * - 'default': 默认类别;
+ * - 'nativeFunctionalized': 原生功能化,视频号直播商品、商品橱窗等场景打开的小程序;
+ * - 'browseOnly': 仅浏览,朋友圈快照页等场景打开的小程序;
+ * - 'embedded': 内嵌,通过打开半屏小程序能力打开的小程序;
+ * - 'chatTool': 聊天工具打开小程序; */
+ apiCategory:
+ | 'default'
+ | 'nativeFunctionalized'
+ | 'browseOnly'
+ | 'embedded'
+ | 'chatTool'
+ }
+ interface OnAppRouteDoneListenerResult {
+ /** 路由打开类型 */
+ openType: string
+ /** 页面路径 */
+ path: string
+ /** 路由参数 */
+ query: IAnyObject
+ /** 路由事件 id */
+ routeEventId: string
+ /** 路由下发的时间戳 */
+ timeStamp: number
+ /** 当前页面 id */
+ webviewId: number
+ }
+ interface OnAppRouteListenerResult {
+ /** 是否未找到页面 */
+ notFound: boolean
+ /** 路由打开类型 */
+ openType: string
+ /** 当前打开页面的相关配置 */
+ page: IAnyObject
+ /** 页面路径 */
+ path: string
+ /** 可选值:
+ * - 'min': 视频页面缩小为小窗;
+ * - 'max': 视频小窗还原为页面; */
+ pipMode: 'min' | 'max'
+ /** 路由参数 */
+ query: IAnyObject
+ /** 渲染引擎
+ *
+ * 可选值:
+ * - 'webview': Webview 渲染引擎;
+ * - 'skyline': Skyline 渲染引擎;
+ * - 'xr-frame': xr-frame 解决方案; */
+ renderer: 'webview' | 'skyline' | 'xr-frame'
+ /** 路由事件 id */
+ routeEventId: string
+ /** 路由下发的时间戳 */
+ timeStamp: number
+ /** 当前页面 id */
+ webviewId: number
+ }
+ interface OnBLECharacteristicValueChangeListenerResult {
+ /** 蓝牙特征的 UUID */
characteristicId: string
/** 蓝牙设备 id */
deviceId: string
- /** 蓝牙特征值对应服务的 uuid */
+ /** 蓝牙特征对应服务的 UUID */
serviceId: string
- /** 特征值最新的值 */
+ /** 特征最新的值 */
value: ArrayBuffer
}
- interface OnBLEConnectionStateChangeCallbackResult {
+ interface OnBLEConnectionStateChangeListenerResult {
/** 是否处于已连接状态 */
connected: boolean
- /** 蓝牙设备ID */
+ /** 蓝牙设备 id */
deviceId: string
}
- interface OnBLEPeripheralConnectionStateChangedCallbackResult {
+ interface OnBLEMTUChangeListenerResult {
+ /** 蓝牙设备 id */
+ deviceId: string
+ /** 最大传输单元 */
+ mtu: number
+ }
+ interface OnBLEPeripheralConnectionStateChangedListenerResult {
/** 连接目前状态 */
connected: boolean
/** 连接状态变化的设备 id */
deviceId: string
- /** server 的 uuid */
+ /** server 的 UUID */
serverId: string
}
- interface OnBackgroundFetchDataCallbackResult {
- /** 缓存数据类别 (periodic) */
+ interface OnBackgroundFetchDataListenerResult {
+ /** 缓存数据类别,取值为 periodic 或 pre */
fetchType: string
/** 缓存数据 */
fetchedData: string
+ /** 小程序页面路径 */
+ path: string
+ /** 传给页面的 query 参数 */
+ query: string
+ /** 进入小程序的场景值 */
+ scene: number
/** 客户端拿到缓存数据的时间戳 */
timeStamp: number
}
- interface OnBeaconServiceChangeCallbackResult {
+ interface OnBatteryInfoChangeListenerResult {
+ /** 是否处于省电模式 */
+ isLowPowerModeEnabled: boolean
+ }
+ interface OnBeaconServiceChangeListenerResult {
/** 服务目前是否可用 */
available: boolean
/** 目前是否处于搜索状态 */
discovering: boolean
}
- interface OnBeaconUpdateCallbackResult {
- /** 当前搜寻到的所有 iBeacon 设备列表 */
- beacons: IBeaconInfo[]
+ interface OnBeaconUpdateListenerResult {
+ /** 当前搜寻到的所有 Beacon 设备列表 */
+ beacons: BeaconInfo[]
}
- interface OnBluetoothAdapterStateChangeCallbackResult {
+ interface OnBeforeAppRouteListenerResult {
+ /** 是否未找到页面 */
+ notFound: boolean
+ /** 路由打开类型 */
+ openType: string
+ /** 当前打开页面的相关配置 */
+ page: IAnyObject
+ /** 页面路径 */
+ path: string
+ /** 可选值:
+ * - 'min': 视频页面缩小为小窗;
+ * - 'max': 视频小窗还原为页面; */
+ pipMode: 'min' | 'max'
+ /** 路由参数 */
+ query: IAnyObject
+ /** 渲染引擎
+ *
+ * 可选值:
+ * - 'webview': Webview 渲染引擎;
+ * - 'skyline': Skyline 渲染引擎;
+ * - 'xr-frame': xr-frame 解决方案; */
+ renderer: 'webview' | 'skyline' | 'xr-frame'
+ /** 路由事件 id */
+ routeEventId: string
+ /** 当前页面 id */
+ webviewId: number
+ }
+ interface OnBeforePageLoadListenerResult {
+ /** 组件框架
+ *
+ * 可选值:
+ * - 'exparser': 旧版小程序组件框架;
+ * - 'glass-easel': 新版小程序组件框架; */
+ componentFramework: 'exparser' | 'glass-easel'
+ /** 路由打开类型 */
+ openType: string
+ /** 页面路径 */
+ path: string
+ /** 路由参数 */
+ query: IAnyObject
+ /** 路由事件 id */
+ routeEventId: string
+ }
+ interface OnBeforePageUnloadListenerResult {
+ /** 页面实例 */
+ page: IAnyObject
+ /** 页面路径 */
+ path: string
+ /** 路由事件 id */
+ routeEventId: string
+ }
+ interface OnBluetoothAdapterStateChangeListenerResult {
/** 蓝牙适配器是否可用 */
available: boolean
/** 蓝牙适配器是否处于搜索状态 */
discovering: boolean
}
- interface OnBluetoothDeviceFoundCallbackResult {
+ interface OnBluetoothDeviceFoundListenerResult {
/** 新搜索到的设备列表 */
devices: BlueToothDevice[]
}
@@ -3487,47 +8526,109 @@ innerAudioContext.onError((res) => {
/** 图像数据矩形的宽度 */
width: number
}
- interface OnCharacteristicReadRequestCallbackResult {
- /** 唯一标识码,调用 writeCharacteristicValue 时使用 */
+ interface OnCharacteristicReadRequestListenerResult {
+ /** 唯一标识码,调用 [writeCharacteristicValue](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.writeCharacteristicValue.html) 时使用 */
callbackId: number
- /** characteristic对应的uuid */
+ /** 蓝牙特征的 UUID */
characteristicId: string
- /** service对应的uuid */
+ /** 蓝牙特征对应服务的 UUID */
serviceId: string
}
- interface OnCharacteristicSubscribedCallbackResult {
- /** characteristic对应的uuid */
+ interface OnCharacteristicSubscribedListenerResult {
+ /** 蓝牙特征的 UUID */
characteristicId: string
- /** service对应的uuid */
+ /** 蓝牙特征对应服务的 UUID */
serviceId: string
}
- interface OnCharacteristicWriteRequestCallbackResult {
- /** 唯一标识码,调用 writeCharacteristicValue 时使用 */
+ interface OnCharacteristicWriteRequestListenerResult {
+ /** 唯一标识码,调用 [writeCharacteristicValue](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.writeCharacteristicValue.html) 时使用 */
callbackId: number
- /** characteristic对应的uuid */
+ /** 蓝牙特征的 UUID */
characteristicId: string
- /** service对应的uuid */
+ /** 蓝牙特征对应服务的 UUID */
serviceId: string
- /** 请求写入的特征值数据 */
+ /** 请求写入特征的二进制数据值 */
value: ArrayBuffer
}
- interface OnCheckForUpdateCallbackResult {
+ interface OnCheckForUpdateListenerResult {
/** 是否有新版本 */
hasUpdate: boolean
}
- interface OnCompassChangeCallbackResult {
- /** 精度
+ interface OnChunkReceivedListenerResult {
+ /** 返回的chunk buffer */
+ data: ArrayBuffer
+ }
+ interface OnCompassChangeListenerResult {
+ /** 需要基础库: `2.4.0`
*
- * 最低基础库: `2.4.0` */
+ * 精度 */
accuracy: number | string
/** 面对的方向度数 */
direction: number
}
- interface OnCopyUrlCallbackResult {
+ interface OnConnectListenerResult {
+ /** 需要基础库: `3.4.0`
+ *
+ * 网络请求过程中的一些异常信息(例如:TCPSocket.connect 传了 enableHttpDNS: true,但最终未使用 HttpDNS 时,exception 就会说明未使用 HttpDNS 的原因) */
+ exception: Exception
+ /** 需要基础库: `3.4.1`
+ *
+ * 接收端地址信息(目前仅iOS和Android端支持) */
+ localInfo: OnConnectListenerResultLocalInfo
+ /** 需要基础库: `3.4.1`
+ *
+ * 发送端地址信息(目前仅iOS和Android端支持) */
+ remoteInfo: OnConnectListenerResultRemoteInfo
+ /** 需要基础库: `3.4.0`
+ *
+ * 本次连接是否使用了 HttpDNS */
+ useHttpDNS: boolean
+ }
+ /** 需要基础库: `3.4.1`
+ *
+ * 接收端地址信息(目前仅iOS和Android端支持) */
+ interface OnConnectListenerResultLocalInfo {
+ /** 需要基础库: `3.4.1`
+ *
+ * 接收消息的 socket 的地址 */
+ address: string
+ /** 需要基础库: `3.4.1`
+ *
+ * 使用的协议族,为 IPv4 或者 IPv6 */
+ family: string
+ /** 需要基础库: `3.4.1`
+ *
+ * 端口号 */
+ port: number
+ }
+ /** 需要基础库: `3.4.1`
+ *
+ * 发送端地址信息(目前仅iOS和Android端支持) */
+ interface OnConnectListenerResultRemoteInfo {
+ /** 需要基础库: `3.4.1`
+ *
+ * 发送消息的 socket 的地址 */
+ address: string
+ /** 需要基础库: `3.4.1`
+ *
+ * 使用的协议族,为 IPv4 或者 IPv6 */
+ family: string
+ /** 需要基础库: `3.4.1`
+ *
+ * 端口号 */
+ port: number
+ }
+ interface OnCopyUrlListenerResult {
/** 用短链打开小程序时当前页面携带的查询字符串。小程序中使用时,应在进入页面时调用 `wx.onCopyUrl` 自定义 `query`,退出页面时调用 `wx.offCopyUrl`,防止影响其它页面。 */
query: string
}
- interface OnDeviceMotionChangeCallbackResult {
+ interface OnCustomRendererEventCallbackResult {
+ /** 推流高度 */
+ height: number
+ /** 推流宽度 */
+ width: number
+ }
+ interface OnDeviceMotionChangeListenerResult {
/** 当 手机坐标 X/Y 和 地球 X/Y 重合时,绕着 Z 轴转动的夹角为 alpha,范围值为 [0, 2*PI)。逆时针转动为正。 */
alpha: number
/** 当手机坐标 Y/Z 和地球 Y/Z 重合时,绕着 X 轴转动的夹角为 beta。范围值为 [-1*PI, PI) 。顶部朝着地球表面转动为正。也有可能朝着用户为正。 */
@@ -3535,23 +8636,36 @@ innerAudioContext.onError((res) => {
/** 当手机 X/Z 和地球 X/Z 重合时,绕着 Y 轴转动的夹角为 gamma。范围值为 [-1*PI/2, PI/2)。右边朝着地球表面转动为正。 */
gamma: number
}
- interface OnDiscoveredCallbackResult {
- /** NdefMessage 数组,消息格式为 {id: ArrayBuffer, type: ArrayBuffer, payload: ArrayBuffer} */
+ interface OnDiscoveredListenerResult {
+ id: ArrayBuffer
+ /** 可选,NdefMessage 数组,消息格式为 {id: ArrayBuffer, type: ArrayBuffer, payload: ArrayBuffer} */
messages: any[]
/** tech 数组,用于匹配NFC卡片具体可以使用什么标准(NfcA等实例)处理 */
techs: any[]
}
- interface OnFrameRecordedCallbackResult {
+ interface OnEmbeddedMiniProgramHeightChangeListenerResult {
+ /** 可视高度 */
+ height: number
+ /** 半屏小程序初始高度 */
+ initialHeight: number
+ }
+ interface OnFrameRecordedListenerResult {
/** 录音分片数据 */
frameBuffer: ArrayBuffer
/** 当前帧是否正常录音结束前的最后一帧 */
isLastFrame: boolean
}
- interface OnGetWifiListCallbackResult {
+ interface OnGeneratePosterListenerResult {
+ /** 如果该参数存在,则其它的参数将会以 resolve 结果为准,如果3秒内不 resolve,会使用上面传入的默认参数 */
+ promise: IAnyObject
+ /** 开发者生成自定义海报图片的路径,支持网络路径、本地路径 */
+ src: string
+ }
+ interface OnGetWifiListListenerResult {
/** Wi-Fi 列表数据 */
wifiList: WifiInfo[]
}
- interface OnGyroscopeChangeCallbackResult {
+ interface OnGyroscopeChangeListenerResult {
/** x 轴的角速度 */
x: number
/** y 轴的角速度 */
@@ -3559,7 +8673,7 @@ innerAudioContext.onError((res) => {
/** z 轴的角速度 */
z: number
}
- interface OnHCEMessageCallbackResult {
+ interface OnHCEMessageListenerResult {
/** `messageType=1` 时 ,客户端接收到 NFC 设备的指令 */
data: ArrayBuffer
/** 消息类型
@@ -3571,15 +8685,31 @@ innerAudioContext.onError((res) => {
/** `messageType=2` 时,原因 */
reason: number
}
- interface OnHeadersReceivedCallbackResult {
- /** 开发者服务器返回的 HTTP Response Header */
- header: IAnyObject
+ interface OnKeyDownListenerResult {
+ /** 当前是否同时按下了 altKey,同 Web 规范 KeyEvent altKey 属性 */
+ altKey: string
+ /** 按键 code,同 Web 规范 KeyEvent code 属性 */
+ code: string
+ /** 按键名称,同 Web 规范 KeyEvent key 属性 */
+ key: string
+ /** 当前是否同时按下了 shiftKey,同 Web 规范 KeyEvent shiftKey 属性 */
+ shiftKey: string
+ /** 事件触发时的时间戳 */
+ timeStamp: number
}
- interface OnKeyboardHeightChangeCallbackResult {
+ interface OnKeyboardHeightChangeListenerResult {
/** 键盘高度 */
height: number
}
- interface OnLocalServiceFoundCallbackResult {
+ interface OnLazyLoadErrorListenerResult {
+ /** 详细信息 */
+ errMsg: string
+ /** 异步组件所属的分包 */
+ subpackage: any[]
+ /** 'subpackage' 失败类型 */
+ type: string
+ }
+ interface OnLocalServiceFoundListenerResult {
/** 服务的 ip 地址 */
ip: string
/** 服务的端口 */
@@ -3589,35 +8719,39 @@ innerAudioContext.onError((res) => {
/** 服务的类型 */
serviceType: string
}
- interface OnLocalServiceLostCallbackResult {
+ interface OnLocalServiceLostListenerResult {
/** 服务的名称 */
serviceName: string
/** 服务的类型 */
serviceType: string
}
- interface OnLocationChangeCallbackResult {
+ interface OnLocationChangeErrorListenerResult {
+ /** 错误码 */
+ errCode: number
+ }
+ interface OnLocationChangeListenerResult {
/** 位置的精确度 */
accuracy: number
- /** 高度,单位 m
+ /** 需要基础库: `1.2.0`
*
- * 最低基础库: `1.2.0` */
+ * 高度,单位 m */
altitude: number
- /** 水平精度,单位 m
+ /** 需要基础库: `1.2.0`
*
- * 最低基础库: `1.2.0` */
+ * 水平精度,单位 m */
horizontalAccuracy: number
- /** 纬度,范围为 -90~90,负数表示南纬 */
+ /** 纬度,范围为 -90~90,负数表示南纬。使用 gcj02 国测局坐标系 */
latitude: number
- /** 经度,范围为 -180~180,负数表示西经 */
+ /** 经度,范围为 -180~180,负数表示西经。使用 gcj02 国测局坐标系 */
longitude: number
/** 速度,单位 m/s */
speed: number
- /** 垂直精度,单位 m(Android 无法获取,返回 0)
+ /** 需要基础库: `1.2.0`
*
- * 最低基础库: `1.2.0` */
+ * 垂直精度,单位 m(Android 无法获取,返回 0) */
verticalAccuracy: number
}
- interface OnMemoryWarningCallbackResult {
+ interface OnMemoryWarningListenerResult {
/** 内存告警等级,只有 Android 才有,对应系统宏定义
*
* 可选值:
@@ -3626,7 +8760,29 @@ innerAudioContext.onError((res) => {
* - 15: TRIM_MEMORY_RUNNING_CRITICAL; */
level: 5 | 10 | 15
}
- interface OnNetworkStatusChangeCallbackResult {
+ interface OnMenuButtonBoundingClientRectWeightChangeListenerResult {
+ /** 下边界坐标,单位:px */
+ bottom: number
+ /** 高度,单位:px */
+ height: number
+ /** 左边界坐标,单位:px */
+ left: number
+ /** 右边界坐标,单位:px */
+ right: number
+ /** 上边界坐标,单位:px */
+ top: number
+ /** 宽度,单位:px */
+ width: number
+ }
+ interface OnMessageListenerResultLocalInfo {
+ /** 接收消息的 socket 的地址 */
+ address: string
+ /** 使用的协议族,为 IPv4 或者 IPv6 */
+ family: string
+ /** 端口号 */
+ port: number
+ }
+ interface OnNetworkStatusChangeListenerResult {
/** 当前是否有网络连接 */
isConnected: boolean
/** 网络类型
@@ -3636,35 +8792,64 @@ innerAudioContext.onError((res) => {
* - '2g': 2g 网络;
* - '3g': 3g 网络;
* - '4g': 4g 网络;
+ * - '5g': 5g 网络;
* - 'unknown': Android 下不常见的网络类型;
* - 'none': 无网络; */
- networkType: 'wifi' | '2g' | '3g' | '4g' | 'unknown' | 'none'
+ networkType: 'wifi' | '2g' | '3g' | '4g' | '5g' | 'unknown' | 'none'
}
- interface OnOpenCallbackResult {
- /** 连接成功的 HTTP 响应 Header
+ interface OnNetworkWeakChangeListenerResult {
+ /** 当前网络类型 */
+ networkType: string
+ /** 当前是否处于弱网状态 */
+ weakNet: boolean
+ }
+ interface OnOnUserTriggerTranslationListenerResult {
+ /** 翻译到的目标语言 */
+ locale: string
+ /** 触发来源, `button` 表示点击了菜单中的翻译按钮, `capsule` 表示点击了胶囊中的翻译提示 */
+ type: string
+ }
+ interface OnOpenListenerResult {
+ /** 需要基础库: `2.0.0`
*
- * 最低基础库: `2.0.0` */
+ * 连接成功的 HTTP 响应 Header */
header: IAnyObject
- /** 网络请求过程中一些调试信息
+ /** 需要基础库: `2.10.4`
*
- * 最低基础库: `2.10.4` */
+ * 网络请求过程中一些调试信息 */
profile: SocketProfile
}
- interface OnPageNotFoundCallbackResult {
+ interface OnPageNotFoundListenerResult {
/** 是否本次启动的首个页面(例如从分享等入口进来,首个页面是开发者配置的分享页面) */
isEntryPage: boolean
/** 不存在页面的路径 (代码包路径) */
path: string
/** 打开不存在页面的 query 参数 */
- query: IAnyObject
+ query: Record
}
- interface OnSocketOpenCallbackResult {
- /** 连接成功的 HTTP 响应 Header
+ interface OnParallelStateChangeListenerResult {
+ /** 当前是否分栏 */
+ isOnParallel: boolean
+ /** 分栏左侧页面对象(非分栏状态时返回当前页面) */
+ leftPage: Page.TrivialInstance
+ /** 分栏右侧页面对象(非分栏状态时返回当前页面) */
+ rightPage: Page.TrivialInstance
+ }
+ interface OnScreenRecordingStateChangedListenerResult {
+ /** 录屏状态
*
- * 最低基础库: `2.0.0` */
+ * 可选值:
+ * - 'start': 开始录屏;
+ * - 'stop': 结束录屏; */
+ state: 'start' | 'stop'
+ }
+ interface OnSocketOpenListenerResult {
+ /** 需要基础库: `2.0.0`
+ *
+ * 连接成功的 HTTP 响应 Header */
header: IAnyObject
}
- interface OnStopCallbackResult {
+ interface OnStopListenerResult {
/** 录音总时长,单位:ms */
duration: number
/** 录音文件大小,单位:Byte */
@@ -3672,7 +8857,7 @@ innerAudioContext.onError((res) => {
/** 录音文件的临时路径 (本地路径) */
tempFilePath: string
}
- interface OnThemeChangeCallbackResult {
+ interface OnThemeChangeListenerResult {
/** 系统当前的主题,取值为`light`或`dark`
*
* 可选值:
@@ -3680,19 +8865,29 @@ innerAudioContext.onError((res) => {
* - 'light': 浅色主题; */
theme: 'dark' | 'light'
}
- interface OnUnhandledRejectionCallbackResult {
+ interface OnUnhandledRejectionListenerResult {
/** 被拒绝的 Promise 对象 */
promise: Promise
/** 拒绝原因,一般是一个 Error 对象 */
reason: string
}
- interface OnVoIPChatInterruptedCallbackResult {
+ interface OnUserCaptureScreenListenerResult {
+ /** 需要基础库: `3.3.0`
+ *
+ * 如果该参数存在,则其它的参数将会以 resolve 结果为准,如果一秒内不 resolve,分享会使用上面传入的默认参数 */
+ promise?: Promise
+ /** 需要基础库: `3.3.0`
+ *
+ * 支持开发者自定义一键打开小程序时的 query */
+ query?: string
+ }
+ interface OnVoIPChatInterruptedListenerResult {
/** 错误码 */
errCode: number
/** 调用结果(错误原因) */
errMsg: string
}
- interface OnVoIPChatMembersChangedCallbackResult {
+ interface OnVoIPChatMembersChangedListenerResult {
/** 错误码 */
errCode: number
/** 调用结果 */
@@ -3700,7 +8895,7 @@ innerAudioContext.onError((res) => {
/** 还在实时语音通话中的成员 openId 名单 */
openIdList: string[]
}
- interface OnVoIPChatSpeakersChangedCallbackResult {
+ interface OnVoIPChatSpeakersChangedListenerResult {
/** 错误码 */
errCode: number
/** 调用结果(错误原因) */
@@ -3708,7 +8903,17 @@ innerAudioContext.onError((res) => {
/** 还在实时语音通话中的成员 openId 名单 */
openIdList: string[]
}
- interface OnVoIPVideoMembersChangedCallbackResult {
+ interface OnVoIPChatStateChangedListenerResult {
+ /** 事件码 */
+ code: number
+ /** 附加信息 */
+ data: IAnyObject
+ /** 错误码 */
+ errCode: number
+ /** 调用结果 */
+ errMsg: string
+ }
+ interface OnVoIPVideoMembersChangedListenerResult {
/** 错误码 */
errCode: number
/** 调用结果 */
@@ -3716,27 +8921,48 @@ innerAudioContext.onError((res) => {
/** 开启视频的成员名单 */
openIdList: string[]
}
- interface OnWifiConnectedCallbackResult {
+ interface OnWifiConnectedListenerResult {
/** [WifiInfo](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/WifiInfo.html)
*
* Wi-Fi 信息 */
wifi: WifiInfo
}
- interface OnWindowResizeCallbackResult {
+ interface OnWifiConnectedWithPartialInfoListenerResult {
+ /** [WifiInfo](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/WifiInfo.html)
+ *
+ * 只包含 SSID 属性的 WifiInfo 对象 */
+ wifi: WifiInfo
+ }
+ interface OnWindowResizeListenerResult {
size: Size
}
+ interface OnWindowStateChangeListenerResult {
+ /** 改变的窗口状态,可能的值为:
+ * - 'minimize':窗口最小化
+ * - 'normalize':窗口恢复正常尺寸
+ * - 'maximize':窗口最大化 */
+ state: string
+ }
+ interface OpenAppAuthorizeSettingOption {
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: OpenAppAuthorizeSettingCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: OpenAppAuthorizeSettingFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: OpenAppAuthorizeSettingSuccessCallback
+ }
interface OpenBluetoothAdapterOption {
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: OpenBluetoothAdapterCompleteCallback
/** 接口调用失败的回调函数 */
fail?: OpenBluetoothAdapterFailCallback
- /** 蓝牙模式,可作为主/从设备,仅 iOS 需要。
+ /** 需要基础库: `2.10.0`
+ *
+ * 蓝牙模式,可作为主/从设备,仅 iOS 需要。
*
* 可选值:
* - 'central': 主机模式;
- * - 'peripheral': 从机模式;
- *
- * 最低基础库: `2.10.0` */
+ * - 'peripheral': 从机(外围设备)模式; */
mode?: 'central' | 'peripheral'
/** 接口调用成功的回调函数 */
success?: OpenBluetoothAdapterSuccessCallback
@@ -3758,6 +8984,104 @@ innerAudioContext.onError((res) => {
/** 由 [wx.addCard](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/card/wx.addCard.html) 的返回对象中的加密 code 通过解密后得到,解密请参照:[code 解码接口](https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1499332673_Unm7V) */
code: string
}
+ interface OpenChannelsActivityOption {
+ /** 视频 feedId */
+ feedId: string
+ /** 视频号 id,以“sph”开头的id,可在视频号助手获取 */
+ finderUserName: string
+ /** 视频号的Feed的nonceId,必填 */
+ nonceId: string
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: OpenChannelsActivityCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: OpenChannelsActivityFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: OpenChannelsActivitySuccessCallback
+ }
+ interface OpenChannelsEventOption {
+ /** 活动 id */
+ eventId: string
+ /** 视频号 id,以“sph”开头的id,可在视频号助手获取 */
+ finderUserName: string
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: OpenChannelsEventCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: OpenChannelsEventFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: OpenChannelsEventSuccessCallback
+ }
+ interface OpenChannelsLiveOption {
+ /** 视频号 id,以“sph”开头的id,可在视频号助手获取 */
+ finderUserName: string
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: OpenChannelsLiveCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: OpenChannelsLiveFailCallback
+ /** 直播 feedId,通过 getChannelsLiveInfo 接口获取(基础库 v2.19.2 之前的版本需要填写) */
+ feedId?: string
+ /** 直播 nonceId,通过 getChannelsLiveInfo 接口获取(基础库 v2.19.2 之前的版本需要填写) */
+ nonceId?: string
+ /** 接口调用成功的回调函数 */
+ success?: OpenChannelsLiveSuccessCallback
+ }
+ interface OpenChannelsUserProfileOption {
+ /** 视频号id(参考格式为:sphcqO59YEPCvoe;查看路径为:微信客户端->我tab->视频号->右上角.->视频号名字-视频号ID) */
+ finderUserName: string
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: OpenChannelsUserProfileCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: OpenChannelsUserProfileFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: OpenChannelsUserProfileSuccessCallback
+ }
+ interface OpenChatToolOption {
+ /** 聊天工具分包内的页面路径 */
+ url: string
+ /** 群聊类型
+ *
+ * 可选值:
+ * - 1: 微信联系人单聊;
+ * - 2: 企业微信联系人单聊;
+ * - 3: 普通微信群聊;
+ * - 4: 企业微信互通群聊; */
+ chatType?: 1 | 2 | 3 | 4
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: OpenChatToolCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: OpenChatToolFailCallback
+ /** 聊天室 id,不传则拉起群选择框,可以传入多聊群的 opengid 值,或者单聊群的 open_single_roomid 值 */
+ roomid?: string
+ /** 接口调用成功的回调函数 */
+ success?: OpenChatToolSuccessCallback
+ }
+ /** OpenContainer 实例,可通过 [SelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html) 获取。
+ *
+ * [OpenContainer](https://developers.weixin.qq.com/miniprogram/dev/api/skyline/OpenContainer.html) 可以作为`withOpenContainer`参数传入`navigateTo`以执行该OpenContainer的路由动画。
+ *
+ * **示例代码**
+ *
+ * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/G3tm7gmP8144) */
+ interface OpenContainer {}
+ interface OpenCustomerServiceChatOption {
+ /** 企业ID */
+ corpId: string
+ /** 客服信息 */
+ extInfo: ExtInfoOption
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: OpenCustomerServiceChatCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: OpenCustomerServiceChatFailCallback
+ /** 气泡消息图片 */
+ sendMessageImg?: string
+ /** 气泡消息小程序路径 */
+ sendMessagePath?: string
+ /** 气泡消息标题 */
+ sendMessageTitle?: string
+ /** 是否发送小程序气泡消息 */
+ showMessageCard?: boolean
+ /** 接口调用成功的回调函数 */
+ success?: OpenCustomerServiceChatSuccessCallback
+ }
interface OpenDocumentOption {
/** 文件路径 (本地路径) ,可通过 downloadFile 获得 */
filePath: string
@@ -3765,7 +9089,9 @@ innerAudioContext.onError((res) => {
complete?: OpenDocumentCompleteCallback
/** 接口调用失败的回调函数 */
fail?: OpenDocumentFailCallback
- /** 文件类型,指定文件类型打开文件
+ /** 需要基础库: `1.4.0`
+ *
+ * 文件类型,指定文件类型打开文件
*
* 可选值:
* - 'doc': doc 格式;
@@ -3774,17 +9100,75 @@ innerAudioContext.onError((res) => {
* - 'xlsx': xlsx 格式;
* - 'ppt': ppt 格式;
* - 'pptx': pptx 格式;
- * - 'pdf': pdf 格式;
- *
- * 最低基础库: `1.4.0` */
+ * - 'pdf': pdf 格式; */
fileType?: 'doc' | 'docx' | 'xls' | 'xlsx' | 'ppt' | 'pptx' | 'pdf'
- /** 是否显示右上角菜单
+ /** 需要基础库: `2.11.0`
*
- * 最低基础库: `2.11.0` */
+ * 是否显示右上角菜单 */
showMenu?: boolean
/** 接口调用成功的回调函数 */
success?: OpenDocumentSuccessCallback
}
+ interface OpenEmbeddedMiniProgramOption {
+ /** 要打开的小程序 appId */
+ appId: string
+ /** 需要基础库: `2.33.0`
+ *
+ * 打开的小程序是否支持全屏。基础库 `3.10.0` 版本起,强制为 true */
+ allowFullScreen?: boolean
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: OpenEmbeddedMiniProgramCompleteCallback
+ /** 要打开的小程序版本。仅在当前小程序为开发版或体验版时此参数有效。如果当前小程序是正式版,则打开的小程序必定是正式版。
+ *
+ * 可选值:
+ * - 'develop': 开发版;
+ * - 'trial': 体验版;
+ * - 'release': 正式版; */
+ envVersion?: 'develop' | 'trial' | 'release'
+ /** 需要传递给目标小程序的数据,目标小程序可在 `App.onLaunch`,`App.onShow` 中获取到这份数据。如果跳转的是小游戏,可以在 [wx.onShow](#)、[wx.getLaunchOptionsSync](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/life-cycle/wx.getLaunchOptionsSync.html) 中可以获取到这份数据数据。 */
+ extraData?: IAnyObject
+ /** 接口调用失败的回调函数 */
+ fail?: OpenEmbeddedMiniProgramFailCallback
+ /** 需要基础库: `2.24.0`
+ *
+ * 不reLaunch目标小程序,直接打开目标跳转的小程序退后台时的页面,需满足以下条件:1. 目标跳转的小程序生命周期未被销毁;2. 且目标当次启动的path、query与上次启动相同,apiCategory以wx.getApiCategory接口的返回结果为准。 */
+ noRelaunchIfPathUnchanged?: boolean
+ /** 打开的页面路径,如果为空则打开首页。path 中 ? 后面的部分会成为 query,在小程序的 `App.onLaunch`、`App.onShow` 和 `Page.onLoad` 的回调函数或小游戏的 [wx.onShow](#) 回调函数、[wx.getLaunchOptionsSync](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/life-cycle/wx.getLaunchOptionsSync.html) 中可以获取到 query 数据。对于小游戏,可以只传入 query 部分,来实现传参效果,如:传入 "?foo=bar"。 */
+ path?: string
+ /** 小程序链接,当传递该参数后,可以不传 appId 和 path。链接可以通过【小程序菜单】->【复制链接】获取。仅 verify=binding 支持。 */
+ shortLink?: string
+ /** 接口调用成功的回调函数 */
+ success?: OpenEmbeddedMiniProgramSuccessCallback
+ /** 需要基础库: `2.24.3`
+ *
+ * 校验方式。
+ *
+ * 可选值:
+ * - 'binding': 校验小程序管理后台的绑定关系。;
+ * - 'unionProduct': 校验目标打开链接是否为[小程序联盟](https://developers.weixin.qq.com/doc/ministore/union/brief-introduction.html)商品。; */
+ verify?: 'binding' | 'unionProduct'
+ }
+ interface OpenHKOfflinePayViewOption {
+ /** 随机字符串,长度为32个字符以下 */
+ nonceStr: string
+ /** 业务数据包,开发者目前无需感知,直接传空字符串即可 */
+ package: string
+ /** 签名,具体见微信支付文档 */
+ paySign: string
+ /** 时间戳,从 1970 年 1 月 1 日 00:00:00 至今的秒数,即当前的时间 */
+ timeStamp: string
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: OpenHKOfflinePayViewCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: OpenHKOfflinePayViewFailCallback
+ /** 签名算法,应与后台下单时的值一致,目前仅支持 SHA1
+ *
+ * 可选值:
+ * - 'SHA1': SHA1签名算法; */
+ signType?: 'SHA1'
+ /** 接口调用成功的回调函数 */
+ success?: OpenHKOfflinePayViewSuccessCallback
+ }
interface OpenLocationOption {
/** 纬度,范围为-90~90,负数表示南纬。使用 gcj02 国测局坐标系 */
latitude: number
@@ -3814,9 +9198,120 @@ innerAudioContext.onError((res) => {
complete?: OpenMapAppCompleteCallback
/** 接口调用失败的回调函数 */
fail?: OpenMapAppFailCallback
+ /** 传递给地图App的poi参数 */
+ poiId?: PoiObj
+ /** 指定推荐使用的地图 App
+ *
+ * 可选值:
+ * - 'baidu': 百度地图;
+ * - 'google': 谷歌地图;
+ * - 'amap': 高德地图;
+ * - 'tencent': 腾讯地图;
+ * - 'petal': 花瓣地图;
+ * - 'apple': 苹果地图; */
+ preferApplication?:
+ | 'baidu'
+ | 'google'
+ | 'amap'
+ | 'tencent'
+ | 'petal'
+ | 'apple'
/** 接口调用成功的回调函数 */
success?: OpenMapAppSuccessCallback
}
+ interface OpenMethodPickerOption {
+ /** 交易金额对象 */
+ amount: AmountOption
+ }
+ interface OpenOfficialAccountArticleFailCallbackErr {
+ /** 错误码 */
+ errCode: number
+ /** 错误信息 */
+ errMsg: string
+ }
+ interface OpenOfficialAccountArticleOption {
+ /** 需要打开的公众号地址 */
+ url: string
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: OpenOfficialAccountArticleCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: OpenOfficialAccountArticleFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: OpenOfficialAccountArticleSuccessCallback
+ }
+ interface OpenOfficialAccountArticleSuccessCallbackResult {
+ /** 为 true 时,表示用户点击了取消(用于 Android 系统区分点击蒙层关闭还是点击取消按钮关闭) */
+ cancel: boolean
+ /** 为 true 时,表示用户点击了确定按钮 */
+ confirm: boolean
+ errMsg: string
+ }
+ interface OpenOfficialAccountChatOption {
+ /** 需要打开的公众号的微信号 */
+ username: string
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: OpenOfficialAccountChatCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: OpenOfficialAccountChatFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: OpenOfficialAccountChatSuccessCallback
+ }
+ interface OpenOfficialAccountProfileOption {
+ /** 需要打开的公众号的原始 ID */
+ username: string
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: OpenOfficialAccountProfileCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: OpenOfficialAccountProfileFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: OpenOfficialAccountProfileSuccessCallback
+ }
+ interface OpenOption {
+ /** 文件路径 (本地路径) */
+ filePath: string
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: OpenCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: OpenFailCallback
+ /** 文件系统标志,默认值: 'r'
+ *
+ * 可选值:
+ * - 'a': 打开文件用于追加。 如果文件不存在,则创建该文件;
+ * - 'ax': 类似于 'a',但如果路径存在,则失败;
+ * - 'a+': 打开文件用于读取和追加。 如果文件不存在,则创建该文件;
+ * - 'ax+': 类似于 'a+',但如果路径存在,则失败;
+ * - 'as': 打开文件用于追加(在同步模式中)。 如果文件不存在,则创建该文件;
+ * - 'as+': 打开文件用于读取和追加(在同步模式中)。 如果文件不存在,则创建该文件;
+ * - 'r': 打开文件用于读取。 如果文件不存在,则会发生异常;
+ * - 'r+': 打开文件用于读取和写入。 如果文件不存在,则会发生异常;
+ * - 'w': 打开文件用于写入。 如果文件不存在则创建文件,如果文件存在则截断文件;
+ * - 'wx': 类似于 'w',但如果路径存在,则失败;
+ * - 'w+': 打开文件用于读取和写入。 如果文件不存在则创建文件,如果文件存在则截断文件;
+ * - 'wx+': 类似于 'w+',但如果路径存在,则失败; */
+ flag?:
+ | 'a'
+ | 'ax'
+ | 'a+'
+ | 'ax+'
+ | 'as'
+ | 'as+'
+ | 'r'
+ | 'r+'
+ | 'w'
+ | 'wx'
+ | 'w+'
+ | 'wx+'
+ /** 接口调用成功的回调函数 */
+ success?: OpenSuccessCallback
+ }
+ interface OpenPrivacyContractOption {
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: OpenPrivacyContractCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: OpenPrivacyContractFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: OpenPrivacyContractSuccessCallback
+ }
interface OpenSettingOption {
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: OpenSettingCompleteCallback
@@ -3824,9 +9319,9 @@ innerAudioContext.onError((res) => {
fail?: OpenSettingFailCallback
/** 接口调用成功的回调函数 */
success?: OpenSettingSuccessCallback
- /** 是否同时获取用户订阅消息的订阅状态,默认不获取。注意:withSubscriptions 只返回用户勾选过订阅面板中的“总是保持以上选择,不再询问”的订阅消息。
+ /** 需要基础库: `2.10.3`
*
- * 最低基础库: `2.10.3` */
+ * 是否同时获取用户订阅消息的订阅状态,默认不获取。注意:withSubscriptions 只返回用户勾选过订阅面板中的“总是保持以上选择,不再询问”的订阅消息。 */
withSubscriptions?: boolean
}
interface OpenSettingSuccessCallbackResult {
@@ -3836,15 +9331,145 @@ innerAudioContext.onError((res) => {
authSetting: AuthSetting
/** [SubscriptionsSetting](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/setting/SubscriptionsSetting.html)
*
- * 用户订阅消息设置,接口参数`withSubscriptions`值为`true`时才会返回。
+ * 需要基础库: `2.10.3`
*
- * 最低基础库: `2.10.3` */
+ * 用户订阅消息设置,接口参数`withSubscriptions`值为`true`时才会返回。 */
subscriptionsSetting: SubscriptionsSetting
errMsg: string
}
+ interface OpenSingleStickerViewOption {
+ /** 表情链接,可前往[表情开放平台](https://sticker.weixin.qq.com/cgi-bin/mmemoticon-bin/loginpage?t=login/index),在详情页中的「小程序跳转链接」入口复制 */
+ url: string
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: OpenSingleStickerViewCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: OpenSingleStickerViewFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: OpenSingleStickerViewSuccessCallback
+ }
+ interface OpenStickerIPViewOption {
+ /** 表情IP合辑链接,可前往[表情开放平台](https://sticker.weixin.qq.com/cgi-bin/mmemoticon-bin/loginpage?t=login/index),在详情页中的「小程序跳转链接」入口复制 */
+ url: string
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: OpenStickerIPViewCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: OpenStickerIPViewFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: OpenStickerIPViewSuccessCallback
+ }
+ interface OpenStickerSetViewOption {
+ /** 表情专辑链接,可前往[表情开放平台](https://sticker.weixin.qq.com/cgi-bin/mmemoticon-bin/loginpage?t=login/index),在详情页中的「小程序跳转链接」入口复制 */
+ url: string
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: OpenStickerSetViewCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: OpenStickerSetViewFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: OpenStickerSetViewSuccessCallback
+ }
+ interface OpenStoreCouponDetailFailCallbackResult {
+ /** 错误码 */
+ code: number
+ /** 错误信息 */
+ message: string
+ }
+ interface OpenStoreCouponDetailOption {
+ /** 优惠券id,可以通过[小店后台](https://store.weixin.qq.com/shop/marketing/coupon)获取 */
+ couponId: string
+ /** 需要基础库: `3.8.11`
+ *
+ * 推客参数,可以通过[接口](https://developers.weixin.qq.com/doc/store/leagueheadsupplier/API/promotion/content/coupon/getcouponpromotersharelink.html)获取。 */
+ promoterShareLink: string
+ /** 小店appid,可以通过[小店后台](https://store.weixin.qq.com/shop/setting/home)获取 */
+ shopAppid: string
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: OpenStoreCouponDetailCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: OpenStoreCouponDetailFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: OpenStoreCouponDetailSuccessCallback
+ }
+ interface OpenStoreOrderDetailFailCallbackResult {
+ /** 错误码
+ *
+ * 可选值:
+ * - -1: 系统失败;
+ * - 0: 成功;
+ * - 1001: 缺少必要参数;
+ * - 1002: 网络错误;
+ * - 817323001: 合作账号订单id不合法;
+ * - 817323002: 无法获取该订单;
+ * - 817323003: 当前小程序不是绑定的合作账号; */
+ code: -1 | 0 | 1001 | 1002 | 817323001 | 817323002 | 817323003
+ /** 错误信息 */
+ message: string
+ }
+ interface OpenStoreOrderDetailOption {
+ /** 订单id,通过[回调事件](https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/cooperation_shop/order_callback.html#%E4%BA%94%E3%80%81%E5%90%88%E4%BD%9C%E8%B4%A6%E5%8F%B7%E5%BA%97%E9%93%BA%E8%AE%A2%E5%8D%95%E9%80%9A%E7%9F%A5%E4%BA%8B%E4%BB%B6)获取 */
+ orderId: string
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: OpenStoreOrderDetailCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: OpenStoreOrderDetailFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: OpenStoreOrderDetailSuccessCallback
+ }
+ interface OpenSuccessCallbackResult {
+ /** 文件描述符 */
+ fd: string
+ errMsg: string
+ }
+ interface OpenSyncOption {
+ /** 文件路径 (本地路径) */
+ filePath: string
+ /** 文件系统标志,默认值: 'r'
+ *
+ * 可选值:
+ * - 'a': 打开文件用于追加。 如果文件不存在,则创建该文件;
+ * - 'ax': 类似于 'a',但如果路径存在,则失败;
+ * - 'a+': 打开文件用于读取和追加。 如果文件不存在,则创建该文件;
+ * - 'ax+': 类似于 'a+',但如果路径存在,则失败;
+ * - 'as': 打开文件用于追加(在同步模式中)。 如果文件不存在,则创建该文件;
+ * - 'as+': 打开文件用于读取和追加(在同步模式中)。 如果文件不存在,则创建该文件;
+ * - 'r': 打开文件用于读取。 如果文件不存在,则会发生异常;
+ * - 'r+': 打开文件用于读取和写入。 如果文件不存在,则会发生异常;
+ * - 'w': 打开文件用于写入。 如果文件不存在则创建文件,如果文件存在则截断文件;
+ * - 'wx': 类似于 'w',但如果路径存在,则失败;
+ * - 'w+': 打开文件用于读取和写入。 如果文件不存在则创建文件,如果文件存在则截断文件;
+ * - 'wx+': 类似于 'w+',但如果路径存在,则失败; */
+ flag?:
+ | 'a'
+ | 'ax'
+ | 'a+'
+ | 'ax+'
+ | 'as'
+ | 'as+'
+ | 'r'
+ | 'r+'
+ | 'w'
+ | 'wx'
+ | 'w+'
+ | 'wx+'
+ }
+ interface OpenSystemBluetoothSettingOption {
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: OpenSystemBluetoothSettingCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: OpenSystemBluetoothSettingFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: OpenSystemBluetoothSettingSuccessCallback
+ }
interface OpenVideoEditorOption {
/** 视频源的路径,只支持本地路径 */
filePath: string
+ /** 需要基础库: `2.16.1`
+ *
+ * 视频裁剪的最大长度 */
+ maxDuration: string
+ /** 需要基础库: `2.16.1`
+ *
+ * 视频裁剪的最小长度 */
+ minDuration: string
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: OpenVideoEditorCompleteCallback
/** 接口调用失败的回调函数 */
@@ -3870,19 +9495,19 @@ innerAudioContext.onError((res) => {
duration?: number
/** 接口调用失败的回调函数 */
fail?: PageScrollToFailCallback
+ /** 需要基础库: `2.23.1`
+ *
+ * 偏移距离,需要和 selector 参数搭配使用,可以滚动到 selector 加偏移距离的位置,单位 px */
+ offsetTop?: number
/** 滚动到页面的目标位置,单位 px */
scrollTop?: number
- /** 选择器
+ /** 需要基础库: `2.7.3`
*
- * 最低基础库: `2.7.3` */
+ * 选择器 */
selector?: string
/** 接口调用成功的回调函数 */
success?: PageScrollToSuccessCallback
}
- /** Canvas 2D API 的接口 Path2D 用来声明路径,此路径稍后会被CanvasRenderingContext2D 对象使用。CanvasRenderingContext2D 接口的 路径方法 也存在于 Path2D 这个接口中,允许你在 canvas 中根据需要创建可以保留并重用的路径。
- *
- * 最低基础库: `2.11.0` */
- interface Path2D {}
interface PauseBGMOption {
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: PauseBGMCompleteCallback
@@ -3915,20 +9540,175 @@ innerAudioContext.onError((res) => {
/** 接口调用成功的回调函数 */
success?: PauseVoiceSuccessCallback
}
- /** PerformanceObserver 对象, 用于监听性能相关事件
+ /** 单条性能数据。具体数据口径请参考[性能数据文档]((performance/perf_data##_1-4-%E9%80%9A%E8%BF%87-wx-getPerformance-%E5%9C%A8%E5%B0%8F%E7%A8%8B%E5%BA%8F%E5%86%85%E8%8E%B7%E5%8F%96)) */
+ interface PerformanceEntry {
+ /** 需要基础库: `2.24.0`
+ *
+ * 解析域名结束时间。仅 resourceTiming 指标有效。 */
+ domainLookupEnd: number
+ /** 需要基础库: `2.24.0`
+ *
+ * 解析域名开始时间。仅 resourceTiming 指标有效。 */
+ domainLookupStart: number
+ /** 耗时 ms。仅对于表示阶段的指标有效。 */
+ duration: number
+ /** 指标类型
+ *
+ * 可选值:
+ * - 'navigation': 路由;
+ * - 'render': 渲染;
+ * - 'script': 脚本; */
+ entryType: 'navigation' | 'render' | 'script'
+ /** 需要基础库: `2.21.2`
+ *
+ * 注入文件列表。仅 evaluateScript 指标有效。 */
+ fileList: string[]
+ /** 需要基础库: `2.21.2`
+ *
+ * 首次渲染参数在渲染层收到的时间。仅 firstRender 指标有效。 */
+ initDataRecvTime: number
+ /** 需要基础库: `2.21.2`
+ *
+ * 首次渲染参数从逻辑层发出的时间。仅 firstRender 指标有效。 */
+ initDataSendTime: number
+ /** 需要基础库: `2.24.0`
+ *
+ * 初始化性能条目的资源类型。仅 resourceTiming 指标有效。
+ *
+ * 可选值:
+ * - 'audio': 音频;
+ * - 'cover-image': cover-image 组件的图片;
+ * - 'image': 组件的图片;
+ * - 'open-data': 组件的图片; */
+ initiatorType: 'audio' | 'cover-image' | 'image' | 'open-data'
+ /** 分包名,主包表示为 __APP__ (2.21.2 开始)。仅 evaluateScript 指标有效。 */
+ moduleName: string
+ /** 指标名称
+ *
+ * 可选值:
+ * - 'appLaunch': 小程序启动耗时。(entryType: navigation);
+ * - 'route': 路由处理耗时。(entryType: navigation);
+ * - 'firstRender': 页面首次渲染耗时。(entryType: render);
+ * - 'firstPaint': 页面首次绘制(FP)时间点,无 duration。(iOS 不支持)(entryType: render);
+ * - 'firstContentfulPaint': 页面首次内容绘制(FCP)时间点,无 duration。(iOS 14.5 以下版本不支持)(entryType: render);
+ * - 'largestContentfulPaint': 页面最大内容绘制(LCP)时间点,无 duration。(iOS 不支持)(entryType: render);
+ * - 'evaluateScript': 逻辑层 JS 代码注入耗时。(entryType: script);
+ * - 'downloadPackage': 代码包下载耗时。(entryType: loadPackage);
+ * - 'resourceTiming': 视图层资源加载耗时。(entryType: resource); */
+ name:
+ | 'appLaunch'
+ | 'route'
+ | 'firstRender'
+ | 'firstPaint'
+ | 'firstContentfulPaint'
+ | 'largestContentfulPaint'
+ | 'evaluateScript'
+ | 'downloadPackage'
+ | 'resourceTiming'
+ /** 路由真正响应开始时间。仅 navigation 类型指标有效。 */
+ navigationStart: number
+ /** 路由详细类型,与小程序路由方法对应。仅 navigation 类型指标有效。 */
+ navigationType: string
+ /** 需要基础库: `2.24.0`
+ *
+ * 代码包名称。仅 downloadPackage 指标有效。 */
+ packageName: string
+ /** 需要基础库: `2.24.0`
+ *
+ * 代码包大小。仅 downloadPackage 指标有效。 */
+ packageSize: number
+ /** 需要基础库: `2.23.1`
+ *
+ * path 对应页面实例 Id(随机生成,不保证递增)。仅 render/navigation 指标有效。 */
+ pageId: number
+ /** 页面路径。仅 render 和 navigation 类型指标有效。 */
+ path: string
+ /** 需要基础库: `2.23.1`
+ *
+ * referrerPath对应页面实例 Id(随机生成,不保证递增)。仅 route 指标有效。 */
+ referrerPageId: number
+ /** 需要基础库: `2.23.1`
+ *
+ * 页面跳转来源页面路径。仅 route 指标有效。 */
+ referrerPath: number
+ /** 开始时间,不同指标的具体含义会有差异。 */
+ startTime: number
+ /** 需要基础库: `2.24.0`
+ *
+ * 表示获取资源的大小(以八位字节为单位)的数字。仅 resourceTiming 指标有效。(iOS 不支持) */
+ transferSize: number
+ /** 需要基础库: `2.24.0`
+ *
+ * 资源路径。仅 resourceTiming 指标有效。 */
+ uri: string
+ /** 需要基础库: `2.21.2`
+ *
+ * 渲染层代码注入完成时间。仅 firstRender 指标有效。 */
+ viewLayerReadyTime: number
+ /** 需要基础库: `2.21.2`
+ *
+ * 渲染层执行渲染结束时间。仅 firstRender 指标有效。 */
+ viewLayerRenderEndTime: number
+ /** 需要基础库: `2.21.2`
+ *
+ * 渲染层执行渲染开始时间。仅 firstRender 指标有效。 */
+ viewLayerRenderStartTime: number
+ }
+ /** 需要基础库: `2.11.0`
*
- * 最低基础库: `2.11.0` */
+ * PerformanceObserver 对象,用于监听性能相关事件 */
interface PerformanceObserver {
/** 获取当前支持的所有性能指标类型 */
supportedEntryTypes: any[]
+ /** [PerformanceObserver.disconnect()](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/PerformanceObserver.disconnect.html)
+ *
+ * 需要基础库: `2.11.0`
+ *
+ * 在插件中使用:不支持
+ *
+ * 停止监听 */
+ disconnect(): void
+ /** [PerformanceObserver.observe(Object options)](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/PerformanceObserver.observe.html)
+ *
+ * 需要基础库: `2.11.0`
+ *
+ * 在插件中使用:不支持
+ *
+ * 开始监听 */
+ observe(
+ /** 设置 type 监听单个类型的指标,设置 entryTypes 监听多个类型指标。 */
+ options: ObserveOption
+ ): void
+ }
+ /** 平面跟踪配置 */
+ interface PlaneTrack {
+ /** 平面跟踪配置模式
+ *
+ * 可选值:
+ * - 1: 检测横向平面;
+ * - 2: 检测纵向平面,只有 v2 版本支持;
+ * - 3: 检测横向和纵向平面,只有 v2 版本支持; */
+ mode: 1 | 2 | 3
+ /** 需要基础库: `3.6.5`
+ *
+ * 是否开启强制使用V2的模式,只有 v2 版本支持 */
+ force?: boolean
}
interface PlayBGMOption {
/** 加入背景混音的资源地址 */
url: string
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: PlayBGMCompleteCallback
+ /** 需要基础库: `2.31.0`
+ *
+ * BGM结束播放时间点,单位ms,0代表播放至文件结尾,若入参为负或超过文件长度,则默认播放至文件结尾 */
+ endTimeMs?: number
/** 接口调用失败的回调函数 */
fail?: PlayBGMFailCallback
+ /** 需要基础库: `2.31.0`
+ *
+ * BGM开始播时间点,单位ms,若入参为负或超过文件长度,则默认从文件开头进行播放 */
+ startTimeMs?: number
/** 接口调用成功的回调函数 */
success?: PlayBGMSuccessCallback
}
@@ -3959,22 +9739,97 @@ innerAudioContext.onError((res) => {
filePath: string
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: PlayVoiceCompleteCallback
- /** 指定播放时长,到达指定的播放时长后会自动停止播放,单位:秒
+ /** 需要基础库: `1.6.0`
*
- * 最低基础库: `1.6.0` */
+ * 指定播放时长,到达指定的播放时长后会自动停止播放,单位:秒 */
duration?: number
/** 接口调用失败的回调函数 */
fail?: PlayVoiceFailCallback
/** 接口调用成功的回调函数 */
success?: PlayVoiceSuccessCallback
}
- /** 插件帐号信息(仅在插件中调用时包含这一项) */
+ /** 插件账号信息(仅在插件中调用时包含这一项) */
interface Plugin {
/** 插件 appId */
appId: string
/** 插件版本号 */
version: string
}
+ interface PluginLoginOption {
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: PluginLoginCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: PluginLoginFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: PluginLoginSuccessCallback
+ }
+ interface PluginLoginSuccessCallbackResult {
+ /** 用于换取 openpid 的凭证(有效期五分钟)。插件开发者可以用此 code 在开发者服务器后台调用 [getPluginOpenPId](https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/user-info/basic-info/getPluginOpenPId.html) 换取 openpid。 */
+ code: string
+ errMsg: string
+ }
+ /** 传递给地图App的poi参数 */
+ interface PoiObj {
+ /** 高德地图 */
+ amap?: string
+ /** 苹果地图 */
+ apple?: string
+ /** 百度地图 */
+ baidu?: string
+ /** 谷歌地图 */
+ google?: string
+ /** 花瓣地图 */
+ petal?: string
+ /** 腾讯地图 */
+ tencent?: string
+ }
+ interface PostMessageToReferrerMiniProgramOption {
+ /** 需要返回的数据 */
+ extraData?: IAnyObject
+ }
+ interface PreDownloadSubpackageOption {
+ /** 分包的类型。目前仅支持填 "workers",表示 workers 分包。 */
+ packageType: string
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: PreDownloadSubpackageCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: PreDownloadSubpackageFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: PreDownloadSubpackageSuccessCallback
+ }
+ interface PreDownloadSubpackageTaskOnProgressUpdateListenerResult {
+ /** 分包下载进度百分比 */
+ progress: number
+ /** 预期需要下载的数据总长度,单位 Bytes */
+ totalBytesExpectedToWrite: number
+ /** 已经下载的数据长度,单位 Bytes */
+ totalBytesWritten: number
+ }
+ interface PreloadAssetsOption {
+ data: Asset[]
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: PreloadAssetsCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: PreloadAssetsFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: PreloadAssetsSuccessCallback
+ }
+ interface PreloadSkylineViewOption {
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: PreloadSkylineViewCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: PreloadSkylineViewFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: PreloadSkylineViewSuccessCallback
+ }
+ interface PreloadWebviewOption {
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: PreloadWebviewCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: PreloadWebviewFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: PreloadWebviewSuccessCallback
+ }
interface PreviewImageOption {
/** 需要预览的图片链接列表。[2.2.3](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起支持云文件ID。 */
urls: string[]
@@ -3984,9 +9839,13 @@ innerAudioContext.onError((res) => {
current?: string
/** 接口调用失败的回调函数 */
fail?: PreviewImageFailCallback
- /** 是否显示长按菜单
+ /** 需要基础库: `2.13.0`
*
- * 最低基础库: `2.13.0` */
+ * `origin`: 发送完整的referrer; `no-referrer`: 不发送。格式固定为 `https://servicewechat.com/{appid}/{version}/page-frame.html`,其中 {appid} 为小程序的 appid,{version} 为小程序的版本号,版本号为 0 表示为开发版、体验版以及审核版本,版本号为 devtools 表示为开发者工具,其余为正式版本; */
+ referrerPolicy?: string
+ /** 需要基础库: `2.13.0`
+ *
+ * 是否显示长按菜单。 */
showmenu?: boolean
/** 接口调用成功的回调函数 */
success?: PreviewImageSuccessCallback
@@ -4000,13 +9859,49 @@ innerAudioContext.onError((res) => {
current?: number
/** 接口调用失败的回调函数 */
fail?: PreviewMediaFailCallback
- /** 是否显示长按菜单
+ /** 需要基础库: `2.13.0`
*
- * 最低基础库: `2.13.0` */
+ * `origin`: 发送完整的referrer; `no-referrer`: 不发送。格式固定为 `https://servicewechat.com/{appid}/{version}/page-frame.html`,其中 {appid} 为小程序的 appid,{version} 为小程序的版本号,版本号为 0 表示为开发版、体验版以及审核版本,版本号为 devtools 表示为开发者工具,其余为正式版本; */
+ referrerPolicy?: string
+ /** 需要基础库: `2.13.0`
+ *
+ * 是否显示长按菜单。 */
showmenu?: boolean
/** 接口调用成功的回调函数 */
success?: PreviewMediaSuccessCallback
}
+ /** 订单详细商品信息列表。 */
+ interface ProductInfo {
+ /** 商户侧该商品所属的类目。示例值:玩偶 */
+ category: string
+ /** 商品主图的url,大小建议64*64。示例值:https://mp.weixin.qq.com/123 */
+ head_img: string
+ /** 该商品原价,单位为分。示例值:5000 */
+ org_price: number
+ /** 商户商品详请页小程序路径。示例值:pages/index */
+ path: string
+ /** 用户购买该商品的数量。示例值:5 */
+ quantity: number
+ /** 该商品售价,单位为分。示例值:4000 */
+ sale_price: number
+ /** 商户系统内该商品的sku属性。示例值:50cm */
+ sku_attr: string
+ /** 商户系统内该商品的skuid。示例值:sku123 */
+ sku_id: string
+ /** 商户系统内该商品的spuid。示例值:spu123456 */
+ spu_id: string
+ /** 商品标题。示例值:QQ长鹅 */
+ title: string
+ }
+ /** 推广员 */
+ interface PromoterResult {
+ /** 推广员昵称 */
+ finderNickname: string
+ /** 推广员 id */
+ promoterId: string
+ /** 推广员 openid */
+ promoterOpenId: string
+ }
interface ReLaunchOption {
/** 需要跳转的应用内页面路径 (代码包路径),路径后可以带参数。参数与路径之间使用?分隔,参数键与参数值用=相连,不同参数用&分隔;如 'path?key=value&key2=value2' */
url: string
@@ -4018,11 +9913,11 @@ innerAudioContext.onError((res) => {
success?: ReLaunchSuccessCallback
}
interface ReadBLECharacteristicValueOption {
- /** 蓝牙特征值的 uuid */
+ /** 蓝牙特征的 UUID */
characteristicId: string
/** 蓝牙设备 id */
deviceId: string
- /** 蓝牙特征值对应服务的 uuid */
+ /** 蓝牙特征对应服务的 UUID */
serviceId: string
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: ReadBLECharacteristicValueCompleteCallback
@@ -4031,15 +9926,35 @@ innerAudioContext.onError((res) => {
/** 接口调用成功的回调函数 */
success?: ReadBLECharacteristicValueSuccessCallback
}
- interface ReadFileFailCallbackResult {
- /** 错误信息
+ interface ReadCompressedFileOption {
+ /** 文件压缩类型,目前仅支持 'br'。
*
* 可选值:
- * - 'fail no such file or directory, open ${filePath}': 指定的 filePath 所在目录不存在;
- * - 'fail permission denied, open ${dirPath}': 指定的 filePath 路径没有读权限;
- * - 'fail sdcard not mounted': Android sdcard 挂载失败; */
+ * - 'br': brotli压缩文件; */
+ compressionAlgorithm: 'br'
+ /** 要读取的文件的路径 (本地用户文件或代码包文件) */
+ filePath: string
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: ReadCompressedFileCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: ReadCompressedFileFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: ReadCompressedFileSuccessCallback
+ }
+ interface ReadCompressedFileSuccessCallbackResult {
+ /** 文件内容 */
+ data: ArrayBuffer
errMsg: string
}
+ interface ReadCompressedFileSyncOption {
+ /** 文件压缩类型,目前仅支持 'br'。
+ *
+ * 可选值:
+ * - 'br': brotli压缩文件; */
+ compressionAlgorithm: 'br'
+ /** 要读取的文件的路径 (本地用户文件或代码包文件) */
+ filePath: string
+ }
interface ReadFileOption {
/** 要读取的文件的路径 (本地路径) */
filePath: string
@@ -4073,13 +9988,13 @@ innerAudioContext.onError((res) => {
| 'latin1'
/** 接口调用失败的回调函数 */
fail?: ReadFileFailCallback
- /** 指定文件的长度,如果不指定,则读到文件末尾。有效范围:[1, fileLength]。单位:byte
+ /** 需要基础库: `2.10.0`
*
- * 最低基础库: `2.10.0` */
+ * 指定文件的长度,如果不指定,则读到文件末尾。有效范围:[1, fileLength]。单位:byte */
length?: number
- /** 从文件指定位置开始读,如果不指定,则从文件头开始读。读取的范围应该是左闭右开区间 [position, position+length)。有效范围:[0, fileLength - 1]。单位:byte
+ /** 需要基础库: `2.10.0`
*
- * 最低基础库: `2.10.0` */
+ * 从文件指定位置开始读,如果不指定,则从文件头开始读。读取的范围应该是左闭右开区间 [position, position+length)。有效范围:[0, fileLength - 1]。单位:byte */
position?: number
/** 接口调用成功的回调函数 */
success?: ReadFileSuccessCallback
@@ -4089,14 +10004,91 @@ innerAudioContext.onError((res) => {
data: string | ArrayBuffer
errMsg: string
}
- interface ReaddirFailCallbackResult {
- /** 错误信息
+ interface ReadOption {
+ /** 数据写入的缓冲区,必须是 ArrayBuffer 实例 */
+ arrayBuffer: ArrayBuffer
+ /** 文件描述符。fd 通过 [FileSystemManager.open](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.open.html) 或 [FileSystemManager.openSync](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.openSync.html) 接口获得 */
+ fd: string
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: ReadCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: ReadFailCallback
+ /** 要从文件中读取的字节数,默认0 */
+ length?: number
+ /** 缓冲区中的写入偏移量,默认0 */
+ offset?: number
+ /** 文件读取的起始位置,如不传或传 null,则会从当前文件指针的位置读取。如果 position 是正整数,则文件指针位置会保持不变并从 position 读取文件。 */
+ position?: number
+ /** 接口调用成功的回调函数 */
+ success?: ReadSuccessCallback
+ }
+ /** 文件读取结果。 通过 [FileSystemManager.readSync](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readSync.html) 接口返回 */
+ interface ReadResult {
+ /** 被写入的缓存区的对象,即接口入参的 arrayBuffer */
+ arrayBuffer: ArrayBuffer
+ /** 实际读取的字节数 */
+ bytesRead: number
+ }
+ interface ReadSuccessCallbackResult {
+ /** 被写入的缓存区的对象,即接口入参的 arrayBuffer */
+ arrayBuffer: ArrayBuffer
+ /** 实际读取的字节数 */
+ bytesRead: number
+ errMsg: string
+ }
+ interface ReadSyncOption {
+ /** 数据写入的缓冲区,必须是 ArrayBuffer 实例 */
+ arrayBuffer: ArrayBuffer
+ /** 文件描述符。fd 通过 [FileSystemManager.open](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.open.html) 或 [FileSystemManager.openSync](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.openSync.html) 接口获得 */
+ fd: string
+ /** 要从文件中读取的字节数,默认0 */
+ length?: number
+ /** 缓冲区中的写入偏移量,默认0 */
+ offset?: number
+ /** 文件读取的起始位置,如不传或传 null,则会从当前文件指针的位置读取。如果 position 是正整数,则文件指针位置会保持不变并从 position 读取文件。 */
+ position?: number
+ }
+ interface ReadZipEntryOption {
+ /** 要读取的压缩包内的文件列表(当传入"all" 时表示读取压缩包内所有文件) */
+ entries: EntryItem[] | 'all'
+ /** 要读取的压缩包的路径 (本地路径) */
+ filePath: string
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: ReadZipEntryCompleteCallback
+ /** 统一指定读取文件的字符编码,只在 entries 值为"all"时有效。如果 entries 值为"all"且不传 encoding,则以 ArrayBuffer 格式读取文件的二进制内容
*
* 可选值:
- * - 'fail no such file or directory ${dirPath}': 目录不存在;
- * - 'fail not a directory ${dirPath}': dirPath 不是目录;
- * - 'fail permission denied, open ${dirPath}': 指定的 filePath 路径没有读权限;
- * - 'fail sdcard not mounted': Android sdcard 挂载失败; */
+ * - 'ascii': ;
+ * - 'base64': ;
+ * - 'binary': ;
+ * - 'hex': ;
+ * - 'ucs2': 以小端序读取;
+ * - 'ucs-2': 以小端序读取;
+ * - 'utf16le': 以小端序读取;
+ * - 'utf-16le': 以小端序读取;
+ * - 'utf-8': ;
+ * - 'utf8': ;
+ * - 'latin1': ; */
+ encoding?:
+ | 'ascii'
+ | 'base64'
+ | 'binary'
+ | 'hex'
+ | 'ucs2'
+ | 'ucs-2'
+ | 'utf16le'
+ | 'utf-16le'
+ | 'utf-8'
+ | 'utf8'
+ | 'latin1'
+ /** 接口调用失败的回调函数 */
+ fail?: ReadZipEntryFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: ReadZipEntrySuccessCallback
+ }
+ interface ReadZipEntrySuccessCallbackResult {
+ /** 文件读取结果。res.entries 是一个对象,key是文件路径,value是一个对象 FileItem ,表示该文件的读取结果。每个 FileItem 包含 data (文件内容) 和 errMsg (错误信息) 属性。 */
+ entries: EntriesResult
errMsg: string
}
interface ReaddirOption {
@@ -4114,8 +10106,18 @@ innerAudioContext.onError((res) => {
files: string[]
errMsg: string
}
+ interface ReconnectCastingOption {
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: ReconnectCastingCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: ReconnectCastingFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: ReconnectCastingSuccessCallback
+ }
interface RecorderManagerStartOption {
- /** 指定录音的音频输入源,可通过 [wx.getAvailableAudioSources()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.getAvailableAudioSources.html) 获取当前可用的音频源
+ /** 需要基础库: `2.1.0`
+ *
+ * 指定录音的音频输入源,可通过 [wx.getAvailableAudioSources()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.getAvailableAudioSources.html) 获取当前可用的音频源
*
* 可选值:
* - 'auto': 自动设置,默认使用手机麦克风,插上耳麦后自动切换使用耳机麦克风,所有平台适用;
@@ -4124,9 +10126,7 @@ innerAudioContext.onError((res) => {
* - 'mic': 麦克风(没插耳麦时是手机麦克风,插耳麦时是耳机麦克风),仅限 Android;
* - 'camcorder': 同 mic,适用于录制音视频内容,仅限 Android;
* - 'voice_communication': 同 mic,适用于实时沟通,仅限 Android;
- * - 'voice_recognition': 同 mic,适用于语音识别,仅限 Android;
- *
- * 最低基础库: `2.1.0` */
+ * - 'voice_recognition': 同 mic,适用于语音识别,仅限 Android; */
audioSource?:
| 'auto'
| 'buildInMic'
@@ -4147,7 +10147,7 @@ innerAudioContext.onError((res) => {
* - 'wav': wav 格式;
* - 'PCM': pcm 格式; */
format?: 'mp3' | 'aac' | 'wav' | 'PCM'
- /** 指定帧大小,单位 KB。传入 frameSize 后,每录制指定帧大小的内容后,会回调录制的文件内容,不指定则不会回调。暂仅支持 mp3 格式。 */
+ /** 指定帧大小,单位 KB。传入 frameSize 后,每录制指定帧大小的内容后,会回调录制的文件内容,不指定则不会回调。暂仅支持 mp3、pcm 格式。 */
frameSize?: number
/** 录音通道数
*
@@ -4155,7 +10155,7 @@ innerAudioContext.onError((res) => {
* - 1: 1 个通道;
* - 2: 2 个通道; */
numberOfChannels?: 1 | 2
- /** 采样率
+ /** 采样率(pc不支持)
*
* 可选值:
* - 8000: 8000 采样率;
@@ -4178,21 +10178,6 @@ innerAudioContext.onError((res) => {
| 44100
| 48000
}
- /** 菜单按钮的布局位置信息 */
- interface Rect {
- /** 下边界坐标,单位:px */
- bottom: number
- /** 高度,单位:px */
- height: number
- /** 左边界坐标,单位:px */
- left: number
- /** 右边界坐标,单位:px */
- right: number
- /** 上边界坐标,单位:px */
- top: number
- /** 宽度,单位:px */
- width: number
- }
interface RedirectToOption {
/** 需要跳转的应用内非 tabBar 的页面的路径 (代码包路径), 路径后可以带参数。参数与路径之间使用 `?` 分隔,参数键与参数值用 `=` 相连,不同参数用 `&` 分隔;如 'path?key=value&key2=value2' */
url: string
@@ -4211,6 +10196,10 @@ innerAudioContext.onError((res) => {
/** 接口调用成功的回调函数 */
success?: RedoSuccessCallback
}
+ interface RefCallbackResult {
+ /** 节点对应的 Ref 对象 */
+ ref: IAnyObject
+ }
/** 来源信息。从另一个小程序、公众号或 App 进入小程序时返回。否则返回 `{}`。(参见后文注意) */
interface ReferrerInfo {
/** 来源小程序、公众号或 App 的 appId */
@@ -4229,16 +10218,15 @@ innerAudioContext.onError((res) => {
/** 上边界 */
top: number
}
- /** 消息来源的结构化信息 */
- interface RemoteInfo {
- /** 发送消息的 socket 的地址 */
- address: string
- /** 使用的协议族,为 IPv4 或者 IPv6 */
- family: string
- /** 端口号 */
- port: number
- /** message 的大小,单位:字节 */
- size: number
+ interface RemoveArcOption {
+ /** 圆弧 id */
+ id: number
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: RemoveArcCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: RemoveArcFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: RemoveArcSuccessCallback
}
interface RemoveCustomLayerOption {
/** 个性化图层id */
@@ -4278,15 +10266,28 @@ innerAudioContext.onError((res) => {
/** 接口调用成功的回调函数 */
success?: RemoveMarkersSuccessCallback
}
- interface RemoveSavedFileFailCallbackResult {
- /** 错误信息
- *
- * 可选值:
- * - 'fail file not exist': 指定的 tempFilePath 找不到文件; */
- errMsg: string
+ interface RemoveSavedFileOption {
+ /** 需要删除的文件路径 (本地路径) */
+ filePath: string
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: RemoveSavedFileCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: RemoveSavedFileFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: RemoveSavedFileSuccessCallback
+ }
+ interface RemoveSecureElementPassOption {
+ /** 唯一id */
+ panid: string
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: RemoveSecureElementPassCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: RemoveSecureElementPassFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: RemoveSecureElementPassSuccessCallback
}
interface RemoveServiceOption {
- /** service 的 uuid */
+ /** service 的 UUID */
serviceId: string
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: RemoveServiceCompleteCallback
@@ -4315,13 +10316,15 @@ innerAudioContext.onError((res) => {
/** 接口调用成功的回调函数 */
success?: RemoveTabBarBadgeSuccessCallback
}
- interface RenameFailCallbackResult {
- /** 错误信息
- *
- * 可选值:
- * - 'fail permission denied, rename ${oldPath} -> ${newPath}': 指定源文件或目标文件没有写权限;
- * - 'fail no such file or directory, rename ${oldPath} -> ${newPath}': 源文件不存在,或目标文件路径的上层目录不存在; */
- errMsg: string
+ interface RemoveVisualLayerOption {
+ /** 可视化图层id */
+ layerId: string
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: RemoveVisualLayerCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: RemoveVisualLayerFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: RemoveVisualLayerSuccessCallback
}
interface RenameOption {
/** 新文件路径,支持本地路径 */
@@ -4341,15 +10344,155 @@ innerAudioContext.onError((res) => {
*
* - 通过 Canvas.getContext('2d') 接口可以获取 CanvasRenderingContext2D 对象,实现了 [HTML Canvas 2D Context](https://www.w3.org/TR/2dcontext/) 定义的属性、方法。
* - 通过 Canvas.getContext('webgl') 或 OffscreenCanvas.getContext('webgl') 接口可以获取 WebGLRenderingContext 对象,实现了 [WebGL 1.0](https://www.khronos.org/registry/webgl/specs/latest/1.0/) 定义的所有属性、方法、常量。
- * - CanvasRenderingContext2D 的 drawImage 方法 2.10.0 起支持传入通过 [SelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html) 获取的 video 对象
+ * - CanvasRenderingContext2D 的 drawImage 方法 2.10.0 起支持传入通过 [SelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html) 获取的 video 对象,2.29.0 起支持传入开启了自定义渲染的 [LivePusherContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.html) 对象。
*
* **示例代码**
*
- *
- *
* video 画到 2D Canvas 示例
* [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/tJTak7mU7sfX) */
interface RenderingContext {}
+ interface RequestCommonPaymentFailCallbackErr {
+ /** 错误信息 */
+ errMsg: string
+ /** 错误码 */
+ errno: number
+ }
+ interface RequestCommonPaymentOption {
+ /** 支付的类型
+ *
+ * 可选值:
+ * - 'retail_pay_goods': B2b支付;
+ * - 'retail_pay_indirect_goods': 间接支付;
+ * - 'retail_pay_combined_goods': 合单支付;
+ * - 'retail_pay_goods_new': 多渠道B2b支付; */
+ mode:
+ | 'retail_pay_goods'
+ | 'retail_pay_indirect_goods'
+ | 'retail_pay_combined_goods'
+ | 'retail_pay_goods_new'
+ /** 支付签名, 详见[《签名详解》](https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/virtual-payment.html) */
+ paySig: string
+ /** 具体支付参数见signData, 该参数需以string形式传递, 例如signData: '{"mchid":"1234567890","out_trade_no":"test1244","description":"测试测试","amount":{"order_amount":1,"currency":"CNY"},"attach":"test_attach","env":1}' */
+ signData: RequestCommonPaymentSignData
+ /** 用户态签名, 详见[《签名详解》](https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/virtual-payment.html) */
+ signature: string
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: RequestCommonPaymentCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: RequestCommonPaymentFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: RequestCommonPaymentSuccessCallback
+ }
+ /** 具体支付参数见signData, 该参数需以string形式传递, 例如signData: '{"mchid":"1234567890","out_trade_no":"test1244","description":"测试测试","amount":{"order_amount":1,"currency":"CNY"},"attach":"test_attach","env":1}' */
+ interface RequestCommonPaymentSignData {
+ /** 订单金额信息。 */
+ amount: Amount
+ /** 商品描述。示例值:Image形象店-深圳腾大-QQ公仔 */
+ description: string
+ /** 下单环境。示例值:0
+ *
+ * 可选值:
+ * - 0: 生产环境/现网环境;
+ * - 1: 沙箱环境/测试环境; */
+ env: 0 | 1
+ /** 由微信支付生成并下发的商户号。示例值:1230000109 */
+ mchid: string
+ /** 商户系统内部订单号,只能是数字、大小写字母_-*且在同一个商户号下唯一,长度限制为[6,32]。示例值:1217752501201407033233368018 */
+ out_trade_no: string
+ /** 附加数据,在查询API和支付通知中原样返回,可作为自定义参数使用,实际情况下只有支付完成状态才会返回该字段。示例值:test_attach */
+ attach?: string
+ /** 配送方式。示例值:2
+ *
+ * 可选值:
+ * - 1: 同城配送;
+ * - 2: 快递配送;
+ * - 3: 门店自提;
+ * - 4: 无需配送与提货; */
+ delivery_type?: 1 | 2 | 3 | 4
+ /** 订单详细商品信息列表。 */
+ product_info?: ProductInfo
+ /** B2b间连支付场景下,调用requestPaymentInfo的参数 */
+ requestPaymentInfo?: RequestPaymentInfo
+ }
+ interface RequestCommonPaymentSuccessCallbackResult {
+ /** 调用成功信息 */
+ errMsg: string
+ }
+ interface RequestDeviceVoIPOption {
+ /** 设备名称,将显示在授权弹窗内(长度不超过13)。授权框中「设备名字」= 「deviceName」 + 「modelId 对应设备型号」。 */
+ deviceName: string
+ /** 需要基础库: `2.30.4`
+ *
+ * 设备组的唯一标识 id 。isGroup 为 true 时只需要传该参数,isGroup 为 false 时不需要传该参数,但需要传 sn、snTicket、modelId、deviceName 。 */
+ groupId: string
+ /** 设备型号 id。通过微信公众平台注册设备获得。 */
+ modelId: string
+ /** 设备唯一序列号。由厂商分配,长度不能超过128字节。字符只接受数字,大小写字母,下划线(_)和连字符(-)。 */
+ sn: string
+ /** [设备票据](https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/hardware-device/getSnTicket.html),5分钟内有效。 */
+ snTicket: string
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: RequestDeviceVoIPCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: RequestDeviceVoIPFailCallback
+ /** 需要基础库: `2.30.4`
+ *
+ * 是否为授权设备组,默认 false 。 */
+ isGroup?: boolean
+ /** 接口调用成功的回调函数 */
+ success?: RequestDeviceVoIPSuccessCallback
+ }
+ interface RequestException {
+ /** 本次请求底层失败信息,所有失败信息均符合Errno错误码 */
+ reasons: ExceptionReason[]
+ /** 本次请求底层重试次数 */
+ retryCount: number
+ }
+ interface RequestFailCallbackErr {
+ /** 错误信息 */
+ errMsg: string
+ /** 需要基础库: `2.24.0`
+ *
+ * errno 错误码,错误码的详细说明参考 [Errno错误码](https://developers.weixin.qq.com/miniprogram/dev/framework/usability/PublicErrno.html) */
+ errno: number
+ /** 需要基础库: `3.8.10`
+ *
+ * 网络请求过程中的一些异常信息,例如httpdns超时等 */
+ exception: RequestException
+ /** 需要基础库: `3.8.10`
+ *
+ * 最终请求是否使用了HttpDNS解析的IP。仅当enableHttpDNS传true时返回此字段。如果开启enableHttpDNS但最终请求未使用HttpDNS解析的IP,可在exception查看原因。 */
+ useHttpDNS: boolean
+ }
+ interface RequestGlobalPaymentOption {
+ /** ISO4217标准中的最小货币单位进行表达,该值为整数,没有小数点。 */
+ paymentId: string
+ /** 预支付信息 */
+ prepayInfo: string
+ }
+ interface RequestIdleCallbackOption {
+ timeout?: number
+ }
+ interface RequestMerchantTransferOption {
+ /** 商户号 */
+ mchId: string
+ /** 商家转账付款单跳转收款页 pkg 信息,商家转账付款单受理成功时返回给商户 */
+ package: string
+ /** 商户 appId,普通模式下必填,服务商模式下,appId 和 subAppId 二选一填写 */
+ appId?: string
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: RequestMerchantTransferCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: RequestMerchantTransferFailCallback
+ /** 收款用户 openId, 对应传入的商户 appId 下,某用户的 openId */
+ openId?: string
+ /** 子商户 appId,服务商模式下,appId 和 subAppId 二选一填写 */
+ subAppId?: string
+ /** 子商户号,服务商模式下必填 */
+ subMchId?: string
+ /** 接口调用成功的回调函数 */
+ success?: RequestMerchantTransferSuccessCallback
+ }
interface RequestOption<
T extends string | IAnyObject | ArrayBuffer =
| string
@@ -4368,24 +10511,46 @@ innerAudioContext.onError((res) => {
* - 'json': 返回的数据为 JSON,返回后会对返回的数据进行一次 JSON.parse;
* - '其他': 不对返回的内容进行 JSON.parse; */
dataType?: 'json' | '其他'
- /** 开启 cache
+ /** 需要基础库: `2.10.4`
*
- * 最低基础库: `2.10.4` */
+ * 开启 Http 缓存 */
enableCache?: boolean
- /** 开启 http2
+ /** 需要基础库: `2.20.2`
*
- * 最低基础库: `2.10.4` */
+ * 开启 transfer-encoding chunked。 */
+ enableChunked?: boolean
+ /** 需要基础库: `2.10.4`
+ *
+ * 开启 http2 */
enableHttp2?: boolean
- /** 开启 quic
+ /** 需要基础库: `2.19.1`
*
- * 最低基础库: `2.10.4` */
+ * 是否开启 HttpDNS 服务。如开启,需要同时填入 httpDNSServiceId 。 HttpDNS 用法详见 [移动解析HttpDNS](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/HTTPDNS.html) */
+ enableHttpDNS?: boolean
+ /** 是否开启 profile。iOS 和 Android 端默认开启,其他端暂不支持。开启后可在接口回调的 res.profile 中查看性能调试信息。 */
+ enableProfile?: boolean
+ /** 需要基础库: `2.10.4`
+ *
+ * 是否开启 Quic/h3 协议(iOS 微信目前使用 gQUIC-Q43;Android 微信在 v8.0.54 前使用 gQUIC-Q43,v8.0.54 开始使用 IETF QUIC,即 h3 协议;PC微信使用 IETF QUIC,即 h3 协议) */
enableQuic?: boolean
/** 接口调用失败的回调函数 */
fail?: RequestFailCallback
+ /** 需要基础库: `2.21.0`
+ *
+ * 强制使用蜂窝网络发送请求 */
+ forceCellularNetwork?: boolean
/** 设置请求的 header,header 中不能设置 Referer。
*
* `content-type` 默认为 `application/json` */
header?: IAnyObject
+ /** 需要基础库: `2.19.1`
+ *
+ * HttpDNS 服务商 Id。 HttpDNS 用法详见 [移动解析HttpDNS](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/HTTPDNS.html) */
+ httpDNSServiceId?: string
+ /** 需要基础库: `3.8.9`
+ *
+ * HttpDNS 超时时间。HttpDNS解析时间超过该值时不再走HttpDNS,本次请求将回退到localDNS。默认为 60000 毫秒。 HttpDNS 用法详见 [移动解析HttpDNS](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/HTTPDNS.html) */
+ httpDNSTimeout?: number
/** HTTP 请求方法
*
* 可选值:
@@ -4406,20 +10571,68 @@ innerAudioContext.onError((res) => {
| 'DELETE'
| 'TRACE'
| 'CONNECT'
- /** 响应的数据类型
+ /** 需要基础库: `3.2.2`
+ *
+ * 重定向拦截策略。(目前安卓、iOS、开发者工具已支持,PC端将在后续支持)
+ *
+ * 可选值:
+ * - 'follow': 不拦截重定向,即客户端自动处理重定向;
+ * - 'manual': 拦截重定向。开启后,当 http 状态码为 3xx 时客户端不再自动重定向,而是触发 onHeadersReceived 回调,并结束本次 request 请求。可通过 onHeadersReceived 回调中的 header.Location 获取重定向的 url; */
+ redirect?: 'follow' | 'manual'
+ /** 需要基础库: `1.7.0`
+ *
+ * 响应的数据类型
*
* 可选值:
* - 'text': 响应的数据为文本;
- * - 'arraybuffer': 响应的数据为 ArrayBuffer;
- *
- * 最低基础库: `1.7.0` */
+ * - 'arraybuffer': 响应的数据为 ArrayBuffer; */
responseType?: 'text' | 'arraybuffer'
/** 接口调用成功的回调函数 */
success?: RequestSuccessCallback
- /** 超时时间,单位为毫秒
+ /** 需要基础库: `2.10.0`
*
- * 最低基础库: `2.10.0` */
+ * 超时时间,单位为毫秒。默认值为 60000 */
timeout?: number
+ /** 需要基础库: `3.3.3`
+ *
+ * 使用高性能模式。从基础库 v3.5.0 开始在 Android 端默认开启,其他端暂不生效。该模式下有更优的网络性能表现,更多信息请查看下方说明。 */
+ useHighPerformanceMode?: boolean
+ }
+ interface RequestOrderPaymentOption {
+ /** 随机字符串,长度为32个字符以下 */
+ nonceStr: string
+ /** 统一下单接口返回的 prepay_id 参数值,提交格式如:prepay_id=*** */
+ package: string
+ /** 签名,具体见微信支付文档 */
+ paySign: string
+ /** 时间戳,从 1970 年 1 月 1 日 00:00:00 至今的秒数,即当前的时间 */
+ timeStamp: string
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: RequestOrderPaymentCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: RequestOrderPaymentFailCallback
+ /** 签名算法,应与后台下单时的值一致
+ *
+ * 可选值:
+ * - 'MD5': 仅在 v2 版本接口适用;
+ * - 'HMAC-SHA256': 仅在 v2 版本接口适用;
+ * - 'RSA': 仅在 v3 版本接口适用; */
+ signType?: 'MD5' | 'HMAC-SHA256' | 'RSA'
+ /** 接口调用成功的回调函数 */
+ success?: RequestOrderPaymentSuccessCallback
+ }
+ /** B2b间连支付场景下,调用requestPaymentInfo的参数 */
+ interface RequestPaymentInfo {
+ /** 随机字符串,长度为32个字符以下 */
+ nonceStr?: string
+ /** 统一下单接口返回的 prepay_id 参数值,提交格式如:prepay_id=*** */
+ package?: string
+ /** 签名,具体见微信支付文档 */
+ paySign?: string
+ /** 签名算法,应与后台下单时的值一致 */
+ signType?: string
+ /** 时间戳,从 1970 年 1 月 1 日 00:00:00 至今的秒数,即当前的时间 */
+ timeStamp?: string
}
interface RequestPaymentOption {
/** 随机字符串,长度为32个字符以下 */
@@ -4444,17 +10657,27 @@ innerAudioContext.onError((res) => {
/** 接口调用成功的回调函数 */
success?: RequestPaymentSuccessCallback
}
- interface RequestPictureInPictureOption {
+ interface RequestPluginPaymentOption {
+ /** 需要显示在页面中的金额,单位为分 */
+ fee: number
+ /** 任意数据,传递给功能页中的响应函数 */
+ paymentArgs: IAnyObject
+ /** 插件版本
+ *
+ * 可选值:
+ * - 'develop': 开发版;
+ * - 'trial': 体验版;
+ * - 'release': 正式版; */
+ version: 'develop' | 'trial' | 'release'
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
- complete?: RequestPictureInPictureCompleteCallback
+ complete?: RequestPluginPaymentCompleteCallback
+ /** 需要显示在页面中的货币符号的代码 */
+ currencyType?: string
/** 接口调用失败的回调函数 */
- fail?: RequestPictureInPictureFailCallback
+ fail?: RequestPluginPaymentFailCallback
/** 接口调用成功的回调函数 */
- success?: RequestPictureInPictureSuccessCallback
+ success?: RequestPluginPaymentSuccessCallback
}
- /** 网络请求过程中一些调试信息
- *
- * 最低基础库: `2.10.4` */
interface RequestProfile {
/** SSL建立完成的时间,如果不是安全连接,则值为 0 */
SSLconnectionEnd: number
@@ -4464,22 +10687,44 @@ innerAudioContext.onError((res) => {
connectEnd: number
/** HTTP(TCP) 开始建立连接的时间,如果是持久连接,则与 fetchStart 值相等。注意如果在传输层发生了错误且重新建立连接,则这里显示的是新建立的连接开始的时间 */
connectStart: number
- /** DNS 域名查询完成的时间,如果使用了本地缓存(即无 DNS 查询)或持久连接,则与 fetchStart 值相等 */
- domainLookupEnd: number
- /** DNS 域名查询开始的时间,如果使用了本地缓存(即无 DNS 查询)或持久连接,则与 fetchStart 值相等 */
- domainLookupStart: number
+ /** Local DNS 域名查询完成的时间,如果使用了本地缓存(即无 DNS 查询)或持久连接,则与 fetchStart 值相等 */
+ domainLookUpEnd: number
+ /** Local DNS 域名查询开始的时间,如果使用了本地缓存(即无 DNS 查询)或持久连接,则与 fetchStart 值相等 */
+ domainLookUpStart: number
/** 评估当前网络下载的kbps */
downstreamThroughputKbpsEstimate: number
- /** 评估的网络状态 slow 2g/2g/3g/4g */
- estimate_nettype: string
+ /** 评估的网络状态 unknown, offline, slow 2g, 2g, 3g, 4g, last/0, 1, 2, 3, 4, 5, 6 */
+ estimate_nettype: number
/** 组件准备好使用 HTTP 请求抓取资源的时间,这发生在检查本地缓存之前 */
fetchStart: number
+ /** 需要基础库: `3.8.9`
+ *
+ * httpDNS 完成查询的时间。仅当开启 httpDNS 功能时返回该字段。目前仅wx.request接口支持 */
+ httpDNSDomainLookUpEnd: number
+ /** 需要基础库: `3.8.9`
+ *
+ * httpDNS 开始查询的时间。仅当开启 httpDNS 功能时返回该字段。目前仅wx.request接口支持 */
+ httpDNSDomainLookUpStart: number
/** 协议层根据多个请求评估当前网络的 rtt(仅供参考) */
httpRttEstimate: number
+ /** 需要基础库: `3.8.10`
+ *
+ * 调用接口的时间。 */
+ invokeStart: number
/** 当前请求的IP */
peerIP: string
/** 当前请求的端口 */
port: number
+ /** 使用协议类型,有效值:http1.1, h2, quic, unknown */
+ protocol: string
+ /** 需要基础库: `3.8.10`
+ *
+ * 结束排队的时间。达到并行上限时才需要排队。如果未发生排队,则该字段和 queueStart 字段值相同 */
+ queueEnd: number
+ /** 需要基础库: `3.8.10`
+ *
+ * 开始排队的时间。达到并行上限时才需要排队。 */
+ queueStart: number
/** 收到字节数 */
receivedBytedCount: number
/** 最后一个 HTTP 重定向完成时的时间。有跳转且是同域名内部的重定向才算,否则值为 0 */
@@ -4504,6 +10749,56 @@ innerAudioContext.onError((res) => {
throughputKbps: number
/** 传输层根据多个请求评估的当前网络的 rtt(仅供参考) */
transportRttEstimate: number
+ /** 是否走到了高性能模式。基础库 v3.3.4 起支持。 */
+ usingHighPerformanceMode: boolean
+ }
+ interface RequestSubscribeDeviceMessageFailCallbackResult {
+ /** 接口调用失败错误码,有可能为空 */
+ errCode: number
+ /** 接口调用失败错误信息 */
+ errMsg: string
+ }
+ interface RequestSubscribeDeviceMessageOption {
+ /** 设备型号 id 。通过微信公众平台注册设备获得。 */
+ modelId: string
+ /** 设备唯一序列号。由厂商分配,长度不能超过128字节。字符只接受数字,大小写字母,下划线(_)和连字符(-)。 */
+ sn: string
+ /** 设备票据,5分钟内有效。 */
+ snTicket: string
+ /** 需要订阅的消息模板的 id 的集合,一次调用最多可订阅3条消息 */
+ tmplIds: any[]
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: RequestSubscribeDeviceMessageCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: RequestSubscribeDeviceMessageFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: RequestSubscribeDeviceMessageSuccessCallback
+ }
+ interface RequestSubscribeDeviceMessageSuccessCallbackResult {
+ /** [TEMPLATE_ID]是动态的键,即模板id,值包括'accept'、'reject'、'ban'、'filter'、'acceptWithAudio'。'accept'表示用户同意订阅该条id对应的模板消息,'reject'表示用户拒绝订阅该条id对应的模板消息,'ban'表示已被后台封禁,'acceptWithAudio' 表示用户接收订阅消息并开启了语音提醒,'filter'表示该模板因为模板标题同名被后台过滤。例如 { errMsg: "requestSubscribeDeviceMessage:ok", zun-LzcQyW-edafCVvzPkK4de2Rllr1fFpw2A_x0oXE: "accept"} 表示用户同意订阅zun-LzcQyW-edafCVvzPkK4de2Rllr1fFpw2A_x0oXE这条消息 */
+ [TEMPLATE_ID: string]: string
+ /** 接口调用成功时errMsg值为'requestSubscribeDeviceMessage:ok' */
+ errMsg: string
+ }
+ interface RequestSubscribeEmployeeMessageOption {
+ /** 订阅消息模板id列表,一次最多传入6条;如果传入则会在绑定成功后自动拉起订阅消息列表页面。 */
+ tmplIds: string[]
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: RequestSubscribeEmployeeMessageCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: RequestSubscribeEmployeeMessageFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: RequestSubscribeEmployeeMessageSuccessCallback
+ }
+ interface RequestSubscribeEmployeeMessageSuccessCallbackResult {
+ /** [TEMPLATE_ID]是动态的键,即模板消息id,值包括'accept'、'reject'。'accept'表示用户同意订阅该条id对应的模板消息,'reject'表示用户拒绝订阅该条id对应的模板消息。例如 { zun-LzcQyW-edafCVvzPkK4de2Rllr1fFpw2A_x0oXE: "accept"} 表示用户同意订阅zun-LzcQyW-edafCVvzPkK4de2Rllr1fFpw2A_x0oXE这条消息 */
+ [TEMPLATE_ID: string]: string
+ /** 绑定状态
+ *
+ * 可选值:
+ * - 'accept': 已绑定; */
+ bindingStatus: 'accept'
+ errMsg: string
}
interface RequestSubscribeMessageFailCallbackResult {
/** 接口调用失败错误码 */
@@ -4512,7 +10807,7 @@ innerAudioContext.onError((res) => {
errMsg: string
}
interface RequestSubscribeMessageOption {
- /** 需要订阅的消息模板的id的集合,一次调用最多可订阅3条消息(注意:iOS客户端7.0.6版本、Android客户端7.0.7版本之后的一次性订阅/长期订阅才支持多个模板消息,iOS客户端7.0.5版本、Android客户端7.0.6版本之前的一次订阅只支持一个模板消息)消息模板id在[微信公众平台(mp.weixin.qq.com)-功能-订阅消息]中配置。每个tmplId对应的模板标题需要不相同,否则会被过滤。 */
+ /** 需要订阅的消息模板的id的集合,一次调用最多可订阅5条消息(注意:iOS客户端7.0.6版本、Android客户端7.0.7版本之后的一次性订阅/长期订阅才支持多个模板消息,iOS客户端7.0.5版本、Android客户端7.0.6版本之前的一次订阅只支持一个模板消息)消息模板id在[微信公众平台(mp.weixin.qq.com)-功能-订阅消息]中配置。每个tmplId对应的模板标题需要不相同,否则会被过滤。 */
tmplIds: any[]
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: RequestSubscribeMessageCompleteCallback
@@ -4533,24 +10828,90 @@ innerAudioContext.onError((res) => {
| IAnyObject
| ArrayBuffer
> {
- /** 开发者服务器返回的 cookies,格式为字符串数组
+ /** 需要基础库: `2.10.0`
*
- * 最低基础库: `2.10.0` */
+ * 开发者服务器返回的 cookies,格式为字符串数组 */
cookies: string[]
/** 开发者服务器返回的数据 */
data: T
- /** 开发者服务器返回的 HTTP Response Header
+ /** 需要基础库: `3.0.0`
*
- * 最低基础库: `1.2.0` */
+ * 网络请求过程中的一些异常信息,例如httpdns超时等 */
+ exception: RequestException
+ /** 需要基础库: `1.2.0`
+ *
+ * 开发者服务器返回的 HTTP Response Header */
header: IAnyObject
- /** 网络请求过程中一些调试信息
+ /** 需要基础库: `2.10.4`
*
- * 最低基础库: `2.10.4` */
+ * 网络请求过程中一些调试信息,[查看详细说明](https://developers.weixin.qq.com/miniprogram/dev/framework/performance/network.html)。目前仅 iOS 和 Android 端支持,其他端暂不支持。 */
profile: RequestProfile
/** 开发者服务器返回的 HTTP 状态码 */
statusCode: number
+ /** 需要基础库: `3.4.10`
+ *
+ * 最终请求是否使用了HttpDNS解析的IP。仅当enableHttpDNS传true时返回此字段。如果开启enableHttpDNS但最终请求未使用HttpDNS解析的IP,可在exception查看原因。 */
+ useHttpDNS: boolean
errMsg: string
}
+ interface RequestTaskOnHeadersReceivedListenerResult {
+ /** 开发者服务器返回的 cookies,格式为字符串数组 */
+ cookies: string[]
+ /** 开发者服务器返回的 HTTP Response Header */
+ header: IAnyObject
+ /** 开发者服务器返回的 HTTP 状态码 (目前开发者工具上不会返回 statusCode 字段,可用真机查看该字段,后续将会支持) */
+ statusCode: number
+ }
+ interface RequestVirtualPaymentOption {
+ /** 支付的类型, 不同的支付类型有各自额外要传的附加参数
+ *
+ * 可选值:
+ * - 'short_series_goods': 道具直购;
+ * - 'short_series_coin': 代币充值; */
+ mode: 'short_series_goods' | 'short_series_coin'
+ /** 支付签名, 详见[《签名详解》](https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/virtual-payment.html) */
+ paySig: string
+ /** 具体支付参数见signData, 该参数需以string形式传递, 例如signData: '{"offerId":"123","buyQuantity":1,"env":0,"currencyType":"CNY","productId":"testproductId","goodsPrice":10,"outTradeNo":"xxxxxx","attach":"testdata"}' */
+ signData: SignData
+ /** 用户态签名, 详见[《签名详解》](https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/virtual-payment.html) */
+ signature: string
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: RequestVirtualPaymentCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: RequestVirtualPaymentFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: RequestVirtualPaymentSuccessCallback
+ }
+ interface RequirePrivacyAuthorizeOption {
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: RequirePrivacyAuthorizeCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: RequirePrivacyAuthorizeFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: RequirePrivacyAuthorizeSuccessCallback
+ }
+ interface ReserveChannelsLiveOption {
+ /** 预告 id,通过 getChannelsLiveNoticeInfo 接口获取 */
+ noticeId: string
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: ReserveChannelsLiveCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: ReserveChannelsLiveFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: ReserveChannelsLiveSuccessCallback
+ }
+ interface RestartMiniProgramOption {
+ /** 打开的页面路径,path 中 ? 后面的部分会成为 query */
+ path: string
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: RestartMiniProgramCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: RestartMiniProgramFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: RestartMiniProgramSuccessCallback
+ }
+ /** 错误对象 */
+ interface ResultError {}
interface ResumeBGMOption {
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: ResumeBGMCompleteCallback
@@ -4567,14 +10928,16 @@ innerAudioContext.onError((res) => {
/** 接口调用成功的回调函数 */
success?: ResumeSuccessCallback
}
- interface RewardedVideoAdOnCloseCallbackResult {
- /** 视频是否是在用户完整观看的情况下被关闭的
+ interface RewardedVideoAdOnCloseListenerResult {
+ /** 需要基础库: `2.1.0`
*
- * 最低基础库: `2.1.0` */
+ * 视频是否是在用户完整观看的情况下被关闭的 */
isEnded: boolean
}
- interface RewardedVideoAdOnErrorCallbackResult {
- /** 错误码
+ interface RewardedVideoAdOnErrorListenerResult {
+ /** 需要基础库: `2.2.2`
+ *
+ * 错误码
*
* 可选值:
* - 1000: 后端接口调用失败;
@@ -4585,22 +10948,22 @@ innerAudioContext.onError((res) => {
* - 1005: 广告组件审核中;
* - 1006: 广告组件被驳回;
* - 1007: 广告组件被封禁;
- * - 1008: 广告单元已关闭;
- *
- * 最低基础库: `2.2.2` */
+ * - 1008: 广告单元已关闭; */
errCode: 1000 | 1001 | 1002 | 1003 | 1004 | 1005 | 1006 | 1007 | 1008
/** 错误信息 */
errMsg: string
}
- interface RmdirFailCallbackResult {
- /** 错误信息
- *
- * 可选值:
- * - 'fail no such file or directory ${dirPath}': 目录不存在;
- * - 'fail directory not empty': 目录不为空;
- * - 'fail permission denied, open ${dirPath}': 指定的 dirPath 路径没有写权限;
- * - 'fail sdcard not mounted': Android sdcard 挂载失败; */
- errMsg: string
+ interface RewriteRouteOption {
+ /** 重写目标页面的路径 (代码包路径), 路径后可以带参数。参数与路径之间使用 `?` 分隔,参数键与参数值用 `=` 相连,不同参数用 `&` 分隔;如 `'path?key=value&key2=value2'` */
+ url: string
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: RewriteRouteCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: RewriteRouteFailCallback
+ /** 是否直接保留当前路由事件的参数,默认为 `false`;开启时,`url` 里面传入的参数会被丢弃 */
+ preserveQuery?: boolean
+ /** 接口调用成功的回调函数 */
+ success?: RewriteRouteSuccessCallback
}
interface RmdirOption {
/** 要删除的目录路径 (本地路径) */
@@ -4609,16 +10972,21 @@ innerAudioContext.onError((res) => {
complete?: RmdirCompleteCallback
/** 接口调用失败的回调函数 */
fail?: RmdirFailCallback
- /** 是否递归删除目录。如果为 true,则删除该目录和该目录下的所有子目录以及文件。
+ /** 需要基础库: `2.3.0`
*
- * 最低基础库: `2.3.0` */
+ * 是否递归删除目录。如果为 true,则删除该目录和该目录下的所有子目录以及文件。 */
recursive?: boolean
/** 接口调用成功的回调函数 */
success?: RmdirSuccessCallback
}
- /** 在竖屏正方向下的安全区域
- *
- * 最低基础库: `2.7.0` */
+ interface RunOCROption {
+ /** 待识别图像的像素点数据,每四项表示一个像素点的 RGBA */
+ frameBuffer: ArrayBuffer
+ /** 图像高度 */
+ height: number
+ /** 图像宽度 */
+ width: number
+ }
interface SafeArea {
/** 安全区域右下角纵坐标 */
bottom: number
@@ -4633,16 +11001,17 @@ innerAudioContext.onError((res) => {
/** 安全区域的宽度,单位逻辑像素 */
width: number
}
- interface SaveFileFailCallbackResult {
- /** 错误信息
- *
- * 可选值:
- * - 'fail tempFilePath file not exist': 指定的 tempFilePath 找不到文件;
- * - 'fail permission denied, open "${filePath}"': 指定的 filePath 路径没有写权限;
- * - 'fail no such file or directory "${dirPath}"': 上级目录不存在;
- * - 'fail the maximum size of the file storage limit is exceeded': 存储空间不足;
- * - 'fail sdcard not mounted': Android sdcard 挂载失败; */
- errMsg: string
+ interface SaveFileOption {
+ /** 临时存储文件路径 (本地路径) */
+ tempFilePath: string
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: SaveFileCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: SaveFileFailCallback
+ /** 要存储的文件路径 (本地路径) */
+ filePath?: string
+ /** 接口调用成功的回调函数 */
+ success?: SaveFileSuccessCallback
}
interface SaveFileSuccessCallbackResult {
/** 存储后的文件路径 (本地路径) */
@@ -4684,20 +11053,23 @@ innerAudioContext.onError((res) => {
complete?: ScanCodeCompleteCallback
/** 接口调用失败的回调函数 */
fail?: ScanCodeFailCallback
- /** 是否只能从相机扫码,不允许从相册选择图片
+ /** 需要基础库: `1.2.0`
*
- * 最低基础库: `1.2.0` */
+ * 是否只能从相机扫码,不允许从相册选择图片 */
onlyFromCamera?: boolean
- /** 扫码类型
+ /** 需要基础库: `1.7.0`
+ *
+ * 扫码类型
*
* 可选值:
* - 'barCode': 一维码;
* - 'qrCode': 二维码;
+ * - 'wxCode': 小程序码;
* - 'datamatrix': Data Matrix 码;
- * - 'pdf417': PDF417 条码;
- *
- * 最低基础库: `1.7.0` */
- scanType?: Array<'barCode' | 'qrCode' | 'datamatrix' | 'pdf417'>
+ * - 'pdf417': PDF417 条码; */
+ scanType?: Array<
+ 'barCode' | 'qrCode' | 'wxCode' | 'datamatrix' | 'pdf417'
+ >
/** 接口调用成功的回调函数 */
success?: ScanCodeSuccessCallback
}
@@ -4754,37 +11126,54 @@ innerAudioContext.onError((res) => {
| 'CODE_25'
errMsg: string
}
+ /** 需要基础库: `3.1.0`
+ *
+ * 配置项,仅 Skyine 模式支持 */
+ interface ScrollIntoViewOptions {
+ /** 指定目标节点在视口内的位置 */
+ alignment?: string
+ /** 是否启用滚动动画 */
+ animated?: boolean
+ /** 跳转到目标节点时的额外偏移 */
+ offset?: number
+ /** 只跳转到 cacheExtent 以内的目标节点,性能更佳 */
+ withinExtent?: boolean
+ }
interface ScrollOffsetCallbackResult {
/** 节点的 dataset */
dataset: IAnyObject
/** 节点的 ID */
id: string
+ /** 节点的滚动高度 */
+ scrollHeight: number
/** 节点的水平滚动位置 */
scrollLeft: number
/** 节点的竖直滚动位置 */
scrollTop: number
+ /** 节点的滚动宽度 */
+ scrollWidth: number
}
- interface ScrollToOption {
- /** 是否启用滚动动画 */
- animated?: boolean
- /** 滚动动画时长 */
- duration?: number
- /** 左边界距离 */
- left?: number
- /** 顶部距离 */
- top?: number
- /** 初始速度 */
- velocity?: number
- }
- /** 增强 ScrollView 实例
- *
- * 最低基础库: `2.14.4` */
+ /** 需要基础库: `2.14.4`
+*
+* 增强 ScrollView 实例,可通过 [wx.createSelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/wx.createSelectorQuery.html) 的 [NodesRef.node](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/NodesRef.node.html) 方法获取。 仅在 scroll-view 组件开启 enhanced 属性后生效。
+*
+* **示例代码**
+*
+* ```js
+wx.createSelectorQuery()
+ .select('#scrollview')
+ .node()
+ .exec((res) => {
+ const scrollView = res[0].node;
+ scrollView.scrollEnabled = false;
+ })
+``` */
interface ScrollViewContext {
/** 设置滚动边界弹性 (仅在 iOS 下生效) */
bounces: boolean
/** 取消滚动惯性 (仅在 iOS 下生效) */
decelerationDisabled: boolean
- /** 设置滚动减速速率 */
+ /** 设置滚动减速速率 (仅在 iOS 下生效) */
fastDeceleration: boolean
/** 分页滑动开关 */
pagingEnabled: boolean
@@ -4792,6 +11181,73 @@ innerAudioContext.onError((res) => {
scrollEnabled: boolean
/** 设置是否显示滚动条 */
showScrollbar: boolean
+ /** [ScrollViewContext.closeRefresh()](https://developers.weixin.qq.com/miniprogram/dev/api/ui/scroll/ScrollViewContext.closeRefresh.html)
+ *
+ * 需要基础库: `3.0.0`
+ *
+ * 在插件中使用:支持
+ *
+ * 关闭下拉刷新。 */
+ closeRefresh(): void
+ /** [ScrollViewContext.closeTwoLevel(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/scroll/ScrollViewContext.closeTwoLevel.html)
+ *
+ * 需要基础库: `3.0.0`
+ *
+ * 在插件中使用:支持
+ *
+ * 关闭下拉二级。 */
+ closeTwoLevel(option: TriggerRefreshOption): void
+ /** [ScrollViewContext.scrollIntoView(string selector, object ScrollIntoViewOptions)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/scroll/ScrollViewContext.scrollIntoView.html)
+ *
+ * 需要基础库: `2.14.4`
+ *
+ * 在插件中使用:支持
+ *
+ * 滚动至指定位置 */
+ scrollIntoView(
+ /** 元素选择器 */
+ selector: string,
+ /** 需要基础库: `3.1.0`
+ *
+ * 配置项,仅 Skyine 模式支持 */
+ ScrollIntoViewOptions: ScrollIntoViewOptions
+ ): void
+ /** [ScrollViewContext.scrollTo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/scroll/ScrollViewContext.scrollTo.html)
+ *
+ * 需要基础库: `2.14.4`
+ *
+ * 在插件中使用:支持
+ *
+ * 滚动至指定位置 */
+ scrollTo(option: ScrollViewContextScrollToOption): void
+ /** [ScrollViewContext.triggerRefresh(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/scroll/ScrollViewContext.triggerRefresh.html)
+ *
+ * 需要基础库: `3.0.0`
+ *
+ * 在插件中使用:支持
+ *
+ * 触发下拉刷新。 */
+ triggerRefresh(option: TriggerRefreshOption): void
+ /** [ScrollViewContext.triggerTwoLevel(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/scroll/ScrollViewContext.triggerTwoLevel.html)
+ *
+ * 需要基础库: `3.0.0`
+ *
+ * 在插件中使用:支持
+ *
+ * 触发下拉二级。 */
+ triggerTwoLevel(option: TriggerRefreshOption): void
+ }
+ interface ScrollViewContextScrollToOption {
+ /** 是否启用滚动动画 */
+ animated?: boolean
+ /** 滚动动画时长 (仅在 iOS 下生效) */
+ duration?: number
+ /** 左边界距离 */
+ left?: number
+ /** 顶部距离 */
+ top?: number
+ /** 初始速度 (仅在 iOS 下生效) */
+ velocity?: number
}
interface SeekBackgroundAudioOption {
/** 音乐位置,单位:秒 */
@@ -4803,6 +11259,16 @@ innerAudioContext.onError((res) => {
/** 接口调用成功的回调函数 */
success?: SeekBackgroundAudioSuccessCallback
}
+ interface SelectGroupMembersOption {
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: SelectGroupMembersCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: SelectGroupMembersFailCallback
+ /** 最多可选人数 */
+ maxSelectCount?: number
+ /** 接口调用成功的回调函数 */
+ success?: SelectGroupMembersSuccessCallback
+ }
interface SendHCEMessageOption {
/** 二进制数据 */
data: ArrayBuffer
@@ -4814,6 +11280,8 @@ innerAudioContext.onError((res) => {
success?: SendHCEMessageSuccessCallback
}
interface SendMessageOption {
+ /** SEI消息 */
+ msg: string
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: SendMessageCompleteCallback
/** 接口调用失败的回调函数 */
@@ -4821,6 +11289,18 @@ innerAudioContext.onError((res) => {
/** 接口调用成功的回调函数 */
success?: SendMessageSuccessCallback
}
+ interface SendSmsOption {
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: SendSmsCompleteCallback
+ /** 预填到发送短信面板的内容 */
+ content?: string
+ /** 接口调用失败的回调函数 */
+ fail?: SendSmsFailCallback
+ /** 预填到发送短信面板的手机号 */
+ phoneNumber?: string
+ /** 接口调用成功的回调函数 */
+ success?: SendSmsSuccessCallback
+ }
interface SendSocketMessageOption {
/** 需要发送的内容 */
data: string | ArrayBuffer
@@ -4841,10 +11321,14 @@ innerAudioContext.onError((res) => {
/** 接口调用成功的回调函数 */
success?: SetBGMVolumeSuccessCallback
}
+ interface SetBLEMTUFailCallbackResult {
+ /** 最终协商的 MTU 值。如果协商失败则无此参数。安卓客户端 8.0.9 开始支持。 */
+ mtu: number
+ }
interface SetBLEMTUOption {
- /** 用于区分设备的 id */
+ /** 蓝牙设备 id */
deviceId: string
- /** 最大传输单元(22,512) 区间内,单位 bytes */
+ /** 最大传输单元。设置范围为 (22,512) 区间内,单位 bytes */
mtu: number
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: SetBLEMTUCompleteCallback
@@ -4853,6 +11337,11 @@ innerAudioContext.onError((res) => {
/** 接口调用成功的回调函数 */
success?: SetBLEMTUSuccessCallback
}
+ interface SetBLEMTUSuccessCallbackResult {
+ /** 最终协商的 MTU 值,与传入参数一致。安卓客户端 8.0.9 开始支持。 */
+ mtu: number
+ errMsg: string
+ }
interface SetBackgroundColorOption {
/** 窗口的背景色,必须为十六进制颜色值 */
backgroundColor?: string
@@ -4891,6 +11380,18 @@ innerAudioContext.onError((res) => {
/** 接口调用成功的回调函数 */
success?: SetBackgroundTextStyleSuccessCallback
}
+ interface SetBoundaryOption {
+ /** 东北角经纬度 */
+ northeast: MapPostion
+ /** 西南角经纬度 */
+ southwest: MapPostion
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: SetBoundaryCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: SetBoundaryFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: SetBoundarySuccessCallback
+ }
interface SetCenterOffsetOption {
/** 偏移量,两位数组 */
offset: number[]
@@ -4923,6 +11424,28 @@ innerAudioContext.onError((res) => {
/** 接口调用成功的回调函数 */
success?: SetContentsSuccessCallback
}
+ interface SetEnable1v1ChatOption {
+ /** 是否开启 */
+ enable: boolean
+ /** 窗口背景色(音频通话背景以及小窗模式背景)
+ *
+ * 可选值:
+ * - 0: #262930;
+ * - 1: #FA5151;
+ * - 2: #FA9D3B;
+ * - 3: #3D7257;
+ * - 4: #1485EE;
+ * - 5: #6467F0; */
+ backgroundType?: 0 | 1 | 2 | 3 | 4 | 5
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: SetEnable1v1ChatCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: SetEnable1v1ChatFailCallback
+ /** 小窗样式 */
+ minWindowType?: number
+ /** 接口调用成功的回调函数 */
+ success?: SetEnable1v1ChatSuccessCallback
+ }
interface SetEnableDebugOption {
/** 是否打开调试 */
enableDebug: boolean
@@ -4957,6 +11480,16 @@ innerAudioContext.onError((res) => {
/** 接口调用成功的回调函数 */
success?: SetKeepScreenOnSuccessCallback
}
+ interface SetLocMarkerIconOption {
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: SetLocMarkerIconCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: SetLocMarkerIconFailCallback
+ /** 图标路径,支持网络路径、本地路径、代码包路径 */
+ iconPath?: string
+ /** 接口调用成功的回调函数 */
+ success?: SetLocMarkerIconSuccessCallback
+ }
interface SetMICVolumeOption {
/** 音量大小,范围是 0.0-1.0 */
volume: number
@@ -4992,7 +11525,7 @@ innerAudioContext.onError((res) => {
success?: SetNavigationBarTitleSuccessCallback
}
interface SetScreenBrightnessOption {
- /** 屏幕亮度值,范围 0 ~ 1。0 最暗,1 最亮 */
+ /** 屏幕亮度值,范围 0 ~ 1,0 最暗,1 最亮。在安卓端支持传入特殊值 -1,表示屏幕亮度跟随系统变化 */
value: number
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: SetScreenBrightnessCompleteCallback
@@ -5001,6 +11534,18 @@ innerAudioContext.onError((res) => {
/** 接口调用成功的回调函数 */
success?: SetScreenBrightnessSuccessCallback
}
+ interface SetSelectionOption {
+ /** 选区开始位置 */
+ index: number
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: SetSelectionCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: SetSelectionFailCallback
+ /** 选区长度 */
+ length?: number
+ /** 接口调用成功的回调函数 */
+ success?: SetSelectionSuccessCallback
+ }
interface SetStorageOption {
/** 需要存储的内容。只支持原生类型、Date、及能够通过`JSON.stringify`序列化的对象。 */
data: T
@@ -5008,6 +11553,10 @@ innerAudioContext.onError((res) => {
key: string
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: SetStorageCompleteCallback
+ /** 需要基础库: `2.21.3`
+ *
+ * 是否开启加密存储。只有异步的 setStorage 接口支持开启加密存储。开启后,将会对 data 使用 AES128 加密,接口回调耗时将会增加。若开启加密存储,setStorage 和 getStorage 需要同时声明 encrypt 的值为 true。此外,由于加密后的数据会比原始数据膨胀1.4倍,因此开启 encrypt 的情况下,单个 key 允许存储的最大数据长度为 0.7MB,所有数据存储上限为 7.1MB */
+ encrypt?: boolean
/** 接口调用失败的回调函数 */
fail?: SetStorageFailCallback
/** 接口调用成功的回调函数 */
@@ -5077,6 +11626,16 @@ innerAudioContext.onError((res) => {
/** 接口调用成功的回调函数 */
success?: SetTopBarTextSuccessCallback
}
+ interface SetVisualEffectOnCaptureOption {
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: SetVisualEffectOnCaptureCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: SetVisualEffectOnCaptureFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: SetVisualEffectOnCaptureSuccessCallback
+ /** 截屏/录屏时的表现,仅支持 none / hidden,传入 hidden 则表示在截屏/录屏时隐藏屏幕 */
+ visualEffect?: string
+ }
interface SetWifiListOption {
/** 提供预设的 Wi-Fi 信息列表 */
wifiList: WifiData[]
@@ -5099,27 +11658,153 @@ innerAudioContext.onError((res) => {
/** 接口调用成功的回调函数 */
success?: SetWindowSizeSuccessCallback
}
- interface SetZoomOption {
- /** 缩放级别,范围[1, maxZoom]。zoom 可取小数,精确到小数后一位。maxZoom 可在 bindinitdone 返回值中获取。 */
- zoom: number
- /** 接口调用结束的回调函数(调用成功、失败都会执行) */
- complete?: SetZoomCompleteCallback
- /** 接口调用失败的回调函数 */
- fail?: SetZoomFailCallback
- /** 接口调用成功的回调函数 */
- success?: SetZoomSuccessCallback
- }
interface SetZoomSuccessCallbackResult {
/** 实际设置的缩放级别。由于系统限制,某些机型可能无法设置成指定值,会改用最接近的可设值。 */
zoom: number
errMsg: string
}
+ interface ShareAppMessageToGroupOption {
+ /** 转发标题 */
+ title: string
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: ShareAppMessageToGroupCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: ShareAppMessageToGroupFailCallback
+ /** 自定义图片路径,支持PNG及JPG,显示图片长宽比是 5:4,默认使用截图 */
+ imageUrl?: string
+ /** 转发路径,必须是以 / 开头的完整路径,默认为当前页面 */
+ path?: string
+ /** 接口调用成功的回调函数 */
+ success?: ShareAppMessageToGroupSuccessCallback
+ }
+ interface ShareEmojiToGroupOption {
+ /** 要分享的表情地址,必须为本地路径或临时路径 */
+ imagePath: string
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: ShareEmojiToGroupCompleteCallback
+ /** 从消息小程序入口打开小程序的路径,默认为聊天工具启动路径 */
+ entrancePath?: string
+ /** 接口调用失败的回调函数 */
+ fail?: ShareEmojiToGroupFailCallback
+ /** 分享的表情消息是否要带小程序入口 */
+ needShowEntrance?: boolean
+ /** 接口调用成功的回调函数 */
+ success?: ShareEmojiToGroupSuccessCallback
+ }
+ interface ShareFileMessageOption {
+ /** 要分享的文件地址,必须为本地路径或临时路径 */
+ filePath: string
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: ShareFileMessageCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: ShareFileMessageFailCallback
+ /** 自定义文件名,若留空则使用filePath中的文件名 */
+ fileName?: string
+ /** 接口调用成功的回调函数 */
+ success?: ShareFileMessageSuccessCallback
+ }
+ interface ShareFileToGroupOption {
+ /** 要分享的文件地址,必须为本地路径或临时路径 */
+ filePath: string
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: ShareFileToGroupCompleteCallback
+ /** 从消息小程序入口打开小程序的路径,默认为聊天工具启动路径 */
+ entrancePath?: string
+ /** 接口调用失败的回调函数 */
+ fail?: ShareFileToGroupFailCallback
+ /** 自定义文件名,若留空则使用filePath中的文件名 */
+ fileName?: string
+ /** 分享的图片消息是否要带小程序入口 */
+ needShowEntrance?: boolean
+ /** 接口调用成功的回调函数 */
+ success?: ShareFileToGroupSuccessCallback
+ }
+ interface ShareImageToGroupOption {
+ /** 要分享的图片地址,必须为本地路径或临时路径 */
+ imagePath: string
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: ShareImageToGroupCompleteCallback
+ /** 从消息小程序入口打开小程序的路径,默认为聊天工具启动路径 */
+ entrancePath?: string
+ /** 接口调用失败的回调函数 */
+ fail?: ShareImageToGroupFailCallback
+ /** 分享的图片消息是否要带小程序入口 */
+ needShowEntrance?: boolean
+ /** 接口调用成功的回调函数 */
+ success?: ShareImageToGroupSuccessCallback
+ }
+ interface ShareToOfficialAccountOption {
+ /** 公众号文章标题 */
+ title: string
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: ShareToOfficialAccountCompleteCallback
+ /** 公众号文章正文 */
+ content?: string
+ /** 接口调用失败的回调函数 */
+ fail?: ShareToOfficialAccountFailCallback
+ /** 公众号文章图片,必须为本地路径或临时路径 */
+ images?: string[]
+ /** 接口调用成功的回调函数 */
+ success?: ShareToOfficialAccountSuccessCallback
+ /** 公众号文章标签 */
+ tags?: string[]
+ }
+ interface ShareToWeRunOption {
+ /** 运动数据列表 */
+ recordList: WxaSportRecord[]
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: ShareToWeRunCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: ShareToWeRunFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: ShareToWeRunSuccessCallback
+ }
+ interface ShareVideoMessageOption {
+ /** 要分享的视频地址,必须为本地路径或临时路径 */
+ videoPath: string
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: ShareVideoMessageCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: ShareVideoMessageFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: ShareVideoMessageSuccessCallback
+ /** 缩略图路径,若留空则使用视频首帧 */
+ thumbPath?: string
+ }
+ interface ShareVideoToGroupOption {
+ /** 要分享的视频地址,必须为本地路径或临时路径 */
+ videoPath: string
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: ShareVideoToGroupCompleteCallback
+ /** 从消息小程序入口打开小程序的路径,默认为聊天工具启动路径 */
+ entrancePath?: string
+ /** 接口调用失败的回调函数 */
+ fail?: ShareVideoToGroupFailCallback
+ /** 分享的图片消息是否要带小程序入口 */
+ needShowEntrance?: boolean
+ /** 接口调用成功的回调函数 */
+ success?: ShareVideoToGroupSuccessCallback
+ /** 缩略图路径,若留空则使用视频首帧 */
+ thumbPath?: string
+ }
+ /** 需要基础库: `3.2.1`
+ *
+ * 鞋部检测配置。用法详情[指南文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/visionkit/shoe.html)。 */
+ interface ShoeTrack {
+ /** 需要基础库: `3.2.1`
+ *
+ * 鞋部检测模式
+ *
+ * 可选值:
+ * - 1: 通过摄像头实时检测; */
+ mode: 1
+ }
interface ShowActionSheetOption {
/** 按钮的文字数组,数组长度最大为 6 */
itemList: string[]
- /** 警示文案
+ /** 需要基础库: `2.14.0`
*
- * 最低基础库: `2.14.0` */
+ * 警示文案 */
alertText?: string
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: ShowActionSheetCompleteCallback
@@ -5158,17 +11843,17 @@ innerAudioContext.onError((res) => {
confirmColor?: string
/** 确认按钮的文字,最多 4 个字符 */
confirmText?: string
- /** 提示的内容,editable 为 true 时,会输入框默认文本 */
+ /** 提示的内容 */
content?: string
- /** 是否显示输入框
+ /** 需要基础库: `2.17.1`
*
- * 最低基础库: `2.15.0` */
+ * 是否显示输入框 */
editable?: boolean
/** 接口调用失败的回调函数 */
fail?: ShowModalFailCallback
- /** 输入框提示文本
+ /** 需要基础库: `2.17.1`
*
- * 最低基础库: `2.15.0` */
+ * 显示输入框时的提示文本 */
placeholderText?: string
/** 是否显示取消按钮 */
showCancel?: boolean
@@ -5178,9 +11863,9 @@ innerAudioContext.onError((res) => {
title?: string
}
interface ShowModalSuccessCallbackResult {
- /** 为 true 时,表示用户点击了取消(用于 Android 系统区分点击蒙层关闭还是点击取消按钮关闭)
+ /** 需要基础库: `1.1.0`
*
- * 最低基础库: `1.1.0` */
+ * 为 true 时,表示用户点击了取消(用于 Android 系统区分点击蒙层关闭还是点击取消按钮关闭) */
cancel: boolean
/** 为 true 时,表示用户点击了确定按钮 */
confirm: boolean
@@ -5211,8 +11896,16 @@ innerAudioContext.onError((res) => {
path: string
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: ShowShareImageMenuCompleteCallback
+ /** 需要基础库: `3.2.0`
+ *
+ * 发送给朋友时,小程序入口打开小程序的路径,如果当前页面允许分享给朋友,则默认为当前页面路径,否则默认为小程序首页 */
+ entrancePath?: string
/** 接口调用失败的回调函数 */
fail?: ShowShareImageMenuFailCallback
+ /** 需要基础库: `3.2.0`
+ *
+ * 分享的图片消息是否要带小程序入口 */
+ needShowEntrance?: boolean
/** 接口调用成功的回调函数 */
success?: ShowShareImageMenuSuccessCallback
}
@@ -5221,9 +11914,9 @@ innerAudioContext.onError((res) => {
complete?: ShowShareMenuCompleteCallback
/** 接口调用失败的回调函数 */
fail?: ShowShareMenuFailCallback
- /** 本接口为 Beta 版本,暂只在 Android 平台支持。需要显示的转发按钮名称列表,默认['shareAppMessage']。按钮名称合法值包含 "shareAppMessage"、"shareTimeline" 两种
+ /** 需要基础库: `2.11.3`
*
- * 最低基础库: `2.11.3` */
+ * 本接口为 Beta 版本,暂只在 Android 平台支持。需要显示的转发按钮名称列表,默认['shareAppMessage']。按钮名称合法值包含 "shareAppMessage"、"shareTimeline" 两种 */
menus?: string[]
/** 接口调用成功的回调函数 */
success?: ShowShareMenuSuccessCallback
@@ -5267,24 +11960,105 @@ innerAudioContext.onError((res) => {
* - 'loading': 显示加载图标,此时 title 文本最多显示 7 个汉字长度;
* - 'none': 不显示图标,此时 title 文本最多可显示两行,[1.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)及以上版本支持; */
icon?: 'success' | 'error' | 'loading' | 'none'
- /** 自定义图标的本地路径,image 的优先级高于 icon
+ /** 需要基础库: `1.1.0`
*
- * 最低基础库: `1.1.0` */
+ * 自定义图标的本地路径,image 的优先级高于 icon */
image?: string
/** 是否显示透明蒙层,防止触摸穿透 */
mask?: boolean
/** 接口调用成功的回调函数 */
success?: ShowToastSuccessCallback
}
+ /** 具体支付参数见signData, 该参数需以string形式传递, 例如signData: '{"offerId":"123","buyQuantity":1,"env":0,"currencyType":"CNY","productId":"testproductId","goodsPrice":10,"outTradeNo":"xxxxxx","attach":"testdata"}' */
+ interface SignData {
+ /** 透传数据, 发货通知时会透传给开发者 */
+ attach: string
+ /** 购买数量 */
+ buyQuantity: number
+ /** 币种
+ *
+ * 可选值:
+ * - 'CNY': 人民币; */
+ currencyType: 'CNY'
+ /** 在米大师侧申请的应用 id, mp-支付基础配置中的offerid */
+ offerId: string
+ /** 业务订单号, 每个订单号只能使用一次, 重复使用会失败(极端情况不保证唯一, 不建议业务强依赖唯一性). 要求8-32个字符内, 只能是数字、大小写字母、符号 _-|*@组成, 不能以下划线(_)开头 */
+ outTradeNo: string
+ /** 环境配置, 0 米大师正式环境, 1 米大师沙箱环境, 默认为 0 */
+ env?: number
+ /** 道具单价(分), **该字段仅mode=short_series_goods时需要必填**, 用来校验价格与后台道具价格是否一致, 避免用户在业务商城页看到的价格与实际价格不一致导致投诉 */
+ goodsPrice?: number
+ /** 道具ID, **该字段仅mode=short_series_goods时需要必填** */
+ productId?: string
+ }
+ /** SimplePKPass 的 JSON字符串,这里给出定义,需要进行 JSON.parse 后才可使用 */
+ interface SimplePKPass {
+ /** 设备端生成的虚拟卡唯一标识符(用于本地关联安全元件中的卡片) */
+ deviceAccountIdentifier: string
+ /** 设备虚拟卡号的后缀(如虚拟卡号末4位) */
+ deviceAccountNumberSuffix: string
+ /** 设备端卡片的唯一 Pass ID(用于与 Wallet 应用交互) */
+ devicePassIdentifier: string
+ /** 是否为远程同步的卡片(如通过 iCloud 同步到设备的卡片) */
+ isRemotePass: boolean
+ /** 配对的终端设备标识符(如交通闸机设备 ID) */
+ pairedTerminalIdentifier: string
+ /** 卡片激活状态,具体值参考 PKSecureElementPassActivationState */
+ passActivationState: number
+ /** 支付卡的主账户唯一标识符(由 Apple Pay 生成,用于设备端管理) */
+ primaryAccountIdentifier: string
+ /** 主实体卡号的后缀(如卡号末4位) */
+ primaryAccountNumberSuffix: string
+ }
interface Size {
/** 变化后的窗口高度,单位 px */
windowHeight: number
/** 变化后的窗口宽度,单位 px */
windowWidth: number
}
- /** 网络请求过程中一些调试信息
+ /** 当前运行环境对于 [Skyline 渲染引擎](https://developers.weixin.qq.com/miniprogram/dev/framework/runtime/skyline/introduction.html) 的支持情况 */
+ interface SkylineInfo {
+ /** 当前运行环境是否支持 [Skyline 渲染引擎](https://developers.weixin.qq.com/miniprogram/dev/framework/runtime/skyline/introduction.html) */
+ isSupported: boolean
+ /** 当前运行环境 [Skyline 渲染引擎](https://developers.weixin.qq.com/miniprogram/dev/framework/runtime/skyline/introduction.html) 的版本号,形如 `0.9.7` */
+ version: string
+ /** 当前运行环境不支持 [Skyline 渲染引擎](https://developers.weixin.qq.com/miniprogram/dev/framework/runtime/skyline/introduction.html) 的原因,仅在 `isSupported` 为 `false` 时出现
+ *
+ * 可选值:
+ * - 'client not supported': 当前微信客户端不支持 [Skyline 渲染引擎](https://developers.weixin.qq.com/miniprogram/dev/framework/runtime/skyline/introduction.html),可以尝试通过升级微信客户端解决;
+ * - 'baselib not supported': 当前基础库不支持 [Skyline 渲染引擎](https://developers.weixin.qq.com/miniprogram/dev/framework/runtime/skyline/introduction.html),基础库会自动更新到当前客户端所能支持的最新的版本,基础库不支持时也可以尝试通过升级微信客户端解决;
+ * - 'a-b test not enabled': 命中了 _We 分析_ 平台上的 AB 实验关闭的情况。详细可以查看 [Skyline 起步 > 配置 We 分析 AB 实验]((skyline/migration#%E9%85%8D%E7%BD%AE-We-%E5%88%86%E6%9E%90-AB-%E5%AE%9E%E9%AA%8C)) 一节;
+ * - 'SwitchRender option set to webview': 本地调试的快捷切换入口被设置为了强制使用 Webview. 详情可以查看 [Skyline 起步 > 快捷切换入口](#) 一节; */
+ reason?:
+ | 'client not supported'
+ | 'baselib not supported'
+ | 'a-b test not enabled'
+ | 'SwitchRender option set to webview'
+ }
+ /** Snapshot 实例,可通过 [SelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html) 获取。
*
- * 最低基础库: `2.10.4` */
+ * [Snapshot](https://developers.weixin.qq.com/miniprogram/dev/api/skyline/Snapshot.html) 通过 `id` 跟一个 [snapshot](https://developers.weixin.qq.com/miniprogram/dev/component/snapshot.html) 组件绑定,操作对应的 [snapshot](https://developers.weixin.qq.com/miniprogram/dev/component/snapshot.html) 组件。
+ *
+ * **示例代码**
+ *
+ * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/jdkplEm17hJP) */
+ interface Snapshot {
+ /** 画布高度 */
+ height: number
+ /** 画布宽度 */
+ width: number
+ /** [Snapshot.takeSnapshot(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/skyline/Snapshot.takeSnapshot.html)
+ *
+ * 需要基础库: `3.0.0`
+ *
+ * 在插件中使用:支持
+ *
+ * 对 snapshot 组件子树进行截图 */
+ takeSnapshot(option: TakeSnapshotOption): void
+ }
+ /** 需要基础库: `2.10.4`
+ *
+ * 网络请求过程中一些调试信息 */
interface SocketProfile {
/** 完成建立连接的时间(完成握手),如果是持久连接,则与 fetchStart 值相等。注意如果在传输层发生了错误且重新建立连接,则这里显示的是新建立的连接完成的时间。注意这里握手结束,包括安全连接建立完成、SOCKS 授权通过 */
connectEnd: number
@@ -5293,9 +12067,9 @@ innerAudioContext.onError((res) => {
/** 上层请求到返回的耗时 */
cost: number
/** DNS 域名查询完成的时间,如果使用了本地缓存(即无 DNS 查询)或持久连接,则与 fetchStart 值相等 */
- domainLookupEnd: number
+ domainLookUpEnd: number
/** DNS 域名查询开始的时间,如果使用了本地缓存(即无 DNS 查询)或持久连接,则与 fetchStart 值相等 */
- domainLookupStart: number
+ domainLookUpStart: number
/** 组件准备好使用 SOCKET 建立请求的时间,这发生在检查本地缓存之前 */
fetchStart: number
/** 握手耗时 */
@@ -5315,13 +12089,13 @@ innerAudioContext.onError((res) => {
/** 接口调用成功的回调函数 */
success?: SocketTaskCloseSuccessCallback
}
- interface SocketTaskOnCloseCallbackResult {
+ interface SocketTaskOnCloseListenerResult {
/** 一个数字值表示关闭连接的状态号,表示连接被关闭的原因。 */
code: number
/** 一个可读的字符串,表示连接被关闭的原因。 */
reason: string
}
- interface SocketTaskOnMessageCallbackResult {
+ interface SocketTaskOnMessageListenerResult {
/** 服务器返回的消息 */
data: string | ArrayBuffer
}
@@ -5335,19 +12109,36 @@ innerAudioContext.onError((res) => {
/** 接口调用成功的回调函数 */
success?: SendSuccessCallback
}
+ /** 动画配置 */
+ interface SpringOption {
+ /** 阻尼系数 */
+ damping?: number
+ /** 重量系数,值越大移动越慢 */
+ mass?: number
+ /** 动画是否可以在指定值上反弹 */
+ overshootClamping?: boolean
+ /** 弹簧静止时的位移 */
+ restDisplacementThreshold?: number
+ /** 弹簧静止的速度 */
+ restSpeedThreshold?: number
+ /** 弹性系数 */
+ stiffness?: number
+ /** 速度 */
+ velocity?: number
+ }
interface StartAccelerometerOption {
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: StartAccelerometerCompleteCallback
/** 接口调用失败的回调函数 */
fail?: StartAccelerometerFailCallback
- /** 监听加速度数据回调函数的执行频率
+ /** 需要基础库: `2.1.0`
+ *
+ * 监听加速度数据回调函数的执行频率
*
* 可选值:
* - 'game': 适用于更新游戏的回调频率,在 20ms/次 左右;
* - 'ui': 适用于更新 UI 的回调频率,在 60ms/次 左右;
- * - 'normal': 普通的回调频率,在 200ms/次 左右;
- *
- * 最低基础库: `2.1.0` */
+ * - 'normal': 普通的回调频率,在 200ms/次 左右; */
interval?: 'game' | 'ui' | 'normal'
/** 接口调用成功的回调函数 */
success?: StartAccelerometerSuccessCallback
@@ -5370,13 +12161,13 @@ innerAudioContext.onError((res) => {
success?: StartAdvertisingSuccessCallback
}
interface StartBeaconDiscoveryOption {
- /** iBeacon 设备广播的 uuid 列表 */
+ /** Beacon 设备广播的 UUID 列表 */
uuids: string[]
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: StartBeaconDiscoveryCompleteCallback
/** 接口调用失败的回调函数 */
fail?: StartBeaconDiscoveryFailCallback
- /** 是否校验蓝牙开关,仅在 iOS 下有效 */
+ /** 是否校验蓝牙开关,仅在 iOS 下有效。iOS 11 起,控制面板里关掉蓝牙,还是能继续使用 Beacon 服务。 */
ignoreBluetoothAvailable?: boolean
/** 接口调用成功的回调函数 */
success?: StartBeaconDiscoverySuccessCallback
@@ -5388,20 +12179,28 @@ innerAudioContext.onError((res) => {
complete?: StartBluetoothDevicesDiscoveryCompleteCallback
/** 接口调用失败的回调函数 */
fail?: StartBluetoothDevicesDiscoveryFailCallback
- /** 上报设备的间隔。0 表示找到新设备立即上报,其他数值根据传入的间隔上报。 */
+ /** 上报设备的间隔,单位 ms。0 表示找到新设备立即上报,其他数值根据传入的间隔上报。 */
interval?: number
- /** 扫描模式,越高扫描越快,也越耗电, 仅安卓 7.0.12 及以上支持。
+ /** 扫描模式,越高扫描越快,也越耗电。仅安卓微信客户端 7.0.12 及以上支持。
*
* 可选值:
* - 'low': 低;
* - 'medium': 中;
* - 'high': 高; */
powerLevel?: 'low' | 'medium' | 'high'
- /** 要搜索的蓝牙设备主 service 的 uuid 列表。某些蓝牙设备会广播自己的主 service 的 uuid。如果设置此参数,则只搜索广播包有对应 uuid 的主服务的蓝牙设备。建议主要通过该参数过滤掉周边不需要处理的其他蓝牙设备。 */
+ /** 要搜索的蓝牙设备主服务的 UUID 列表(支持 16/32/128 位 UUID)。某些蓝牙设备会广播自己的主 service 的 UUID。如果设置此参数,则只搜索广播包有对应 UUID 的主服务的蓝牙设备。建议通过该参数过滤掉周边不需要处理的其他蓝牙设备。 */
services?: string[]
/** 接口调用成功的回调函数 */
success?: StartBluetoothDevicesDiscoverySuccessCallback
}
+ interface StartCastingOption {
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: StartCastingCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: StartCastingFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: StartCastingSuccessCallback
+ }
interface StartCompassOption {
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: StartCompassCompleteCallback
@@ -5483,6 +12282,8 @@ innerAudioContext.onError((res) => {
fail?: StartLocationUpdateBackgroundFailCallback
/** 接口调用成功的回调函数 */
success?: StartLocationUpdateBackgroundSuccessCallback
+ /** wgs84 返回 gps 坐标,gcj02 返回可用于 wx.openLocation 的坐标 */
+ type?: string
}
interface StartLocationUpdateOption {
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
@@ -5491,6 +12292,8 @@ innerAudioContext.onError((res) => {
fail?: StartLocationUpdateFailCallback
/** 接口调用成功的回调函数 */
success?: StartLocationUpdateSuccessCallback
+ /** wgs84 返回 gps 坐标,gcj02 返回可用于 wx.openLocation 的坐标 */
+ type?: string
}
interface StartPreviewOption {
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
@@ -5558,15 +12361,6 @@ innerAudioContext.onError((res) => {
/** 接口调用成功的回调函数 */
success?: StartWifiSuccessCallback
}
- interface StatFailCallbackResult {
- /** 错误信息
- *
- * 可选值:
- * - 'fail permission denied, open ${path}': 指定的 path 路径没有读权限;
- * - 'fail no such file or directory ${path}': 文件不存在;
- * - 'fail sdcard not mounted': Android sdcard 挂载失败; */
- errMsg: string
- }
interface StatOption {
/** 文件/目录路径 (本地路径) */
path: string
@@ -5574,18 +12368,18 @@ innerAudioContext.onError((res) => {
complete?: StatCompleteCallback
/** 接口调用失败的回调函数 */
fail?: StatFailCallback
- /** 是否递归获取目录下的每个文件的 Stats 信息
+ /** 需要基础库: `2.3.0`
*
- * 最低基础库: `2.3.0` */
+ * 是否递归获取目录下的每个文件的 Stats 信息 */
recursive?: boolean
/** 接口调用成功的回调函数 */
success?: StatSuccessCallback
}
interface StatSuccessCallbackResult {
- /** [Stats](https://developers.weixin.qq.com/miniprogram/dev/api/file/Stats.html)|Object
+ /** [Stats](https://developers.weixin.qq.com/miniprogram/dev/api/file/Stats.html)|Array.<[FileStats](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileStats.html)>
*
- * 当 recursive 为 false 时,res.stats 是一个 Stats 对象。当 recursive 为 true 且 path 是一个目录的路径时,res.stats 是一个 Object,key 以 path 为根路径的相对路径,value 是该路径对应的 Stats 对象。 */
- stats: Stats | IAnyObject
+ * 当 recursive 为 false 时,res.stats 是一个 Stats 对象。当 recursive 为 true 且 path 是一个目录的路径时,res.stats 是一个 Array,数组的每一项是一个对象,每个对象包含 path 和 stats。 */
+ stats: Stats | FileStats[]
errMsg: string
}
/** 描述文件状态的对象 */
@@ -5595,9 +12389,21 @@ innerAudioContext.onError((res) => {
/** 文件最后一次被修改的时间,UNIX 时间戳,对应 POSIX stat.st_mtime */
lastModifiedTime: number
/** 文件的类型和存取的权限,对应 POSIX stat.st_mode */
- mode: string
+ mode: number
/** 文件大小,单位:B,对应 POSIX stat.st_size */
size: number
+ /** [boolean Stats.isDirectory()](https://developers.weixin.qq.com/miniprogram/dev/api/file/Stats.isDirectory.html)
+ *
+ * 在插件中使用:需要基础库 `2.19.2`
+ *
+ * 判断当前文件是否一个目录 */
+ isDirectory(): boolean
+ /** [boolean Stats.isFile()](https://developers.weixin.qq.com/miniprogram/dev/api/file/Stats.isFile.html)
+ *
+ * 在插件中使用:需要基础库 `2.19.2`
+ *
+ * 判断当前文件是否一个普通文件 */
+ isFile(): boolean
}
interface StepOption {
/** 动画延迟时间,单位 ms */
@@ -5624,6 +12430,75 @@ innerAudioContext.onError((res) => {
| 'step-end'
transformOrigin?: string
}
+ /** 贴纸类型 */
+ interface Sticker {
+ /** 贴纸帧数 */
+ len: number
+ /** 贴纸资源路径。资源必须为一个资源文件夹路径或一个压缩包路径,文件夹或压缩包内的贴纸资源必须按照 `{title}_{index}.{ext}` 格式命名。其中 `{title}` 为贴纸名称;`{index}` 为帧序号,从0开始;`{ext}` 为拓展名。 */
+ path: string
+ /** 贴纸名称 */
+ title: string
+ /** 贴纸触发动作
+ *
+ * 可选值:
+ * - -1: 循环播放;
+ * - 10: 张嘴;
+ * - 11: 噘嘴/kiss;
+ * - 12: 眨/闭左眼;
+ * - 13: 眨/闭右眼;
+ * - 14: 眨/闭眼;
+ * - 15: 挑眉毛;
+ * - 16: 左右摇头;
+ * - 17: 上下点头;
+ * - 100: 比心;
+ * - 101: 张开手掌;
+ * - 102: 剪刀手/比耶/胜利;
+ * - 103: 握拳;
+ * - 104: 数字1;
+ * - 105: 我爱你;
+ * - 106: 点赞;
+ * - 107: OK;
+ * - 108: Rock&Roll;
+ * - 109: 数字6;
+ * - 110: 数字8;
+ * - 111: 暂不支持(留空);
+ * - 112: 双手抱拳/恭喜发财; */
+ active?:
+ | -1
+ | 10
+ | 11
+ | 12
+ | 13
+ | 14
+ | 15
+ | 16
+ | 17
+ | 100
+ | 101
+ | 102
+ | 103
+ | 104
+ | 105
+ | 106
+ | 107
+ | 108
+ | 109
+ | 110
+ | 111
+ | 112
+ /** 贴纸ID */
+ id?: string
+ /** 贴纸资源 md5 */
+ md5?: string
+ /** 贴纸位置,格式为 [x1,y1,x2,y2] 。当 `type` 为 `'2D'` 或 `'front'` 时必填。仅 2D 贴纸和前景贴纸有效 */
+ pos?: string[]
+ /** 背景贴纸展示位置。仅背景贴纸有效
+ *
+ * 可选值:
+ * - 0: 背景贴纸;
+ * - 1: 只在人像区域显示的贴纸; */
+ segtype?: 0 | 1
+ }
interface StopAccelerometerOption {
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: StopAccelerometerCompleteCallback
@@ -5696,6 +12571,14 @@ innerAudioContext.onError((res) => {
/** 接口调用成功的回调函数 */
success?: StopDiscoverySuccessCallback
}
+ interface StopFaceDetectOption {
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: StopFaceDetectCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: StopFaceDetectFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: StopFaceDetectSuccessCallback
+ }
interface StopGyroscopeOption {
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: StopGyroscopeCompleteCallback
@@ -5796,7 +12679,6 @@ innerAudioContext.onError((res) => {
*
* **示例代码**
*
-*
* ```javascript
wx.getSetting({
withSubscriptions: true,
@@ -5822,7 +12704,7 @@ wx.getSetting({
interface SubscriptionsSetting {
/** 订阅消息总开关,true为开启,false为关闭 */
mainSwitch: boolean
- /** 每一项订阅消息的订阅状态。itemSettings对象的键为**一次性订阅消息的模板id**或**系统订阅消息的类型**,值为'accept'、'reject'、'ban'中的其中一种。'accept'表示用户同意订阅这条消息,'reject'表示用户拒绝订阅这条消息,'ban'表示已被后台封禁。一次性订阅消息使用方法详见 [wx.requestSubscribeMessage](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/subscribe-message/wx.requestSubscribeMessage.html),永久订阅消息(仅小游戏可用)使用方法详见[wx.requestSubscribeSystemMessage](/minigame/dev/api/open-api/subscribe-message/wx.requestSubscribeSystemMessage.html)
+ /** 每一项订阅消息的订阅状态。itemSettings对象的键为**一次性订阅消息的模板id**或**系统订阅消息的类型**,值为'accept'、'reject'、'ban'中的其中一种。'accept'表示用户同意订阅这条消息,'reject'表示用户拒绝订阅这条消息,'ban'表示已被后台封禁。一次性订阅消息使用方法详见 [wx.requestSubscribeMessage](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/subscribe-message/wx.requestSubscribeMessage.html),永久订阅消息(仅小游戏可用)使用方法详见[wx.requestSubscribeSystemMessage](https://developers.weixin.qq.com/minigame/dev/api/open-api/subscribe-message/wx.requestSubscribeSystemMessage.html)
* ## 注意事项
* - itemSettings 只返回用户勾选过订阅面板中的“总是保持以上选择,不再询问”的订阅消息。 */
itemSettings?: IAnyObject
@@ -5835,6 +12717,14 @@ wx.getSetting({
/** 接口调用成功的回调函数 */
success?: SwitchCameraSuccessCallback
}
+ interface SwitchCastingOption {
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: SwitchCastingCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: SwitchCastingFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: SwitchCastingSuccessCallback
+ }
interface SwitchTabOption {
/** 需要跳转的 tabBar 页面的路径 (代码包路径)(需在 app.json 的 [tabBar](https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/app.html#tabbar) 字段定义的页面),路径后不能带参数。 */
url: string
@@ -5846,119 +12736,198 @@ wx.getSetting({
success?: SwitchTabSuccessCallback
}
interface SystemInfo {
- /** 客户端基础库版本
+ /** 需要基础库: `1.1.0`
*
- * 最低基础库: `1.1.0` */
+ * 客户端基础库版本 */
SDKVersion: string
- /** 允许微信使用相册的开关(仅 iOS 有效)
+ /** 需要基础库: `2.6.0`
*
- * 最低基础库: `2.6.0` */
+ * 允许微信使用相册的开关(仅 iOS 有效) */
albumAuthorized: boolean
- /** 设备性能等级(仅 Android)。取值为:-2 或 0(该设备无法运行小游戏),-1(性能未知),>=1(设备性能值,该值越高,设备性能越好,目前最高不到50)
+ /** 需要基础库: `1.8.0`
*
- * 最低基础库: `1.8.0` */
+ * 设备性能等级(仅 Android)。取值为:-2 或 0(该设备无法运行小游戏),-1(性能未知),>=1(设备性能值,该值越高,设备性能越好) 注意:性能等级当前仅反馈真机机型,暂不支持 IDE 模拟器机型 */
benchmarkLevel: number
- /** 蓝牙的系统开关
+ /** 需要基础库: `2.6.0`
*
- * 最低基础库: `2.6.0` */
+ * 蓝牙的系统开关 */
bluetoothEnabled: boolean
- /** 设备品牌
+ /** 需要基础库: `1.5.0`
*
- * 最低基础库: `1.5.0` */
+ * 设备品牌 */
brand: string
- /** 允许微信使用摄像头的开关
+ /** 需要基础库: `2.6.0`
*
- * 最低基础库: `2.6.0` */
+ * 允许微信使用摄像头的开关 */
cameraAuthorized: boolean
- /** 设备方向
+ /** 设备方向(注意:IOS客户端横屏游戏获取deviceOrientation可能不准,建议以屏幕宽高为准)
*
* 可选值:
* - 'portrait': 竖屏;
* - 'landscape': 横屏; */
deviceOrientation: 'portrait' | 'landscape'
- /** 是否已打开调试。可通过右上角菜单或 [wx.setEnableDebug](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/wx.setEnableDebug.html) 打开调试。
+ /** 需要基础库: `2.15.0`
*
- * 最低基础库: `2.15.0` */
+ * 是否已打开调试。可通过右上角菜单或 [wx.setEnableDebug](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/wx.setEnableDebug.html) 打开调试。 */
enableDebug: boolean
- /** 用户字体大小(单位px)。以微信客户端「我-设置-通用-字体大小」中的设置为准
+ /** 需要基础库: `1.5.0`
*
- * 最低基础库: `1.5.0` */
+ * 用户字体大小(单位px)。以微信客户端「我-设置-通用-字体大小」中的设置为准 */
fontSizeSetting: number
+ /** 需要基础库: `2.12.3`
+ *
+ * 当前小程序运行的宿主环境 */
+ host: SystemInfoHost
/** 微信设置的语言 */
language: string
- /** 允许微信使用定位的开关
+ /** 需要基础库: `2.6.0`
*
- * 最低基础库: `2.6.0` */
+ * 允许微信使用定位的开关 */
locationAuthorized: boolean
- /** 地理位置的系统开关
+ /** 需要基础库: `2.6.0`
*
- * 最低基础库: `2.6.0` */
+ * 地理位置的系统开关 */
locationEnabled: boolean
/** `true` 表示模糊定位,`false` 表示精确定位,仅 iOS 支持 */
locationReducedAccuracy: boolean
- /** 允许微信使用麦克风的开关
+ /** 需要基础库: `2.6.0`
*
- * 最低基础库: `2.6.0` */
+ * 允许微信使用麦克风的开关 */
microphoneAuthorized: boolean
/** 设备型号。新机型刚推出一段时间会显示unknown,微信会尽快进行适配。 */
model: string
- /** 允许微信通知带有提醒的开关(仅 iOS 有效)
+ /** 需要基础库: `2.6.0`
*
- * 最低基础库: `2.6.0` */
+ * 允许微信通知带有提醒的开关(仅 iOS 有效) */
notificationAlertAuthorized: boolean
- /** 允许微信通知的开关
+ /** 需要基础库: `2.6.0`
*
- * 最低基础库: `2.6.0` */
+ * 允许微信通知的开关 */
notificationAuthorized: boolean
- /** 允许微信通知带有标记的开关(仅 iOS 有效)
+ /** 需要基础库: `2.6.0`
*
- * 最低基础库: `2.6.0` */
+ * 允许微信通知带有标记的开关(仅 iOS 有效) */
notificationBadgeAuthorized: boolean
- /** 允许微信通知带有声音的开关(仅 iOS 有效)
+ /** 需要基础库: `2.6.0`
*
- * 最低基础库: `2.6.0` */
+ * 允许微信通知带有声音的开关(仅 iOS 有效) */
notificationSoundAuthorized: boolean
+ /** 需要基础库: `2.19.3`
+ *
+ * 允许微信使用日历的开关 */
+ phoneCalendarAuthorized: boolean
/** 设备像素比 */
pixelRatio: number
- /** 客户端平台 */
- platform: string
- /** 在竖屏正方向下的安全区域
+ /** 客户端平台
*
- * 最低基础库: `2.7.0` */
+ * 可选值:
+ * - 'ios': iOS微信(包含 iPhone、iPad);
+ * - 'android': Android微信;
+ * - 'ohos': HarmonyOS微信;
+ * - 'windows': Windows微信;
+ * - 'mac': macOS微信;
+ * - 'devtools': 微信开发者工具; */
+ platform: 'ios' | 'android' | 'ohos' | 'windows' | 'mac' | 'devtools'
+ /** 需要基础库: `2.7.0`
+ *
+ * 在竖屏正方向下的安全区域。部分机型没有安全区域概念,也不会返回 safeArea 字段,开发者需自行兼容。 */
safeArea: SafeArea
- /** 屏幕高度,单位px
+ /** 需要基础库: `1.1.0`
*
- * 最低基础库: `1.1.0` */
+ * 屏幕高度,单位px */
screenHeight: number
- /** 屏幕宽度,单位px
+ /** 需要基础库: `1.1.0`
*
- * 最低基础库: `1.1.0` */
+ * 屏幕宽度,单位px */
screenWidth: number
- /** 状态栏的高度,单位px
+ /** 需要基础库: `1.9.0`
*
- * 最低基础库: `1.9.0` */
+ * 状态栏的高度,单位px */
statusBarHeight: number
/** 操作系统及版本 */
system: string
/** 微信版本号 */
version: string
- /** Wi-Fi 的系统开关
+ /** 需要基础库: `2.6.0`
*
- * 最低基础库: `2.6.0` */
+ * Wi-Fi 的系统开关 */
wifiEnabled: boolean
/** 可使用窗口高度,单位px */
windowHeight: number
/** 可使用窗口宽度,单位px */
windowWidth: number
- /** 系统当前主题,取值为`light`或`dark`,全局配置`"darkmode":true`时才能获取,否则为 undefined (不支持小游戏)
+ /** 需要基础库: `2.11.0`
+ *
+ * 系统当前主题,取值为`light`或`dark`,全局配置`"darkmode":true`时才能获取,否则为 undefined (不支持小游戏)
*
* 可选值:
* - 'dark': 深色主题;
- * - 'light': 浅色主题;
- *
- * 最低基础库: `2.11.0` */
+ * - 'light': 浅色主题; */
theme?: 'dark' | 'light'
}
+ /** 需要基础库: `2.12.3`
+ *
+ * 当前小程序运行的宿主环境 */
+ interface SystemInfoHost {
+ /** 宿主 app 对应的 appId */
+ appId: string
+ }
+ interface SystemSetting {
+ /** 蓝牙的系统开关 */
+ bluetoothEnabled: boolean
+ /** 设备方向(注意:IOS客户端横屏游戏获取deviceOrientation可能不准,建议以屏幕宽高为准)
+ *
+ * 可选值:
+ * - 'portrait': 竖屏;
+ * - 'landscape': 横屏; */
+ deviceOrientation: 'portrait' | 'landscape'
+ /** 地理位置的系统开关 */
+ locationEnabled: boolean
+ /** Wi-Fi 的系统开关 */
+ wifiEnabled: boolean
+ }
+ /** 需要基础库: `3.4.0`
+ *
+ * 异常信息 */
+ interface TCPExceptionReason {
+ /** 错误原因 */
+ errMsg: string
+ /** 错误码 */
+ errno: string
+ }
+ interface TCPSocketConnectOption {
+ /** 套接字要连接的地址 */
+ address: string
+ /** 套接字要连接的端口 */
+ port: number
+ /** 需要基础库: `3.4.0`
+ *
+ * 是否开启 HttpDNS 服务。如开启,需要同时填入 httpDNSServiceId 。 HttpDNS 用法详见 [移动解析HttpDNS](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/HTTPDNS.html) */
+ enableHttpDNS?: boolean
+ /** 需要基础库: `3.4.0`
+ *
+ * HttpDNS 服务商 Id。 HttpDNS 用法详见 [移动解析HttpDNS](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/HTTPDNS.html) */
+ httpDNSServiceId?: string
+ /** 套接字要连接的超时时间,默认为 2s */
+ timeout?: number
+ }
+ interface TCPSocketOnMessageListenerResult {
+ /** 接收端地址信息 */
+ localInfo: OnMessageListenerResultLocalInfo
+ /** 收到的消息 */
+ message: ArrayBuffer
+ /** 发送端地址信息 */
+ remoteInfo: TCPSocketOnMessageListenerResultRemoteInfo
+ }
+ /** 发送端地址信息 */
+ interface TCPSocketOnMessageListenerResultRemoteInfo {
+ /** 发送消息的 socket 的地址 */
+ address: string
+ /** 使用的协议族,为 IPv4 或者 IPv6 */
+ family: string
+ /** 端口号 */
+ port: number
+ }
interface TakePhotoOption {
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: TakePhotoCompleteCallback
@@ -5969,8 +12938,13 @@ wx.getSetting({
* 可选值:
* - 'high': 高质量;
* - 'normal': 普通质量;
- * - 'low': 低质量; */
- quality?: 'high' | 'normal' | 'low'
+ * - 'low': 低质量;
+ * - 'original': 原图; */
+ quality?: 'high' | 'normal' | 'low' | 'original'
+ /** 需要基础库: `2.22.0`
+ *
+ * 是否开启镜像 */
+ selfieMirror?: boolean
/** 接口调用成功的回调函数 */
success?: TakePhotoSuccessCallback
}
@@ -5979,6 +12953,25 @@ wx.getSetting({
tempImagePath: string
errMsg: string
}
+ interface TakeSnapshotOption {
+ /** 截图文件格式,'rgba' 或 'png',默认值为 'png' */
+ format: string
+ /** 截图导出类型,'file' 保存到临时文件目录或 'arraybuffer' 返回图片二进制数据,默认值为 'file' */
+ type: string
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: TakeSnapshotCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: TakeSnapshotFailCallback
+ /** 接口调用成功的回调函数 */
+ success?: TakeSnapshotSuccessCallback
+ }
+ interface TakeSnapshotSuccessCallbackResult {
+ /** 截图对应的二进制数据,当 type 为 arraybuffer 该字段生效 */
+ data: ArrayBuffer
+ /** 截图保存的临时文件路径,当 type 为 file 该字段生效 */
+ tempFilePath: string
+ errMsg: string
+ }
/** 标签类型枚举 */
interface TechType {
/** 对应IsoDep实例,实例支持ISO-DEP (ISO 14443-4)标准的读写 */
@@ -5998,11 +12991,96 @@ wx.getSetting({
/** 对应NfcV实例,实例支持NFC-V (ISO 15693)标准的读写 */
nfcV: string
}
+ /** 需要基础库: `2.30.0`
+*
+* 在插件中使用:需要基础库 `2.30.0`
+*
+* Tensor
+*
+* ****
+*
+* ```js
+session.run({
+ input1: {
+ type: 'float32',
+ data: new Float32Array(3 * 224 * 224).buffer,
+ shape: [1, 3, 224, 224] // NCHW 顺序
+ },
+ input2: {
+ type: 'uint8',
+ data: new Uint8Array(224 * 224).buffer,
+ shape: [1, 1, 224, 224]
+ },
+}).then(res => {
+ console.log(res.output0)
+ // output0 结构如下:
+ // {
+ // type: 'uint8',
+ // data: new Uint8Array(224 * 224).buffer,
+ // shape: [1, 1, 224, 224]
+ // }
+})
+``` */
+ interface Tensor {
+ /** Tensor 值,一段 ArrayBuffer */
+ data: ArrayBuffer
+ /** Tensor shape (Tensor 形状,例如 `[1, 3, 224, 224]` 即表示一个4唯Tensor,每个维度的长度分别为1, 3, 224, 224) */
+ shape: number[]
+ /** ArrayBuffer 值的类型,合法值有 `uint8`, `int8`, `uint32`, `int32`, `float32` */
+ type: string
+ }
+ /** 需要基础库: `2.30.0`
+*
+* 在插件中使用:需要基础库 `2.30.0`
+*
+* Tensors 是 key-value 形式的对象,对象的 key 会作为 input/output name,对象的 value 则是 Tensor。 Tensor 结构如下。
+*
+* ****
+*
+* ```js
+session.run({
+ input1: {
+ type: 'float32',
+ data: new Float32Array(3 * 224 * 224).buffer,
+ shape: [1, 3, 224, 224] // NCHW 顺序
+ },
+ input2: {
+ type: 'uint8',
+ data: new Uint8Array(224 * 224).buffer,
+ shape: [1, 1, 224, 224]
+ },
+}).then(res => {
+ console.log(res.output0)
+ // output0 结构如下:
+ // {
+ // type: 'uint8',
+ // data: new Uint8Array(224 * 224).buffer,
+ // shape: [1, 1, 224, 224]
+ // }
+})
+``` */
+ interface Tensors {
+ /** [Tensor](https://developers.weixin.qq.com/miniprogram/dev/api/ai/inference/Tensor.html)
+ *
+ * Tensor,每个 Tensor 包含 shape、data、type 字段。 */
+ [key: string]: Tensor
+ }
interface TextMetrics {
/** 文本的宽度 */
width: number
}
+ /** 动画配置 */
+ interface TimingOption {
+ /** 动画时长 */
+ duration?: number
+ /** 动画曲线,参考 [Easing](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.Easing.html) 模块。 */
+ easing?: (...args: any[]) => any
+ }
interface ToScreenLocationOption {
+ /** 纬度 */
+ latitude: number
+ /** 经度 */
+ longitude: number
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: ToScreenLocationCompleteCallback
/** 接口调用失败的回调函数 */
@@ -6025,6 +13103,51 @@ wx.getSetting({
/** 接口调用成功的回调函数 */
success?: ToggleTorchSuccessCallback
}
+ /** 跟踪能力配置,目前不同的跟踪能力之间是互斥的,默认使用平面跟踪能力。需要注意目前 track 中不同的跟踪配置存在互斥关系(比如 marker 跟踪配置和 OSD 跟踪配置不能同时存在),请按需配置。 */
+ interface Track {
+ /** 平面跟踪配置 */
+ plane: PlaneTrack
+ /** 需要基础库: `3.3.0`
+ *
+ * 身份证检测配置。用法详情[指南文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/visionkit/idcard.html)。 */
+ IDCard?: IDCardTrack
+ /** 需要基础库: `2.27.0`
+ *
+ * OCR检测配置。用法详情[指南文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/visionkit/ocr.html)。 */
+ OCR?: OCRTrack
+ /** 需要基础库: `2.24.5`
+ *
+ * OSD 跟踪配置 */
+ OSD?: boolean
+ /** 需要基础库: `2.28.0`
+ *
+ * 人体检测配置。用法详情[指南文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/visionkit/body.html)。 */
+ body?: BodyTrack
+ /** 需要基础库: `3.0.0`
+ *
+ * 深度识别配置。用法详情[指南文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/visionkit/depth.html)。 */
+ depth?: DepthTrack
+ /** 需要基础库: `2.25.0`
+ *
+ * 人脸检测配置。用法详情[指南文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/visionkit/face.html)。安卓微信8.0.25开始支持,iOS微信8.0.24开始支持。 */
+ face?: FaceTrack
+ /** 需要基础库: `2.28.0`
+ *
+ * 手势检测配置。用法详情[指南文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/visionkit/hand.html)。 */
+ hand?: HandTrack
+ /** 需要基础库: `2.24.5`
+ *
+ * marker 跟踪配置,基础库(3.0.0)开始允许同时支持v2的水平面检测能力 */
+ marker?: boolean
+ /** 需要基础库: `3.2.1`
+ *
+ * 鞋部检测配置。用法详情[指南文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/visionkit/shoe.html)。 */
+ shoe?: ShoeTrack
+ /** 需要基础库: `2.28.0`
+ *
+ * 提供基础AR功能,输出相机旋转的3个自由度的位姿,利用手机陀螺仪传感器,实现快速稳定的AR定位能力,适用于简单AR场景。 */
+ threeDof?: boolean
+ }
interface TransceiveOption {
/** 需要传递的二进制数据 */
data: ArrayBuffer
@@ -6056,25 +13179,64 @@ wx.getSetting({
duration?: number
/** 接口调用失败的回调函数 */
fail?: TranslateMarkerFailCallback
- /** 平移和旋转同时进行
+ /** 需要基础库: `2.13.0`
*
- * 最低基础库: `2.13.0` */
+ * 平移和旋转同时进行 */
moveWithRotate?: boolean
/** 接口调用成功的回调函数 */
success?: TranslateMarkerSuccessCallback
}
- interface UDPSocketOnErrorCallbackResult {
- /** 错误信息 */
- errMsg: string
+ interface TriggerRefreshOption {
+ /** 动画时长 */
+ duration?: number
+ /** [动画曲线](#) */
+ easingFunction?: string
}
- interface UDPSocketOnMessageCallbackResult {
- /** 收到的消息 */
+ interface TruncateOption {
+ /** 要截断的文件路径 (本地路径) */
+ filePath: string
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
+ complete?: TruncateCompleteCallback
+ /** 接口调用失败的回调函数 */
+ fail?: TruncateFailCallback
+ /** 截断位置,默认0。如果 length 小于文件长度(字节),则只有前面 length 个字节会保留在文件中,其余内容会被删除;如果 length 大于文件长度,则会对其进行扩展,并且扩展部分将填充空字节('\0') */
+ length?: number
+ /** 接口调用成功的回调函数 */
+ success?: TruncateSuccessCallback
+ }
+ interface TruncateSyncOption {
+ /** 要截断的文件路径 (本地路径) */
+ filePath: string
+ /** 截断位置,默认0。如果 length 小于文件长度(字节),则只有前面 length 个字节会保留在文件中,其余内容会被删除;如果 length 大于文件长度,则会对其进行扩展,并且扩展部分将填充空字节('\0') */
+ length?: number
+ }
+ interface UDPSocketConnectOption {
+ /** 要发消息的地址 */
+ address: string
+ /** 要发送消息的端口号 */
+ port: number
+ }
+ interface UDPSocketOnMessageListenerResult {
+ /** 接收端地址信息,2.18.0 起支持 */
+ localInfo: OnMessageListenerResultLocalInfo
+ /** 收到的消息。消息长度需要小于4096。 */
message: ArrayBuffer
- /** 消息来源的结构化信息 */
- remoteInfo: RemoteInfo
+ /** 发送端地址信息 */
+ remoteInfo: UDPSocketOnMessageListenerResultRemoteInfo
+ }
+ /** 发送端地址信息 */
+ interface UDPSocketOnMessageListenerResultRemoteInfo {
+ /** 发送消息的 socket 的地址 */
+ address: string
+ /** 使用的协议族,为 IPv4 或者 IPv6 */
+ family: string
+ /** 端口号 */
+ port: number
+ /** message 的大小,单位:字节 */
+ size: number
}
interface UDPSocketSendOption {
- /** 要发消息的地址。在基础库 2.9.3 及之前版本可以是一个和本机同网段的 IP 地址,也可以是在安全域名列表内的域名地址;在基础库 2.9.4 及之后版本,可以是任意 IP 和域名 */
+ /** 要发消息的地址。在基础库 <= 2.9.3 版本必须是和本机同网段的 IP 地址,或安全域名列表内的域名地址;之后版本可以是任意 IP 和域名 */
address: string
/** 要发送的数据 */
message: string | ArrayBuffer
@@ -6084,6 +13246,8 @@ wx.getSetting({
length?: number
/** 发送数据的偏移量,仅当 message 为 ArrayBuffer 类型时有效 */
offset?: number
+ /** 向指定地址发消息时,是否要开启广播,基础库 2.24.0 开始支持 */
+ setBroadcast?: boolean
}
interface UndoOption {
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
@@ -6093,16 +13257,6 @@ wx.getSetting({
/** 接口调用成功的回调函数 */
success?: UndoSuccessCallback
}
- interface UnlinkFailCallbackResult {
- /** 错误信息
- *
- * 可选值:
- * - 'fail permission denied, open ${path}': 指定的 path 路径没有读权限;
- * - 'fail no such file or directory ${path}': 文件不存在;
- * - 'fail operation not permitted, unlink ${filePath}': 传入的 filePath 是一个目录;
- * - 'fail sdcard not mounted': Android sdcard 挂载失败; */
- errMsg: string
- }
interface UnlinkOption {
/** 要删除的文件路径 (本地路径) */
filePath: string
@@ -6113,14 +13267,6 @@ wx.getSetting({
/** 接口调用成功的回调函数 */
success?: UnlinkSuccessCallback
}
- interface UnzipFailCallbackResult {
- /** 错误信息
- *
- * 可选值:
- * - 'fail permission denied, unzip ${zipFilePath} -> ${destPath}': 指定目标文件路径没有写权限;
- * - 'fail no such file or directory, unzip ${zipFilePath} -> "${destPath}': 源文件不存在,或目标文件路径的上层目录不存在; */
- errMsg: string
- }
interface UnzipOption {
/** 目标目录路径, 支持本地路径 */
targetPath: string
@@ -6140,12 +13286,18 @@ wx.getSetting({
/** 参数值 */
value: string
}
- /** 动态消息的模板信息
+ /** 需要基础库: `2.4.0`
*
- * 最低基础库: `2.4.0` */
+ * 动态消息的模板信息 */
interface UpdatableMessageFrontEndTemplateInfo {
/** 参数列表 */
parameterList: UpdatableMessageFrontEndParameter[]
+ /** 模板ID */
+ templateId: string
+ }
+ interface Update3DModeOption {
+ /** 是否开启三维识别 */
+ open3d: boolean
}
interface UpdateGroundOverlayOption {
/** 图片覆盖的经纬度范围 */
@@ -6167,33 +13319,47 @@ wx.getSetting({
/** 图层绘制顺序 */
zIndex?: number
}
+ interface UpdateMaskModeOption {
+ /** 设置是否开启试鞋,返回腿部遮挡纹理 */
+ useMask: boolean
+ }
interface UpdateShareMenuOption {
- /** 动态消息的 activityId。通过 [updatableMessage.createActivityId](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/updatable-message/updatableMessage.createActivityId.html) 接口获取
+ /** 需要基础库: `2.4.0`
*
- * 最低基础库: `2.4.0` */
+ * 动态消息的 activityId。通过 [updatableMessage.createActivityId](#) 接口获取 */
activityId?: string
+ /** 需要基础库: `3.7.8`
+ *
+ * 指定成员的方式 */
+ chooseType?: number
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: UpdateShareMenuCompleteCallback
/** 接口调用失败的回调函数 */
fail?: UpdateShareMenuFailCallback
- /** 是否是私密消息。详见 [小程序私密消息](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share/private-message.html)
+ /** 需要基础库: `2.13.0`
*
- * 最低基础库: `2.13.0` */
+ * 是否是私密消息。详见 [小程序私密消息](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share/private-message.html) */
isPrivateMessage?: boolean
- /** 是否是动态消息,详见[动态消息](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share/updatable-message.html)
+ /** 需要基础库: `2.4.0`
*
- * 最低基础库: `2.4.0` */
+ * 是否是动态消息,详见[动态消息](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share/updatable-message.html) */
isUpdatableMessage?: boolean
+ /** 参与用户此聊天室下的 group_openid 列表 */
+ participant?: string[]
/** 接口调用成功的回调函数 */
success?: UpdateShareMenuSuccessCallback
- /** 动态消息的模板信息
+ /** 需要基础库: `2.4.0`
*
- * 最低基础库: `2.4.0` */
+ * 动态消息的模板信息 */
templateInfo?: UpdatableMessageFrontEndTemplateInfo
- /** 群待办消息的id,通过toDoActivityId可以把多个群待办消息聚合为同一个。通过 [updatableMessage.createActivityId](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/updatable-message/updatableMessage.createActivityId.html) 接口获取。详见[群待办消息](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html)
+ /** 需要基础库: `2.11.0`
*
- * 最低基础库: `2.11.0` */
+ * 群待办消息的id,通过toDoActivityId可以把多个群待办消息聚合为同一个。通过 [updatableMessage.createActivityId](#) 接口获取。详见[群待办消息](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html) */
toDoActivityId?: string
+ /** 需要基础库: `3.7.8`
+ *
+ * 聊天工具模式特殊动态消息 */
+ useForChatTool?: boolean
/** 是否使用带 shareTicket 的转发[详情](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html) */
withShareTicket?: boolean
}
@@ -6224,6 +13390,18 @@ wx.getSetting({
url: string
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: UploadFileCompleteCallback
+ /** 需要基础库: `2.10.4`
+ *
+ * 是否开启 http2 */
+ enableHttp2?: boolean
+ /** 需要基础库: `3.5.0`
+ *
+ * 是否开启 profile。iOS 和 Android 端默认开启,其他端暂不支持。开启后可在接口回调的 res.profile 中查看性能调试信息。 */
+ enableProfile?: boolean
+ /** 需要基础库: `2.10.4`
+ *
+ * 是否开启 Quic/h3 协议(iOS 微信目前使用 gQUIC-Q43;Android 微信在 v8.0.54 前使用 gQUIC-Q43,v8.0.54 开始使用 IETF QUIC,即 h3 协议;PC微信使用 IETF QUIC,即 h3 协议) */
+ enableQuic?: boolean
/** 接口调用失败的回调函数 */
fail?: UploadFileFailCallback
/** HTTP 请求中其他额外的 form data */
@@ -6232,19 +13410,23 @@ wx.getSetting({
header?: IAnyObject
/** 接口调用成功的回调函数 */
success?: UploadFileSuccessCallback
- /** 超时时间,单位为毫秒
+ /** 需要基础库: `2.10.0`
*
- * 最低基础库: `2.10.0` */
+ * 超时时间,单位为毫秒 */
timeout?: number
}
interface UploadFileSuccessCallbackResult {
/** 开发者服务器返回的数据 */
data: string
+ /** 需要基础库: `3.5.0`
+ *
+ * 网络请求过程中一些调试信息,[查看详细说明](https://developers.weixin.qq.com/miniprogram/dev/framework/performance/network.html)。目前 iOS 和 Android 端支持。 */
+ profile: RequestProfile
/** 开发者服务器返回的 HTTP 状态码 */
statusCode: number
errMsg: string
}
- interface UploadTaskOnProgressUpdateCallbackResult {
+ interface UploadTaskOnProgressUpdateListenerResult {
/** 上传进度百分比 */
progress: number
/** 预期需要上传的数据总长度,单位 Bytes */
@@ -6252,22 +13434,24 @@ wx.getSetting({
/** 已经上传的数据长度,单位 Bytes */
totalBytesSent: number
}
- /** 用户信息 */
+ /** @warning **用户头像昵称获取规则已调整,参考 [用户信息接口调整说明](https://developers.weixin.qq.com/community/develop/doc/000cacfa20ce88df04cb468bc52801)、[小程序用户头像昵称获取规则调整公告](https://developers.weixin.qq.com/community/develop/doc/00022c683e8a80b29bed2142b56c01)**
+ *
+ * 用户信息 */
interface UserInfo {
/** 用户头像图片的 URL。URL 最后一个数值代表正方形头像大小(有 0、46、64、96、132 数值可选,0 代表 640x640 的正方形头像,46 表示 46x46 的正方形头像,剩余数值以此类推。默认132),用户没有头像时该项为空。若用户更换头像,原有头像 URL 将失效。 */
avatarUrl: string
- /** 用户所在城市 */
+ /** 用户所在城市。不再返回,参考 [相关公告](https://developers.weixin.qq.com/community/develop/doc/00028edbe3c58081e7cc834705b801) */
city: string
- /** 用户所在国家 */
+ /** 用户所在国家。不再返回,参考 [相关公告](https://developers.weixin.qq.com/community/develop/doc/00028edbe3c58081e7cc834705b801) */
country: string
- /** 用户性别
+ /** 用户性别。不再返回,参考 [相关公告](https://developers.weixin.qq.com/community/develop/doc/00028edbe3c58081e7cc834705b801)
*
* 可选值:
* - 0: 未知;
* - 1: 男性;
* - 2: 女性; */
gender: 0 | 1 | 2
- /** 显示 country,province,city 所用的语言
+ /** 显示 country,province,city 所用的语言。强制返回 “zh_CN”,参考 [相关公告](https://developers.weixin.qq.com/community/develop/doc/00028edbe3c58081e7cc834705b801)
*
* 可选值:
* - 'en': 英文;
@@ -6276,9 +13460,755 @@ wx.getSetting({
language: 'en' | 'zh_CN' | 'zh_TW'
/** 用户昵称 */
nickName: string
- /** 用户所在省份 */
+ /** 用户所在省份。不再返回,参考 [相关公告](https://developers.weixin.qq.com/community/develop/doc/00028edbe3c58081e7cc834705b801) */
province: string
}
+ /** 需要基础库: `2.28.0`
+ *
+ * 人体 anchor
+ *
+ * **示例代码**
+ *
+ * [静态图像body检测能力使用参考](https://github.com/wechat-miniprogram/miniprogram-demo/tree/master/miniprogram/packageAPI/pages/ar/photo-body-detect)
+ *
+ * [实时摄像头body检测能力使用参考](https://github.com/wechat-miniprogram/miniprogram-demo/tree/master/miniprogram/packageAPI/pages/ar/body-detect) */
+ interface VKBodyAnchor {
+ /** 关键点的置信度 */
+ confidence: number[]
+ /** 识别序号 */
+ detectId: number
+ /** 唯一标识 */
+ id: number
+ /** 相对视窗的位置信息,取值范围为 [0, 1],0 为左/上边缘,1 为右/下边缘 */
+ origin: VKOrigin
+ /** 关键点 */
+ points: VKOrigin[]
+ /** 总体置信值 */
+ score: number
+ /** 相对视窗的尺寸,取值范围为 [0, 1],0 为左/上边缘,1 为右/下边缘 */
+ size: VKSize
+ /** 类型
+ *
+ * 可选值:
+ * - 5: 人体; */
+ type: 5
+ }
+ /** 需要基础库: `2.20.0`
+ *
+ * 相机对象 */
+ interface VKCamera {
+ /** 需要基础库: `2.22.0`
+ *
+ * 相机内参,只有 v2 版本支持 */
+ intrinsics: Float32Array
+ /** 相机原始的Pose矩阵 */
+ transform: Float32Array
+ /** 视图矩阵 */
+ viewMatrix: Float32Array
+ /** [Float32Array VKCamera.getProjectionMatrix(number near, number far)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKCamera.getProjectionMatrix.html)
+ *
+ * 需要基础库: `2.20.0`
+ *
+ * 在插件中使用:需要基础库 `2.20.0`
+ *
+ * 获取投影矩阵 */
+ getProjectionMatrix(
+ /** 近视点 */
+ near: number,
+ /** 远视点 */
+ far: number
+ ): Float32Array
+ }
+ interface VKConfig {
+ /** 跟踪能力配置,目前不同的跟踪能力之间是互斥的,默认使用平面跟踪能力。需要注意目前 track 中不同的跟踪配置存在互斥关系(比如 marker 跟踪配置和 OSD 跟踪配置不能同时存在),请按需配置。 */
+ track: Track
+ /** 需要基础库: `2.23.0`
+ *
+ * 绑定的 WebGLRenderingContext 对象 */
+ gl?: WebGLRenderingContext
+ /** 需要基础库: `2.22.0`
+ *
+ * vision kit 版本。
+ *
+ * 可选值:
+ * - 'v1': v1适用于用户在平面场景下,例如桌面,地面,泛平面场景,放置虚拟物体,不提供真实世界距离。用户放置物体时,手机相机倾斜向下对着目标平面点击即可,具有广泛的机型支持;
+ * - 'v2': v2提供真实物理距离的 ar 定位功能,提供平面识别功能,用户在平面范围点击放置虚拟物体的功能,具有[有限的机型支持](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/visionkit/plane.html#%E9%99%84%E5%BD%95)。iOS 设备在基础库 2.22.0 开始支持v2。安卓设备在基础库 2.25.1 开始支持v2,另外,安卓v2不支持竖直平面。**使用v2算法需要初始化,移动手机进行左右平移初始化效果最佳。**; */
+ version?: 'v1' | 'v2'
+ }
+ /** 需要基础库: `2.33.0`
+ *
+ * depth anchor
+ *
+ * **示例代码**
+ *
+ * [深度估计能力使用参考](https://github.com/wechat-miniprogram/miniprogram-demo/tree/master/miniprogram/packageAPI/pages/ar/depth-detect) */
+ interface VKDepthAnchor {
+ /** 包含深度信息的数组 */
+ depthArray: number[]
+ /** 唯一标识 */
+ id: number
+ /** 相对视窗的尺寸,取值范围为 [0, 1],0 为左/上边缘,1 为右/下边缘 */
+ size: VKSize
+ /** 类型
+ *
+ * 可选值:
+ * - 8: DEPTH; */
+ type: 8
+ }
+ /** 需要基础库: `2.25.0`
+ *
+ * 人脸 anchor
+ *
+ * **示例代码**
+ *
+ * [静态图像人脸检测能力使用参考](https://github.com/wechat-miniprogram/miniprogram-demo/tree/master/miniprogram/packageAPI/pages/ar/photo-face-detect)
+ *
+ * [实时摄像头人脸检测能力使用参考](https://github.com/wechat-miniprogram/miniprogram-demo/tree/master/miniprogram/packageAPI/pages/ar/face-detect) */
+ interface VKFaceAnchor {
+ /** 人脸角度信息 */
+ angle: number[]
+ /** 关键点的置信度 */
+ confidence: number[]
+ /** 识别序号 */
+ detectId: number
+ /** 唯一标识 */
+ id: number
+ /** 相对视窗的位置信息,取值范围为 [0, 1],0 为左/上边缘,1 为右/下边缘 */
+ origin: VKOrigin
+ /** 人脸 106 个关键点的坐标 */
+ points: VKPoint[]
+ /** 相对视窗的尺寸,取值范围为 [0, 1],0 为左/上边缘,1 为右/下边缘 */
+ size: VKSize
+ /** 类型
+ *
+ * 可选值:
+ * - 3: 人脸; */
+ type: 3
+ }
+ /** 需要基础库: `2.20.0`
+ *
+ * vision kit 会话对象。 */
+ interface VKFrame {
+ /** [VKCamera](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKCamera.html)
+ *
+ * 相机对象 */
+ camera: VKCamera
+ /** 生成时间,单位:纳秒(ns) */
+ timestamp: number
+ /** [ArrayBuffer VKFrame.getCameraBuffer(number width, number height)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKFrame.getCameraBuffer.html)
+ *
+ * 需要基础库: `2.24.0`
+ *
+ * 在插件中使用:不支持
+ *
+ * 获取当前帧 rgba buffer。iOS 端微信在 v8.0.20 开始支持,安卓端微信在 v8.0.30 开始支持。按 aspect-fill 规则裁剪,此接口要求在创建 VKSession 对象时必须传入 gl 参数。此接口仅建议拿来做帧分析使用,上屏请使用 getCameraTexture 来代替。 */
+ getCameraBuffer(
+ /** 宽度,受系统限制,必须是 16 的整数倍 */
+ width: number,
+ /** 高度 */
+ height: number
+ ): ArrayBuffer
+ /** [ArrayBuffer VKFrame.getCameraJpgBuffer(number width, number height, number quality)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKFrame.getCameraJpgBuffer.html)
+ *
+ * 需要基础库: `3.0.0`
+ *
+ * 在插件中使用:不支持
+ *
+ * 获取当前帧的 jpg 信息Buffer。安卓微信 8.0.49 开始支持,iOS微信 8.0.49 开始支持。 */
+ getCameraJpgBuffer(
+ /** 宽度 */
+ width: number,
+ /** 高度 */
+ height: number,
+ /** 获取纹理质量,(0 - 100) */
+ quality: number
+ ): ArrayBuffer
+ /** [Float32Array VKFrame.getDisplayTransform()](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKFrame.getDisplayTransform.html)
+ *
+ * 需要基础库: `2.20.0`
+ *
+ * 在插件中使用:需要基础库 `2.20.0`
+ *
+ * 获取纹理调整矩阵。默认获取到的纹理是未经裁剪调整的纹理,此矩阵可用于在着色器中根据帧对象尺寸对纹理进行裁剪。 */
+ getDisplayTransform(): Float32Array
+ /** [Object VKFrame.getCameraTexture(WebGLRenderingContext gl)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKFrame.getCameraTexture.html)
+ *
+ * 需要基础库: `2.20.0`
+ *
+ * 在插件中使用:需要基础库 `2.20.0`
+ *
+ * 获取当前帧纹理,目前只支持 YUV 纹理。 */
+ getCameraTexture(
+ /** 画布 */
+ gl: WebGLRenderingContext
+ ): YUVTextureRes
+ /** [Object VKFrame.getDepthBuffer()](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKFrame.getDepthBuffer.html)
+ *
+ * 需要基础库: `3.0.0`
+ *
+ * 在插件中使用:不支持
+ *
+ * 获取每帧的深度图信息Buffer。安卓微信 8.0.38 开始支持,iOS微信 8.0.39 开始支持。 */
+ getDepthBuffer(): DepthBufferRes
+ /** [Object VKFrame.getLegSegmentBuffer()](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKFrame.getLegSegmentBuffer.html)
+ *
+ * 需要基础库: `3.2.1`
+ *
+ * 在插件中使用:不支持
+ *
+ * 获取每帧的腿部分割信息Buffer,安卓微信 8.0.43,iOS微信 8.0.43 开始支持。 */
+ getLegSegmentBuffer(): LegSegmentBufferRes
+ }
+ /** 需要基础库: `2.28.0`
+ *
+ * 手势 anchor
+ *
+ * **示例代码**
+ *
+ * [静态图像hand检测能力使用参考](https://github.com/wechat-miniprogram/miniprogram-demo/tree/master/miniprogram/packageAPI/pages/ar/photo-hand-detect)
+ *
+ * [实时摄像头hand检测能力使用参考](https://github.com/wechat-miniprogram/miniprogram-demo/tree/master/miniprogram/packageAPI/pages/ar/hand-detect) */
+ interface VKHandAnchor {
+ /** 关键点的置信度 */
+ confidence: number[]
+ /** 识别序号 */
+ detectId: number
+ /** 手势分类, 返回整数-1到18, -1表示无效手势
+ *
+ * 可选值:
+ * - 0: 单手比心;
+ * - 1: 布(数字5);
+ * - 2: 剪刀(数字2);
+ * - 3: 握拳;
+ * - 4: 数字1;
+ * - 5: 热爱;
+ * - 6: 点赞;
+ * - 7: 数字3;
+ * - 8: 摇滚;
+ * - 9: 数字6;
+ * - 10: 数字8;
+ * - 11: 双手抱拳(恭喜发财);
+ * - 12: 数字4;
+ * - 13: 比ok;
+ * - 14: 不喜欢(踩);
+ * - 15: 双手比心;
+ * - 16: 祈祷(双手合十);
+ * - 17: 双手抱拳;
+ * - 18: 无手势动作;
+ * - -1: 无效手势; */
+ gesture:
+ | 0
+ | 1
+ | 2
+ | 3
+ | 4
+ | 5
+ | 6
+ | 7
+ | 8
+ | 9
+ | 10
+ | 11
+ | 12
+ | 13
+ | 14
+ | 15
+ | 16
+ | 17
+ | 18
+ | -1
+ /** 唯一标识 */
+ id: number
+ /** 相对视窗的位置信息,取值范围为 [0, 1],0 为左/上边缘,1 为右/下边缘 */
+ origin: VKOrigin
+ /** 关键点 */
+ points: VKOrigin[]
+ /** 总体置信值 */
+ score: number
+ /** 相对视窗的尺寸,取值范围为 [0, 1],0 为左/上边缘,1 为右/下边缘 */
+ size: VKSize
+ /** 类型
+ *
+ * 可选值:
+ * - 7: 手势; */
+ type: 7
+ }
+ interface VKMarker {
+ /** marker id */
+ markerId: number
+ /** 图片路径 */
+ path: string
+ }
+ /** 需要基础库: `2.24.5`
+ *
+ * marker anchor
+ *
+ * **示例代码**
+ *
+ * [2D Marker能力使用参考](https://github.com/wechat-miniprogram/miniprogram-demo/tree/master/miniprogram/packageAPI/pages/ar/2dmarker-ar) */
+ interface VKMarkerAnchor {
+ /** 唯一标识 */
+ id: number
+ /** marker id */
+ markerId: number
+ /** 图片路径 */
+ path: string
+ /** 包含位置、旋转、放缩信息的矩阵,以列为主序 */
+ transform: Float32Array
+ /** 类型
+ *
+ * 可选值:
+ * - 1: marker; */
+ type: 1
+ }
+ /** 需要基础库: `2.27.0`
+ *
+ * OCR anchor
+ *
+ * **示例代码**
+ *
+ * [静态图像OCR检测能力使用参考](https://github.com/wechat-miniprogram/miniprogram-demo/tree/master/miniprogram/packageAPI/pages/ar/photo-ocr-detect)
+ *
+ * [实时摄像头OCR检测能力使用参考](https://github.com/wechat-miniprogram/miniprogram-demo/tree/master/miniprogram/packageAPI/pages/ar/ocr-detect) */
+ interface VKOCRAnchor {
+ /** 唯一标识 */
+ id: number
+ /** 识别的文字结果 */
+ text: string
+ /** 类型
+ *
+ * 可选值:
+ * - 6: OCR; */
+ type: 6
+ }
+ /** 需要基础库: `2.24.5`
+ *
+ * OSD anchor
+ *
+ * **示例代码**
+ *
+ * [单样本检测(OSD)能力使用参考](https://github.com/wechat-miniprogram/miniprogram-demo/tree/master/miniprogram/packageAPI/pages/ar/osd-ar) */
+ interface VKOSDAnchor {
+ /** 唯一标识 */
+ id: number
+ /** marker id */
+ markerId: number
+ /** 相对视窗的位置信息,取值范围为 [0, 1],0 为左/上边缘,1 为右/下边缘 */
+ origin: VKOrigin
+ /** 图片路径 */
+ path: string
+ /** 相对视窗的尺寸,取值范围为 [0, 1],0 为左/上边缘,1 为右/下边缘 */
+ size: VKSize
+ /** 类型
+ *
+ * 可选值:
+ * - 2: OSD; */
+ type: 2
+ }
+ interface VKOrigin {
+ /** 横坐标 */
+ x: number
+ /** 纵坐标 */
+ y: number
+ }
+ /** 需要基础库: `2.22.0`
+ *
+ * 平面 anchor,只有 v2 版本支持
+ *
+ * **示例代码**
+ *
+ * v1 版本:[水平面AR能力使用参考](https://github.com/wechat-miniprogram/miniprogram-demo/tree/master/miniprogram/packageAPI/pages/ar/plane-ar)
+ * v2 版本:[水平面AR能力v2使用参考](https://github.com/wechat-miniprogram/miniprogram-demo/tree/master/miniprogram/packageAPI/pages/ar/plane-ar-v2) */
+ interface VKPlaneAnchor {
+ /** 方向 */
+ alignment: number
+ /** 唯一标识 */
+ id: number
+ /** 尺寸 */
+ size: VKSize
+ /** 包含位置、旋转、放缩信息的矩阵,以列为主序 */
+ transform: Float32Array
+ /** 类型
+ *
+ * 可选值:
+ * - 0: 平面; */
+ type: 0
+ }
+ /** 人脸 106 个关键点的坐标 */
+ interface VKPoint {
+ /** 横坐标 */
+ x: number
+ /** 纵坐标 */
+ y: number
+ }
+ /** 需要基础库: `2.20.0`
+ *
+ * vision kit 会话对象。 */
+ interface VKSession {
+ /** 相机尺寸 */
+ cameraSize: VKSize
+ /** 会话配置 */
+ config: VKConfig
+ /** 会话状态
+ *
+ * 可选值:
+ * - 0: 不可用;
+ * - 1: 运行中;
+ * - 2: 暂停中;
+ * - 3: 初始化中; */
+ state: 0 | 1 | 2 | 3
+ /** [Array.<Object> VKSession.getAllMarker()](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.getAllMarker.html)
+ *
+ * 需要基础库: `2.24.5`
+ *
+ * 在插件中使用:需要基础库 `2.24.5`
+ *
+ * 获取所有 marker,要求调 [wx.createVKSession](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/wx.createVKSession.html) 时传入的 track.marker 为 true */
+ getAllMarker(): VKMarker[]
+ /** [Array.<Object> VKSession.getAllOSDMarker()](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.getAllOSDMarker.html)
+ *
+ * 需要基础库: `2.24.5`
+ *
+ * 在插件中使用:需要基础库 `2.24.5`
+ *
+ * 获取所有 OSD marker,要求调 [wx.createVKSession](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/wx.createVKSession.html) 时传入的 track.OSD 为 true */
+ getAllOSDMarker(): VKMarker[]
+ /** [Array.<Object> VKSession.hitTest(number x, number y, Object reset)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.hitTest.html)
+ *
+ * 需要基础库: `2.20.0`
+ *
+ * 在插件中使用:需要基础库 `2.20.0`
+ *
+ * 触摸检测,v1 版本只支持单平面(即 hitTest 生成一次平面后,后续 hitTest 均不会再生成平面,而是以之前生成的平面为基础进行检测)。如果需要重新识别其他平面,可以在调用此方法时将 reset 参数置为 true。 */
+ hitTest(
+ /** 相对视窗的横坐标,取值范围为 [0, 1],0 为左边缘,1 为右边缘 */
+ x: number,
+ /** 相对视窗的纵坐标,取值范围为 [0, 1],0 为上边缘,1 为下边缘 */
+ y: number,
+ /** 是否需要重新识别其他平面,v2 版本不再需要此参数 */
+ reset: IAnyObject
+ ): HitTestRes[]
+ /** [VKSession.cancelAnimationFrame(number requestID)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.cancelAnimationFrame.html)
+ *
+ * 需要基础库: `2.20.0`
+ *
+ * 在插件中使用:需要基础库 `2.20.0`
+ *
+ * 取消由 requestAnimationFrame 添加到计划中的动画帧请求。 */
+ cancelAnimationFrame(requestID: number): void
+ /** [VKSession.destroy()](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.destroy.html)
+ *
+ * 需要基础库: `2.20.0`
+ *
+ * 在插件中使用:需要基础库 `2.20.0`
+ *
+ * 销毁会话。 */
+ destroy(): void
+ /** [VKSession.detectBody(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.detectBody.html)
+ *
+ * 需要基础库: `2.28.0`
+ *
+ * 在插件中使用:需要基础库 `2.28.0`
+ *
+ * 静态图像人体关键点检测。当 wx.createVKSession 参数传入 {track: {body: {mode: 2} } } 时可用。用法详情[指南文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/visionkit/body.html)。 */
+ detectBody(option: DetectBodyOption): void
+ /** [VKSession.detectDepth(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.detectDepth.html)
+ *
+ * 需要基础库: `2.33.0`
+ *
+ * 在插件中使用:需要基础库 `2.33.0`
+ *
+ * 深度识别。当 wx.createVKSession 参数传入 {track: {depth: {mode: 2} } } 时可用。用法详情[指南文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/visionkit/depth.html)。 */
+ detectDepth(option: DetectDepthOption): void
+ /** [VKSession.detectFace(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.detectFace.html)
+ *
+ * 需要基础库: `2.25.0`
+ *
+ * 在插件中使用:需要基础库 `2.25.0`
+ *
+ * 静态图像人脸关键点检测。当 wx.createVKSession 参数传入 {track: {face: {mode: 2} } } 时可用。用法详情[指南文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/visionkit/face.html)。安卓微信8.0.25开始支持,iOS微信8.0.24开始支持。
+ *
+ * ****
+ *
+ * ### 特别说明
+ * 若小程序人脸识别功能涉及采集、存储用户生物特征(如人脸照片或视频、身份证和手持身份证、身份证照和免冠照等),此类型服务需使用[微信原生人脸识别接口](https://developers.weixin.qq.com/community/develop/doc/000442d352c1202bd498ecb105c00d?highline=%E4%BA%BA%E8%84%B8%E6%A0%B8%E8%BA%AB)。 */
+ detectFace(option: DetectFaceOption): void
+ /** [VKSession.detectHand(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.detectHand.html)
+ *
+ * 需要基础库: `2.28.0`
+ *
+ * 在插件中使用:需要基础库 `2.28.0`
+ *
+ * 静态图像手势关键点检测。当 wx.createVKSession 参数传入 {track: {hand: {mode: 2} } } 时可用。用法详情[指南文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/visionkit/hand.html)。 */
+ detectHand(option: DetectHandOption): void
+ /** [VKSession.off(string eventName, function fn)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.off.html)
+ *
+ * 需要基础库: `2.20.0`
+ *
+ * 在插件中使用:需要基础库 `2.20.0`
+ *
+ * 取消监听会话事件。 */
+ off(
+ /** 事件名称 */
+ eventName: string,
+ /** 事件监听函数 */
+ fn: (...args: any[]) => any
+ ): void
+ /** [VKSession.on(string eventName, function fn)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.on.html)
+ *
+ * 需要基础库: `2.20.0`
+ *
+ * 在插件中使用:需要基础库 `2.20.0`
+ *
+ * 监听会话事件。 */
+ on(
+ /** 事件名称
+ *
+ * 参数 eventName 可选值:
+ * - 'resize': 相机尺寸变化事件,回调参数为相机尺寸;
+ * - 'addAnchors': 增加 anchor 事件,回调参数为 [VKPlaneAnchor](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKPlaneAnchor.html)/[VKMarkerAnchor](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKMarkerAnchor.html)/[VKOSDAnchor](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKOSDAnchor.html) 列表(只有v2版本支持) 或 [VKFaceAnchor](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKFaceAnchor.html)/[VKOCRAnchor](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKOCRAnchor.html)/[VKHandAnchor](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKHandAnchor.html)/[VKBodyAnchor](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKBodyAnchor.html)列表(v1、v2都支持);
+ * - 'updateAnchors': 更新 anchor 事件,回调参数为 [VKPlaneAnchor](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKPlaneAnchor.html)/[VKMarkerAnchor](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKMarkerAnchor.html)/[VKOSDAnchor](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKOSDAnchor.html) 列表(只有v2版本支持) 或 [VKFaceAnchor](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKFaceAnchor.html)/[VKOCRAnchor](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKOCRAnchor.html)/[VKHandAnchor](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKHandAnchor.html)/[VKBodyAnchor](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKBodyAnchor.html)列表(v1、v2都支持);
+ * - 'removeAnchors': 删除 anchor 事件,回调参数为 [VKPlaneAnchor](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKPlaneAnchor.html)/[VKMarkerAnchor](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKMarkerAnchor.html)/[VKOSDAnchor](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKOSDAnchor.html) 列表(只有v2版本支持) 或 [VKFaceAnchor](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKFaceAnchor.html)/[VKOCRAnchor](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKOCRAnchor.html)/[VKHandAnchor](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKHandAnchor.html)/[VKBodyAnchor](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKBodyAnchor.html) 列表(v1、v2都支持); */
+ eventName:
+ | 'resize'
+ | 'addAnchors'
+ | 'updateAnchors'
+ | 'removeAnchors',
+ /** 事件监听函数 */
+ fn: (...args: any[]) => any
+ ): void
+ /** [VKSession.removeMarker(number markerId)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.removeMarker.html)
+ *
+ * 需要基础库: `2.24.5`
+ *
+ * 在插件中使用:需要基础库 `2.24.5`
+ *
+ * 删除一个 marker,要求调 [wx.createVKSession](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/wx.createVKSession.html) 时传入的 track.marker 为 true */
+ removeMarker(
+ /** marker id */
+ markerId: number
+ ): void
+ /** [VKSession.removeOSDMarker(number markerId)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.removeOSDMarker.html)
+ *
+ * 需要基础库: `2.24.5`
+ *
+ * 在插件中使用:需要基础库 `2.24.5`
+ *
+ * 删除一个 OSD marker,要求调 [wx.createVKSession](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/wx.createVKSession.html) 时传入的 track.OSD 为 true */
+ removeOSDMarker(
+ /** marker id */
+ markerId: number
+ ): void
+ /** [VKSession.runOCR(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.runOCR.html)
+ *
+ * 需要基础库: `2.27.0`
+ *
+ * 在插件中使用:需要基础库 `2.27.0`
+ *
+ * 静态图像OCR检测。当 wx.createVKSession 参数传入 {track: {OCR: {mode: 2} } } 时可用。用法详情[指南文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/visionkit/ocr.html)。 */
+ runOCR(option: RunOCROption): void
+ /** [VKSession.setDepthOccRange(number threshold)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.setDepthOccRange.html)
+ *
+ * 需要基础库: `3.0.0`
+ *
+ * 在插件中使用:需要基础库 `3.0.0`
+ *
+ * 更新 深度遮挡 Occ范围,要求调 [wx.createVKSession](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/wx.createVKSession.html) 时传入 {track: {depth: {mode: 2} } } */
+ setDepthOccRange(
+ /** 阈值 */
+ threshold: number
+ ): void
+ /** [VKSession.start(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.start.html)
+ *
+ * 需要基础库: `2.20.0`
+ *
+ * 在插件中使用:需要基础库 `2.20.0`
+ *
+ * 开启会话。 */
+ start(
+ /** 开启会话回调 */
+ callback: VKSessionStartCallback
+ ): void
+ /** [VKSession.stop()](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.stop.html)
+ *
+ * 需要基础库: `2.20.0`
+ *
+ * 在插件中使用:需要基础库 `2.20.0`
+ *
+ * 停止会话。 */
+ stop(): void
+ /** [VKSession.update3DMode(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.update3DMode.html)
+ *
+ * 需要基础库: `2.30.2`
+ *
+ * 在插件中使用:需要基础库 `2.30.2`
+ *
+ * 更新三维识别相关配置,要求调 [wx.createVKSession](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/wx.createVKSession.html) 时使用 face / hand / body。 */
+ update3DMode(option: Update3DModeOption): void
+ /** [VKSession.updateMaskMode(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.updateMaskMode.html)
+ *
+ * 需要基础库: `3.2.1`
+ *
+ * 在插件中使用:需要基础库 `3.2.1`
+ *
+ * 设置裁剪相关配置,要求调 [wx.createVKSession](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/wx.createVKSession.html) 时使用 shoe。 */
+ updateMaskMode(option: UpdateMaskModeOption): void
+ /** [VKSession.updateOSDThreshold(number threshold)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.updateOSDThreshold.html)
+ *
+ * 需要基础库: `2.24.5`
+ *
+ * 在插件中使用:需要基础库 `2.24.5`
+ *
+ * 更新 OSD 识别精确度,要求调 [wx.createVKSession](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/wx.createVKSession.html) 时传入的 track.OSD 为 true */
+ updateOSDThreshold(
+ /** 阈值 */
+ threshold: number
+ ): void
+ /** [[VKFrame](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKFrame.html) VKSession.getVKFrame(number width, number height)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.getVKFrame.html)
+ *
+ * 需要基础库: `2.20.0`
+ *
+ * 在插件中使用:需要基础库 `2.20.0`
+ *
+ * 获取帧对象,每调用一次都会触发一次帧分析过程。目前 VKSession 相机的最大帧数是 30 fps,因此调用 getVKFrame 的频率也可以限制在 30 fps,以减少渲染开销。 */
+ getVKFrame(
+ /** 宽度 */
+ width: number,
+ /** 高度 */
+ height: number
+ ): VKFrame
+ /** [number VKSession.addMarker(string path)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.addMarker.html)
+ *
+ * 需要基础库: `2.24.5`
+ *
+ * 在插件中使用:需要基础库 `2.24.5`
+ *
+ * 添加一个 marker,要求调 [wx.createVKSession](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/wx.createVKSession.html) 时传入的 track.marker 为 true
+ *
+ * **使用提示**
+ *
+ * 注意事项:
+ * 1. 使用 addMarker 接口之前,需要在 createVKSession 的时候声明开启 marker 跟踪。即 wx.createVKSession({ track: { marker: true } })
+ * 2. 可以添加多个 marker 图片,但不能重复添加相同的 marker 图片。
+ * 3. 在v2模式下同时支持水平面检测与marker检测,同时可输出多个2d/3d marker位姿(需要基础库版本不低于 [2.33.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
+ *
+ * ### 2Dmarker
+ * 对传入的图片有如下要求:
+ * 1. 格式:jpg/png 格式三通道彩图或者 1 通道灰度图
+ * 2. 分辨率:尺寸在 480x480 ~ 1920x1920 之间,建议为 1080 分辨率
+ * 3. 宽高比:在 1:1 ~ 16:9 之间,要求尽量方正,避免狭长的图片
+ * 4. 质量:目标图像为平面模型,需要占画面主体,避免大面积留白,建议用扫描件
+ *
+ * 示例:
+ *
+ *
+ *
+ * 建议:
+ *
+ * 1. 图片具有丰富的细节
+ * 2. 避免重复单一的纹理,例如:
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ * 3. 避免使用柔和平滑边缘的纹理及大量渐变图像,例如:
+ *
+ *
+ *
+ * 4. 避免模糊,建议采用高清、高对比度图像作为识别对象
+ * 5. 建议图像有均匀的特征(角点)分布,正确示例:
+ *
+ *
+ *
+ * 避免角点较少、中间大量空白、没有特征及角点的图像,错误示例:
+ *
+ *
+ *
+ * ### 3Dmarker
+ * 现小程序demo支持通过上传视频, 生成对应模型的3dmarker识别文件,后缀名为.map
+ *
+ * 对传入的视频有如下要求:
+ * 1.视频长宽比为16:9或4:3; 短边大于480px
+ * 2.目标物体易于和背景物体区分出来,同时目标物体放置与背景物体一定距离,放置底面与物体易于区分,底面可以放置一张白纸,例如:
+ *
+ *
+ *
+ * 3.目标物体最好为刚体,本身不会发生较大形变, 容易变形的物体不适合用作识别对象
+ * 4.视频匀速移动,避免模糊,对目标识别面环绕物体拍摄,需要保证相机有足够的平移移动
+ * 5.marker物体要求与2d图像要求类似,具有丰富细节,避免重复单一纹理,不反光,无高光
+ * 6.拍摄视频中特征纹理丰富,如果marker本身问题较弱,可以在背景中适当添加纹理物体
+ * 服务耗时:当前版本30s视频耗时约20分钟,请静待算法返回模型
+ *
+ * 建议:
+ *
+ * 1.视频格式:视频帧率30fps,分辨率建议1080p
+ * 2.视频时长:视频建议时长在20s~30s,超过30s会被截断,时长过短会导致marker效果欠佳 */
+ addMarker(
+ /** 图片路径,目前只支持本地用户图片 */
+ path: string
+ ): number
+ /** [number VKSession.addOSDMarker(string path)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.addOSDMarker.html)
+ *
+ * 需要基础库: `2.24.5`
+ *
+ * 在插件中使用:需要基础库 `2.24.5`
+ *
+ * 添加一个 OSD marker(one-shot detection marker),要求调 [wx.createVKSession](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/wx.createVKSession.html) 时传入的 track.OSD 为 true
+ *
+ * **使用提示**
+ *
+ * 注意事项:
+ * 1. 使用 addOSDMarker 接口之前,需要在 createVKSession 的时候声明开启 OSD 跟踪。即 wx.createVKSession({ track: { OSD: true } })
+ * 2. 可以添加多个 OSDMarker 图片,但不能重复添加相同的 OSDMarker 图片。
+ *
+ * 对传入的图片有如下要求:
+ * 1. 格式:jpg 格式彩色图片
+ * 2. 分辨率:尺寸不低于 240x240
+ * 3. 宽高比:在 1:1 ~ 16:9 之间,要求尽量方正,避免狭长的图片
+ * 4. 质量:目标物体需要占画面主体,避免大面积留白,避免大面积文字,不能含其他物体。
+ *
+ * 示例:
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ * 建议:
+ *
+ * 1. 具有丰富的细节,避免纯色且形状特点不鲜明的物体,例如:
+ *
+ *
+ *
+ * 2. 避免模糊,最好采用高清图片 */
+ addOSDMarker(
+ /** 图片路径,目前只支持本地用户图片 */
+ path: string
+ ): number
+ /** [number VKSession.requestAnimationFrame(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.requestAnimationFrame.html)
+ *
+ * 需要基础库: `2.20.0`
+ *
+ * 在插件中使用:需要基础库 `2.20.0`
+ *
+ * 在下次进行重绘时执行。 */
+ requestAnimationFrame(
+ /** 执行的 callback */
+ callback: (...args: any[]) => any
+ ): number
+ }
+ interface VKSize {
+ /** 高度 */
+ height: number
+ /** 宽度 */
+ width: number
+ }
interface VibrateLongOption {
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: VibrateLongCompleteCallback
@@ -6287,10 +14217,17 @@ wx.getSetting({
/** 接口调用成功的回调函数 */
success?: VibrateLongSuccessCallback
}
- interface VibrateShortOption {
- /** 震动强度类型,有效值为:heavy、medium、light
+ interface VibrateShortFailCallbackResult {
+ /** 错误信息
*
- * 最低基础库: `2.13.0` */
+ * 可选值:
+ * - 'style is not support': 当前设备不支持设置震动等级; */
+ errMsg: string
+ }
+ interface VibrateShortOption {
+ /** 需要基础库: `2.13.0`
+ *
+ * 震动强度类型,有效值为:heavy、medium、light */
type: string
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: VibrateShortCompleteCallback
@@ -6300,22 +14237,278 @@ wx.getSetting({
success?: VibrateShortSuccessCallback
}
interface VideoContextRequestFullScreenOption {
- /** 设置全屏时视频的方向,不指定则根据宽高比自动判断。
+ /** 需要基础库: `1.7.0`
+ *
+ * 设置全屏时视频的方向,不指定则根据宽高比自动判断。
*
* 可选值:
* - 0: 正常竖向;
* - 90: 屏幕逆时针90度;
- * - -90: 屏幕顺时针90度;
- *
- * 最低基础库: `1.7.0` */
+ * - -90: 屏幕顺时针90度; */
direction?: 0 | 90 | -90
}
interface VideoDecoderStartOption {
/** 需要解码的视频源文件。基础库 2.13.0 以下的版本只支持本地路径。 2.13.0 开始支持 http:// 和 https:// 协议的远程路径。 */
source: string
+ /** 需要基础库: `2.15.0`
+ *
+ * 是否不需要音频轨道 */
+ abortAudio?: boolean
+ /** 需要基础库: `2.15.0`
+ *
+ * 是否不需要视频轨道 */
+ abortVideo?: boolean
/** 解码模式。0:按 pts 解码;1:以最快速度解码 */
mode?: number
}
+ interface VoIP1v1ChatUser {
+ /** 昵称 */
+ nickname: string
+ /** 小程序内 openid */
+ openid: string
+ /** 头像 */
+ headImage?: string
+ }
+ /** 需要基础库: `2.19.0`
+*
+* WebAudioContext 实例,通过[wx.createWebAudioContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.createWebAudioContext.html) 接口获取该实例。
+*
+* **示例代码**
+*
+* ```js
+// 监听状态
+const audioCtx = wx.createWebAudioContext()
+audioCtx.onstatechange = () => {
+ console.log(ctx.state)
+}
+setTimeout(audioCtx.suspend, 1000)
+setTimeout(audioCtx.resume, 2000)
+``` */
+ interface WebAudioContext {
+ /** 获取当前上下文的时间戳。 */
+ currentTime: number
+ /** [WebAudioContextNode](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContextNode.html)
+ *
+ * 当前上下文的最终目标节点,一般是音频渲染设备。 */
+ destination: WebAudioContextNode
+ /** [AudioListener](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioListener.html)
+ *
+ * 空间音频监听器。 */
+ listener: AudioListener
+ /** 可写属性,开发者可以对该属性设置一个监听函数,当WebAudio状态改变的时候,会触发开发者设置的监听函数。 */
+ onstatechange: (...args: any[]) => any
+ /** 采样率,通常在8000-96000之间,通常44100hz的采样率最为常见。 */
+ sampleRate: number
+ /** 当前WebAudio上下文的状态。可能的值如下:suspended(暂停)、running(正在运行)、closed(已关闭)。需要注意的是,不要在 audioContext close后再访问state属性 */
+ state: string
+ /** [AnalyserNode WebAudioContext.createAnalyser()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createAnalyser.html)
+ *
+ * 需要基础库: `2.22.0`
+ *
+ * 在插件中使用:不支持
+ *
+ * 创建一个 AnalyserNode 。可以用来获取音频时间和频率数据,以及实现数据可视化。 */
+ createAnalyser(): AnalyserNode
+ /** [BiquadFilterNode WebAudioContext.createBiquadFilter()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createBiquadFilter.html)
+ *
+ * 在插件中使用:不支持
+ *
+ * 创建一个BiquadFilterNode */
+ createBiquadFilter(): BiquadFilterNode
+ /** [ChannelMergerNode WebAudioContext.createChannelMerger(number numberOfInputs)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createChannelMerger.html)
+ *
+ * 在插件中使用:不支持
+ *
+ * 创建一个ChannelMergerNode */
+ createChannelMerger(
+ /** 输出流中需要保持的输入流的个数 */
+ numberOfInputs: number
+ ): ChannelMergerNode
+ /** [ChannelSplitterNode WebAudioContext.createChannelSplitter(number numberOfOutputs)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createChannelSplitter.html)
+ *
+ * 在插件中使用:不支持
+ *
+ * 创建一个ChannelSplitterNode */
+ createChannelSplitter(
+ /** 要分别输出的输入音频流中的通道数 */
+ numberOfOutputs: number
+ ): ChannelSplitterNode
+ /** [ConstantSourceNode WebAudioContext.createConstantSource()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createConstantSource.html)
+ *
+ * 在插件中使用:不支持
+ *
+ * 创建一个ConstantSourceNode */
+ createConstantSource(): ConstantSourceNode
+ /** [DelayNode WebAudioContext.createDelay(number maxDelayTime)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createDelay.html)
+ *
+ * 在插件中使用:不支持
+ *
+ * 创建一个DelayNode */
+ createDelay(
+ /** 最大延迟时间 */
+ maxDelayTime: number
+ ): DelayNode
+ /** [DynamicsCompressorNode WebAudioContext.createDynamicsCompressor()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createDynamicsCompressor.html)
+ *
+ * 在插件中使用:不支持
+ *
+ * 创建一个DynamicsCompressorNode */
+ createDynamicsCompressor(): DynamicsCompressorNode
+ /** [GainNode WebAudioContext.createGain()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createGain.html)
+ *
+ * 在插件中使用:不支持
+ *
+ * 创建一个GainNode */
+ createGain(): GainNode
+ /** [IIRFilterNode WebAudioContext.createIIRFilter(Array.<number> feedforward, Array.<number> feedback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createIIRFilter.html)
+ *
+ * 在插件中使用:不支持
+ *
+ * 创建一个IIRFilterNode */
+ createIIRFilter(
+ /** 一个浮点值数组,指定IIR滤波器传递函数的前馈(分子)系数。 */
+ feedforward: number[],
+ /** 一个浮点值数组,指定IIR滤波器传递函数的反馈(分母)系数。 */
+ feedback: number[]
+ ): IIRFilterNode
+ /** [OscillatorNode WebAudioContext.createOscillator()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createOscillator.html)
+ *
+ * 在插件中使用:不支持
+ *
+ * 创建一个OscillatorNode */
+ createOscillator(): OscillatorNode
+ /** [PannerNode WebAudioContext.createPanner()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createPanner.html)
+ *
+ * 在插件中使用:不支持
+ *
+ * 创建一个PannerNode */
+ createPanner(): PannerNode
+ /** [PeriodicWaveNode WebAudioContext.createPeriodicWave(Float32Array real, Float32Array imag, object constraints)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createPeriodicWave.html)
+*
+* 在插件中使用:不支持
+*
+* 创建一个PeriodicWaveNode
+*
+* **注意**
+*
+* `real`和`imag`数组必须拥有一样的长度,否则抛出错误
+* ```js
+const real = new Float32Array(2)
+const imag = new Float32Array(2)
+real[0] = 0
+imag[0] = 0
+real[1] = 1
+imag[1] = 0
+
+const waveNode = audioContext.createPeriodicWave(real, imag, {disableNormalization: true})
+``` */
+ createPeriodicWave(
+ /** 一系列余弦术语(传统上的A项) */
+ real: Float32Array,
+ /** 一系列正弦项(传统上的B项) */
+ imag: Float32Array,
+ /** 一个字典对象,用于指定是否禁用规范化(默认启用规范化) */
+ constraints: Constraints
+ ): PeriodicWaveNode
+ /** [Promise WebAudioContext.close()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.close.html)
+*
+* 在插件中使用:不支持
+*
+* 关闭WebAudioContext
+*
+* **注意事项**
+*
+* 同步关闭对应的WebAudio上下文。close后会立即释放当前上下文的资源,不要在close后再次访问state属性。
+* ```js
+const audioCtx = wx.createWebAudioContext()
+audioCtx.close().then(() => {
+ console.log(audioCtx.state) // bad case:不应该在close后再访问state
+})
+``` */
+ close(): Promise
+ /** [Promise WebAudioContext.resume()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.resume.html)
+ *
+ * 在插件中使用:不支持
+ *
+ * 同步恢复已经被暂停的WebAudioContext上下文 */
+ resume(): Promise
+ /** [Promise WebAudioContext.suspend()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.suspend.html)
+ *
+ * 在插件中使用:不支持
+ *
+ * 同步暂停WebAudioContext上下文 */
+ suspend(): Promise
+ /** [ScriptProcessorNode WebAudioContext.createScriptProcessor(number bufferSize, number numberOfInputChannels, number numberOfOutputChannels)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createScriptProcessor.html)
+ *
+ * 在插件中使用:不支持
+ *
+ * 创建一个ScriptProcessorNode */
+ createScriptProcessor(
+ /** 缓冲区大小,以样本帧为单位 */
+ bufferSize: number,
+ /** 用于指定输入node的声道的数量 */
+ numberOfInputChannels: number,
+ /** 用于指定输出node的声道的数量 */
+ numberOfOutputChannels: number
+ ): ScriptProcessorNode
+ /** [WaveShaperNode WebAudioContext.createWaveShaper()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createWaveShaper.html)
+ *
+ * 在插件中使用:不支持
+ *
+ * 创建一个WaveShaperNode */
+ createWaveShaper(): WaveShaperNode
+ /** [[AudioBuffer](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioBuffer.html) WebAudioContext.createBuffer(number numOfChannels, number length, number sampleRate)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createBuffer.html)
+ *
+ * 在插件中使用:不支持
+ *
+ * 创建一个AudioBuffer,代表着一段驻留在内存中的短音频 */
+ createBuffer(
+ /** 定义了 buffer 中包含的声频通道数量的整数 */
+ numOfChannels: number,
+ /** 代表 buffer 中的样本帧数的整数 */
+ length: number,
+ /** 线性音频样本的采样率,即每一秒包含的关键帧的个数 */
+ sampleRate: number
+ ): AudioBuffer
+ /** [[AudioBuffer](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioBuffer.html) WebAudioContext.decodeAudioData(ArrayBuffer audioData, function successCallback, function errorCallback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.decodeAudioData.html)
+ *
+ * 在插件中使用:不支持
+ *
+ * 异步解码一段资源为AudioBuffer。 */
+ decodeAudioData(
+ /** 一个包含音频文件数据的 ArrayBuffer */
+ audioData: ArrayBuffer,
+ /** 在音频数据解码成功时被调用,参数为解码后的AudioBuffer */
+ successCallback: (...args: any[]) => any,
+ /** 在音频数据解码失败时被调用 */
+ errorCallback: (...args: any[]) => any
+ ): AudioBuffer
+ /** [[BufferSourceNode](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/BufferSourceNode.html) WebAudioContext.createBufferSource()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createBufferSource.html)
+ *
+ * 在插件中使用:不支持
+ *
+ * 创建一个BufferSourceNode实例,通过AudioBuffer对象来播放音频数据。 */
+ createBufferSource(): BufferSourceNode
+ }
+ /** 一类音频处理模块,不同的Node具备不同的功能,如GainNode(音量调整)等。一个WebAudioContextNode可以通过上下文来创建。
+ * 目前已经支持以下Node:
+ * IIRFilterNode
+ * WaveShaperNode
+ * ConstantSourceNode
+ * ChannelMergerNode
+ * OscillatorNode
+ * GainNode
+ * BiquadFilterNode
+ * PeriodicWaveNode
+ * BufferSourceNode
+ * ChannelSplitterNode
+ * ChannelMergerNode
+ * DelayNode
+ * DynamicsCompressorNode
+ * ScriptProcessorNode
+ * PannerNode
+ * AnalyserNode */
+ interface WebAudioContextNode {}
/** 提供预设的 Wi-Fi 信息列表 */
interface WifiData {
/** Wi-Fi 的 BSSID */
@@ -6325,33 +14518,405 @@ wx.getSetting({
/** Wi-Fi 设备密码 */
password?: string
}
- /** Wifi 信息 */
+ /** Wifi 信息
+ *
+ * **注意**
+ *
+ * - 安卓 wx.connectWifi / wx.getConnectedWifi 若设置了 partialInfo:true ,或者调用了 wx.onWifiConnectedWithPartialInfo 事件。将会返回只包含 SSID 属性的 WifiInfo 对象。
+ * - iOS wx.getConnectedWifi 若设置了 partialInfo:true ,将会返回只包含 SSID、BSSID 属性的 WifiInfo 对象,且需要用户开启微信定位权限才能正确返回结果。
+ * - 在某些情况下,可能 Wi-Fi 已经连接成功,但会因为获取不到完整的 WifiInfo 对象报错。具体错误信息为 errCode: 12010, errMsg: can't gain current wifi 或 no wifi is connected 。如果开发者不需要完整的 WifiInfo 对象,则可以通过采取上述策略解决报错问题。 */
interface WifiInfo {
/** Wi-Fi 的 BSSID */
BSSID: string
/** Wi-Fi 的 SSID */
SSID: string
- /** Wi-Fi 频段单位 MHz
+ /** 需要基础库: `2.12.0`
*
- * 最低基础库: `2.12.0` */
+ * Wi-Fi 频段单位 MHz */
frequency: number
/** Wi-Fi 是否安全 */
secure: boolean
- /** Wi-Fi 信号强度 */
+ /** Wi-Fi 信号强度, 安卓取值 0 ~ 100 ,iOS 取值 0 ~ 1 ,值越大强度越大 */
signalStrength: number
}
- interface WorkerOnMessageCallbackResult {
+ interface WindowInfo {
+ /** 设备像素比 */
+ pixelRatio: number
+ /** 在竖屏正方向下的安全区域。部分机型没有安全区域概念,也不会返回 safeArea 字段,开发者需自行兼容。 */
+ safeArea: SafeArea
+ /** 屏幕高度,单位px */
+ screenHeight: number
+ /** 窗口上边缘的y值 */
+ screenTop: number
+ /** 屏幕宽度,单位px */
+ screenWidth: number
+ /** 状态栏的高度,单位px */
+ statusBarHeight: number
+ /** 可使用窗口高度,单位px */
+ windowHeight: number
+ /** 可使用窗口宽度,单位px */
+ windowWidth: number
+ }
+ /** Worker 实例,主线程中可通过 [wx.createWorker](https://developers.weixin.qq.com/miniprogram/dev/api/worker/wx.createWorker.html) 接口获取,worker 线程中可通过全局变量 `worker` 获取。
+*
+* **示例代码**
+*
+* 运行以下代码需先进行基础配置,详细请查阅 [多线程 Worker](https://developers.weixin.qq.com/miniprogram/dev/framework/workers.html) 文档了解基础知识和配置方法。
+*
+* ```js
+const worker = wx.createWorker('workers/request/index.js') // 文件名指定 worker 的入口文件路径,绝对路径
+
+worker.onMessage(function (res) {
+ console.log(res)
+})
+// 监听worker被系统回收事件
+worker.onProcessKilled(function () {
+ console.log('worker has been killed')
+ // 重新创建一个worker
+ // wx.createWorker()
+})
+
+worker.postMessage({
+ msg: 'hello worker'
+})
+
+worker.terminate()
+``` */
+ interface Worker {
+ /** worker内的环境变量 */
+ env: WorkerEnv
+ /** [ArrayBuffer Worker.getCameraFrameData()](https://developers.weixin.qq.com/miniprogram/dev/api/worker/Worker.getCameraFrameData.html)
+*
+* 需要基础库: `2.25.1`
+*
+* 在插件中使用:不支持
+*
+* 获取摄像头当前帧图像,返回ArrayBuffer数据。仅限在 worker 线程中使用。
+*
+* **示例代码**
+*
+* ```js
+// app.js
+const worker = wx.createWorker('workers/index.js', {
+ useExperimentalWorker: true
+})
+
+const cameraContext = wx.createCameraContext()
+const cameraFrameListener = cameraContext.onCameraFrame(function() {})
+cameraFrameListener.start({
+ worker: worker
+})
+```
+*
+* ```js
+// workers/index.js
+const data = worker.getCameraFrameData()
+console.log(data)
+``` */
+ getCameraFrameData(): ArrayBuffer
+ /** [Worker.onError(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/worker/Worker.onError.html)
+*
+* 在插件中使用:不支持
+*
+* 监听 Worker 线程错误事件。当 Worker 线程中发生脚本错误时会触发此事件。
+*
+* **示例代码**
+*
+* ```js
+const worker = wx.createWorker('workers/request/index.js')
+
+worker.onError(function (error) {
+ console.error('Worker 错误:', error)
+})
+``` */
+ onError(
+ /** Worker 线程错误事件的监听函数 */
+ listener: WorkerOnErrorCallback
+ ): void
+ /** [Worker.onMessage(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/worker/Worker.onMessage.html)
+ *
+ * 在插件中使用:不支持
+ *
+ * 监听主线程/Worker 线程向当前线程发送的消息的事件。 */
+ onMessage(
+ /** 主线程/Worker 线程向当前线程发送的消息的事件的监听函数 */
+ listener: WorkerOnMessageCallback
+ ): void
+ /** [Worker.onProcessKilled(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/worker/Worker.onProcessKilled.html)
+ *
+ * 在插件中使用:不支持
+ *
+ * 监听 worker线程被系统回收事件(开启 useExperimentalWorker 后,当iOS系统资源紧张时,ExperimentalWorker 线程存在被系统回收的可能,开发者可监听此事件并重新创建一个worker)。仅限在主线程 worker 对象上调用。 */
+ onProcessKilled(
+ /** worker线程被系统回收事件的监听函数 */
+ listener: OnProcessKilledCallback
+ ): void
+ /** [Worker.postMessage(Object message)](https://developers.weixin.qq.com/miniprogram/dev/api/worker/Worker.postMessage.html)
+*
+* 在插件中使用:不支持
+*
+* 向主线程/Worker 线程发送的消息。
+*
+* **示例代码**
+*
+* worker 线程中
+* ```js
+worker.postMessage({
+ msg: 'hello from worker'
+})
+```
+*
+* 主线程中
+* ```js
+const worker = wx.createWorker('workers/request/index.js')
+
+worker.postMessage({
+ msg: 'hello from main'
+})
+```
+*
+* **提醒**
+*
+* 在基础库版本2.20.2之前,postMessage仅支持传递可序列化的key-value对象。
+* 在基础库2.20.2之后,postMessage支持传递任意类型的数据。 */
+ postMessage(
+ /** 需要发送的消息。 */
+ message: IAnyObject
+ ): void
+ /** [Worker.terminate()](https://developers.weixin.qq.com/miniprogram/dev/api/worker/Worker.terminate.html)
+ *
+ * 在插件中使用:不支持
+ *
+ * 结束当前 Worker 线程。仅限在主线程 worker 对象上调用。 */
+ terminate(): void
+ /** [Worker.testOnProcessKilled()](https://developers.weixin.qq.com/miniprogram/dev/api/worker/Worker.testOnProcessKilled.html)
+*
+* 需要基础库: `2.27.1`
+*
+* 在插件中使用:不支持
+*
+* 用于模拟 iOS ExperimentalWorker 线程被系统回收事件,以便于调试。接口仅在 worker 线程内可用。参考 [Worker.onProcessKilled](https://developers.weixin.qq.com/miniprogram/dev/api/worker/Worker.onProcessKilled.html)
+*
+* **示例代码**
+*
+* ```js
+// game.js
+const worker = wx.createWorker('workers/index.js', {
+ useExperimentalWorker: true
+})
+
+// 监听 ExperimentalWorker 被系统回收事件
+worker.onProcessKilled(function () {
+ console.log('worker has been killed')
+ // 重新创建一个worker
+ // wx.createWorker()
+})
+```
+*
+* ```js
+// workers/index.js
+setTimeout(() => {
+ // 模拟 ExperimentalWorker 线程被系统回收事件
+ worker.testOnProcessKilled()
+}, 2000)
+``` */
+ testOnProcessKilled(): void
+ }
+ /** worker内的环境变量 */
+ interface WorkerEnv {
+ /** 文件系统中的用户目录路径 (本地路径) */
+ USER_DATA_PATH: string
+ }
+ interface WorkerOnErrorListenerResult {
+ /** 错误对象 */
+ error: ResultError
+ }
+ interface WorkerOnMessageListenerResult {
/** 主线程/Worker 线程向当前线程发送的消息 */
message: IAnyObject
}
+ /** Easing 模块实现了常见的动画缓动函数(动画效果参考 https://easings.net/ ),可从 [wx.worklet](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/wx.worklet.html) 对象中读取。
+*
+* ****
+*
+* ## 示例代码
+*
+* [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/f94TCOmg7JFH)
+*
+* ### 预置动画函数
+*
+* * [Easing.bounce](#Easing.bounce) 反弹动画
+* * [Easing.ease](#Easing.ease) 惯性动画
+* * [Easing.elastic](#Easing.elastic) 弹性动画
+*
+* ### 标准缓动函数
+*
+* * [Easing.linear](#Easing.linear) 线性
+* * [Easing.quad](#Easing.quad) 二次方
+* * [Easing.cubic](#Easing.cubic) 三次方
+* * [Easing.poly](#Easing.poly) 实现其它幂函数
+*
+* ### 其它数学函数
+*
+* * [Easing.bezier](#Easing.bezier) 三次贝塞尔曲线
+* * [Easing.circle](#Easing.circle) 圆形曲线
+* * [Easing.sin](#Easing.sin) 正弦函数
+* * [Easing.exp](#Easing.exp) 指数函数
+*
+* ### 缓动方式
+*
+* 以上效果均有三种缓动方式
+*
+* * [Easing.in](#in) 正向执行缓动函数
+* * [Easing.out](#out) 反向执行缓动函数
+* * [Easing.inOut](#inout) 前半程正向,后半程反向
+* 以 `sin` 函数为例,其中 `Easing.in(Easing.sin)` 和直接使用 `Easing.sin` 效果相同。
+*
+* 1. `Easing.in(Easing.sin)` 动画效果参考 https://easings.net/#easeInSine
+* 2. `Easing.out(Easing.sin)` 动画效果参考 https://easings.net/#easeOutSine
+* 3. `Easing.inOut(Easing.sin)` 动画效果参考 https://easings.net/#easeInOutSine
+*
+* ### Easing.bounce
+*
+* 简单的反弹效果,[动画效果参考](https://easings.net/#easeInBounce)
+*
+* ```js
+Easing.bounce(t)
+```
+*
+* ### Easing.ease
+*
+* 简单的惯性动画,[动画效果参考](https://cubic-bezier.com/#.42,0,1,1)
+*
+* ```js
+Easing.ease(t)
+```
+*
+* ### Easing.elastic
+*
+* 简单的弹性动画,类似弹簧来回摆动,高阶函数。默认弹性为 1,会稍微超出一次。弹性为 0 时 不会过冲。[动画效果参考](https://easings.net/#easeInElastic)
+*
+* ```js
+Easing.elastic(bounciness = 1)
+```
+*
+* ### Easing.linear
+*
+* 线性函数,f(t) = t,[动画效果参考](https://cubic-bezier.com/#0,0,1,1)
+*
+* ```js
+Easing.linear(t)
+```
+* ### Easing.quad
+*
+* 二次方函数,f(t) = t * t,[动画效果参考](https://easings.net/#easeInQuad)
+*
+* ```js
+Easing.quad(t)
+```
+*
+* ### Easing.cubic
+*
+* 立方函数,f(t) = t * t * t,[动画效果参考](https://easings.net/#easeInCubic)
+*
+* ```js
+Easing.cubic(t)
+```
+*
+* ### Easing.poly
+*
+* 高阶函数,返回幂函数
+*
+* poly(4): [动画效果参考](https://easings.net/#easeInQuart)
+*
+* poly(5): [动画效果参考](https://easings.net/#easeInQuint)
+*
+* ```js
+Easing.poly(n)
+```
+*
+* ### Easing.bezier
+*
+* 三次贝塞尔曲线,效果同 css `transition-timing-function`
+*
+* 调试参数可借助 [可视化工具](https://cubic-bezier.com/)
+*
+* ```js
+Easing.bezier(x1, y1, x2, y2)
+```
+*
+* ### Easing.circle
+*
+* 圆形曲线,[动画效果参考](https://easings.net/#easeInCirc)
+*
+* ```js
+Easing.circle(t)
+```
+*
+* ### Easing.sin
+*
+* 正弦函数,[动画效果参考](https://easings.net/#easeInSine)
+*
+* ```js
+Easing.sin(t)
+```
+*
+* ### Easing.exp
+*
+* 指数函数,[动画效果参考](https://easings.net/#easeInExpo)
+*
+* ```js
+Easing.exp(t)
+```
+*
+* ### Easing.in
+*
+* 正向运行 `easing function`,高阶函数。
+*
+* ```js
+Easing.in(easing)
+```
+*
+* ### Easing.out
+*
+* 反向运行 `easing function`,高阶函数。
+*
+* ```js
+Easing.out(easing)
+```
+*
+* ### Easing.inOut
+*
+* 前半程正向,后半程反向,高阶函数。
+*
+* ```js
+Easing.inOut(easing)
+``` */
+ interface WorkletEasing {}
+ /** 需要基础库: `3.3.0`
+ *
+ * `ScrollView` 实例,可在 `worklet` 函数内操作 `scroll-view` 组件。 */
+ interface WorkletScrollViewContext {}
+ interface WorkletScrollViewContextScrollToOption {
+ /** 是否启用滚动动画 */
+ animated?: boolean
+ /** 滚动动画时长 */
+ duration?: number
+ /** 动画曲线 */
+ easingFunction?: string
+ /** 左边界距离 */
+ left?: number
+ /** 顶部距离 */
+ top?: number
+ }
interface WriteBLECharacteristicValueOption {
- /** 蓝牙特征值的 uuid */
+ /** 蓝牙特征的 UUID */
characteristicId: string
/** 蓝牙设备 id */
deviceId: string
- /** 蓝牙特征值对应服务的 uuid */
+ /** 蓝牙特征对应服务的 UUID */
serviceId: string
- /** 蓝牙设备特征值对应的二进制值 */
+ /** 蓝牙设备特征对应的二进制值 */
value: ArrayBuffer
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: WriteBLECharacteristicValueCompleteCallback
@@ -6359,15 +14924,21 @@ wx.getSetting({
fail?: WriteBLECharacteristicValueFailCallback
/** 接口调用成功的回调函数 */
success?: WriteBLECharacteristicValueSuccessCallback
+ /** 蓝牙特征值的写模式设置,有两种模式,iOS 优先 write,安卓优先 writeNoResponse 。(基础库 2.22.0 开始支持)
+ *
+ * 可选值:
+ * - 'write': 强制回复写,不支持时报错;
+ * - 'writeNoResponse': 强制无回复写,不支持时报错; */
+ writeType?: 'write' | 'writeNoResponse'
}
interface WriteCharacteristicValueObject {
- /** characteristic对应的uuid */
+ /** 蓝牙特征的 UUID */
characteristicId: string
- /** 是否需要通知主机value已更新 */
+ /** 是否需要通知主机 value 已更新 */
needNotify: boolean
- /** service 的 uuid */
+ /** 蓝牙特征对应服务的 UUID */
serviceId: string
- /** 特征值对应的二进制值 */
+ /** characteristic 对应的二进制值 */
value: ArrayBuffer
/** 可选,处理回包时使用 */
callbackId?: number
@@ -6378,16 +14949,6 @@ wx.getSetting({
/** 接口调用成功的回调函数 */
success?: WriteCharacteristicValueSuccessCallback
}
- interface WriteFileFailCallbackResult {
- /** 错误信息
- *
- * 可选值:
- * - 'fail no such file or directory, open ${filePath}': 指定的 filePath 所在目录不存在;
- * - 'fail permission denied, open ${dirPath}': 指定的 filePath 路径没有写权限;
- * - 'fail the maximum size of the file storage limit is exceeded': 存储空间不足;
- * - 'fail sdcard not mounted': Android sdcard 挂载失败; */
- errMsg: string
- }
interface WriteFileOption {
/** 要写入的文本或二进制数据 */
data: string | ArrayBuffer
@@ -6399,7 +14960,7 @@ wx.getSetting({
*
* 可选值:
* - 'ascii': ;
- * - 'base64': ;
+ * - 'base64': (注意,选择 base64 编码,data 只需要传 base64 内容本身,不要传 Data URI 前缀,否则会报 fail base64 encode error 错误。例如,传 aGVsbG8= 而不是传 data:image/png;base64,aGVsbG8= );
* - 'binary': ;
* - 'hex': ;
* - 'ucs2': 以小端序读取;
@@ -6440,61 +15001,97 @@ wx.getSetting({
/** uri 数组 */
uris?: any[]
}
- interface WxGetFileInfoOption {
- /** 本地文件路径 (本地路径) */
- filePath: string
+ interface WriteOption {
+ /** 写入的内容,类型为 String 或 ArrayBuffer */
+ data: string | ArrayBuffer
+ /** 文件描述符。fd 通过 [FileSystemManager.open](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.open.html) 或 [FileSystemManager.openSync](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.openSync.html) 接口获得 */
+ fd: string
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
- complete?: GetFileInfoCompleteCallback
- /** 计算文件摘要的算法
+ complete?: WriteCompleteCallback
+ /** 只在 data 类型是 String 时有效,指定写入文件的字符编码,默认为 utf8
*
* 可选值:
- * - 'md5': md5 算法;
- * - 'sha1': sha1 算法; */
- digestAlgorithm?: 'md5' | 'sha1'
+ * - 'ascii': ;
+ * - 'base64': ;
+ * - 'binary': ;
+ * - 'hex': ;
+ * - 'ucs2': 以小端序读取;
+ * - 'ucs-2': 以小端序读取;
+ * - 'utf16le': 以小端序读取;
+ * - 'utf-16le': 以小端序读取;
+ * - 'utf-8': ;
+ * - 'utf8': ;
+ * - 'latin1': ; */
+ encoding?:
+ | 'ascii'
+ | 'base64'
+ | 'binary'
+ | 'hex'
+ | 'ucs2'
+ | 'ucs-2'
+ | 'utf16le'
+ | 'utf-16le'
+ | 'utf-8'
+ | 'utf8'
+ | 'latin1'
/** 接口调用失败的回调函数 */
- fail?: WxGetFileInfoFailCallback
+ fail?: WriteFailCallback
+ /** 只在 data 类型是 ArrayBuffer 时有效,指定要写入的字节数,默认为 ArrayBuffer 从0开始偏移 offset 个字节后剩余的字节数 */
+ length?: number
+ /** 只在 data 类型是 ArrayBuffer 时有效,决定 ArrayBuffer 中要被写入的部位,即 ArrayBuffer 中的索引,默认0 */
+ offset?: number
+ /** 指定文件开头的偏移量,即数据要被写入的位置。当 position 不传或者传入非 Number 类型的值时,数据会被写入当前指针所在位置。 */
+ position?: number
/** 接口调用成功的回调函数 */
- success?: WxGetFileInfoSuccessCallback
+ success?: WriteSuccessCallback
}
- interface WxGetFileInfoSuccessCallbackResult {
- /** 按照传入的 digestAlgorithm 计算得出的的文件摘要 */
- digest: string
- /** 文件大小,以字节为单位 */
- size: number
+ /** 文件写入结果。 通过 [FileSystemManager.writeSync](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.writeSync.html) 接口返回 */
+ interface WriteResult {
+ /** 实际被写入到文件中的字节数(注意,被写入的字节数不一定与被写入的字符串字符数相同) */
+ bytesWritten: number
+ }
+ interface WriteSuccessCallbackResult {
+ /** 实际被写入到文件中的字节数(注意,被写入的字节数不一定与被写入的字符串字符数相同) */
+ bytesWritten: number
errMsg: string
}
- interface WxGetSavedFileListOption {
- /** 接口调用结束的回调函数(调用成功、失败都会执行) */
- complete?: GetSavedFileListCompleteCallback
- /** 接口调用失败的回调函数 */
- fail?: GetSavedFileListFailCallback
- /** 接口调用成功的回调函数 */
- success?: WxGetSavedFileListSuccessCallback
- }
- interface WxGetSavedFileListSuccessCallbackResult {
- /** 文件数组,每一项是一个 FileItem */
- fileList: FileItem[]
- errMsg: string
- }
- interface WxRemoveSavedFileOption {
- /** 需要删除的文件路径 (本地路径) */
- filePath: string
- /** 接口调用结束的回调函数(调用成功、失败都会执行) */
- complete?: RemoveSavedFileCompleteCallback
- /** 接口调用失败的回调函数 */
- fail?: WxRemoveSavedFileFailCallback
- /** 接口调用成功的回调函数 */
- success?: RemoveSavedFileSuccessCallback
- }
- interface WxSaveFileOption {
- /** 需要保存的文件的临时路径 (本地路径) */
- tempFilePath: string
- /** 接口调用结束的回调函数(调用成功、失败都会执行) */
- complete?: SaveFileCompleteCallback
- /** 接口调用失败的回调函数 */
- fail?: WxSaveFileFailCallback
- /** 接口调用成功的回调函数 */
- success?: SaveFileSuccessCallback
+ interface WriteSyncOption {
+ /** 写入的内容,类型为 String 或 ArrayBuffer */
+ data: string | ArrayBuffer
+ /** 文件描述符。fd 通过 [FileSystemManager.open](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.open.html) 或 [FileSystemManager.openSync](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.openSync.html) 接口获得 */
+ fd: string
+ /** 只在 data 类型是 String 时有效,指定写入文件的字符编码,默认为 utf8
+ *
+ * 可选值:
+ * - 'ascii': ;
+ * - 'base64': ;
+ * - 'binary': ;
+ * - 'hex': ;
+ * - 'ucs2': 以小端序读取;
+ * - 'ucs-2': 以小端序读取;
+ * - 'utf16le': 以小端序读取;
+ * - 'utf-16le': 以小端序读取;
+ * - 'utf-8': ;
+ * - 'utf8': ;
+ * - 'latin1': ; */
+ encoding?:
+ | 'ascii'
+ | 'base64'
+ | 'binary'
+ | 'hex'
+ | 'ucs2'
+ | 'ucs-2'
+ | 'utf16le'
+ | 'utf-16le'
+ | 'utf-8'
+ | 'utf8'
+ | 'latin1'
+ /** 只在 data 类型是 ArrayBuffer 时有效,指定要写入的字节数,默认为 ArrayBuffer 从0开始偏移 offset 个字节后剩余的字节数 */
+ length?: number
+ /** 只在 data 类型是 ArrayBuffer 时有效,决定 ArrayBuffer 中要被写入的部位,即 ArrayBuffer 中的索引,默认0 */
+ offset?: number
+ /** 指定文件开头的偏移量,即数据要被写入的位置。当 position 不传或者传入非 Number 类型的值时,数据会被写入当前指针所在位置。 */
+ position?: number
}
interface WxStartRecordOption {
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
@@ -6512,12 +15109,41 @@ wx.getSetting({
/** 接口调用成功的回调函数 */
success?: WxStopRecordSuccessCallback
}
+ /** 运动数据列表 */
+ interface WxaSportRecord {
+ /** 消耗卡路里 */
+ calorie: number
+ /** 运动距离 */
+ distance: number
+ /** 运动时长 */
+ time: number
+ /** 运动项目id */
+ typeId: number
+ }
+ /** 帧纹理对象 */
+ interface YUVTextureRes {
+ /** UV 分量纹理 */
+ uvTexture: WebGLTexture
+ /** Y 分量纹理 */
+ yTexture: WebGLTexture
+ }
+ /** 文件路径 */
+ interface ZipFileItem {
+ /** 文件内容 */
+ data: string | ArrayBuffer
+ /** 错误信息 */
+ errMsg: string
+ }
interface Animation {
/** [Object Animation.export()](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.export.html)
+ *
+ * 在插件中使用:支持
*
* 导出动画队列。**export 方法每次调用后会清掉之前的动画操作。** */
export(): AnimationExportResult
/** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.backgroundColor(string value)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.backgroundColor.html)
+ *
+ * 在插件中使用:支持
*
* 设置背景色 */
backgroundColor(
@@ -6525,6 +15151,8 @@ wx.getSetting({
value: string
): Animation
/** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.bottom(number|string value)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.bottom.html)
+ *
+ * 在插件中使用:支持
*
* 设置 bottom 值 */
bottom(
@@ -6532,6 +15160,8 @@ wx.getSetting({
value: number | string
): Animation
/** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.height(number|string value)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.height.html)
+ *
+ * 在插件中使用:支持
*
* 设置高度 */
height(
@@ -6539,6 +15169,8 @@ wx.getSetting({
value: number | string
): Animation
/** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.left(number|string value)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.left.html)
+ *
+ * 在插件中使用:支持
*
* 设置 left 值 */
left(
@@ -6546,14 +15178,20 @@ wx.getSetting({
value: number | string
): Animation
/** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.matrix()](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.matrix.html)
+ *
+ * 在插件中使用:支持
*
* 同 [transform-function matrix](https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/matrix) */
matrix(): Animation
/** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.matrix3d()](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.matrix3d.html)
+ *
+ * 在插件中使用:支持
*
* 同 [transform-function matrix3d](https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/matrix3d) */
matrix3d(): Animation
/** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.opacity(number value)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.opacity.html)
+ *
+ * 在插件中使用:支持
*
* 设置透明度 */
opacity(
@@ -6561,6 +15199,8 @@ wx.getSetting({
value: number
): Animation
/** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.right(number|string value)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.right.html)
+ *
+ * 在插件中使用:支持
*
* 设置 right 值 */
right(
@@ -6568,6 +15208,8 @@ wx.getSetting({
value: number | string
): Animation
/** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.rotate(number angle)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.rotate.html)
+ *
+ * 在插件中使用:支持
*
* 从原点顺时针旋转一个角度 */
rotate(
@@ -6575,6 +15217,8 @@ wx.getSetting({
angle: number
): Animation
/** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.rotate3d(number x, number y, number z, number angle)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.rotate3d.html)
+ *
+ * 在插件中使用:支持
*
* 从 固定 轴顺时针旋转一个角度 */
rotate3d(
@@ -6588,6 +15232,8 @@ wx.getSetting({
angle: number
): Animation
/** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.rotateX(number angle)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.rotateX.html)
+ *
+ * 在插件中使用:支持
*
* 从 X 轴顺时针旋转一个角度 */
rotateX(
@@ -6595,6 +15241,8 @@ wx.getSetting({
angle: number
): Animation
/** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.rotateY(number angle)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.rotateY.html)
+ *
+ * 在插件中使用:支持
*
* 从 Y 轴顺时针旋转一个角度 */
rotateY(
@@ -6602,6 +15250,8 @@ wx.getSetting({
angle: number
): Animation
/** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.rotateZ(number angle)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.rotateZ.html)
+ *
+ * 在插件中使用:支持
*
* 从 Z 轴顺时针旋转一个角度 */
rotateZ(
@@ -6609,6 +15259,8 @@ wx.getSetting({
angle: number
): Animation
/** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.scale(number sx, number sy)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.scale.html)
+ *
+ * 在插件中使用:支持
*
* 缩放 */
scale(
@@ -6618,6 +15270,8 @@ wx.getSetting({
sy?: number
): Animation
/** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.scale3d(number sx, number sy, number sz)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.scale3d.html)
+ *
+ * 在插件中使用:支持
*
* 缩放 */
scale3d(
@@ -6629,6 +15283,8 @@ wx.getSetting({
sz: number
): Animation
/** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.scaleX(number scale)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.scaleX.html)
+ *
+ * 在插件中使用:支持
*
* 缩放 X 轴 */
scaleX(
@@ -6636,6 +15292,8 @@ wx.getSetting({
scale: number
): Animation
/** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.scaleY(number scale)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.scaleY.html)
+ *
+ * 在插件中使用:支持
*
* 缩放 Y 轴 */
scaleY(
@@ -6643,6 +15301,8 @@ wx.getSetting({
scale: number
): Animation
/** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.scaleZ(number scale)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.scaleZ.html)
+ *
+ * 在插件中使用:支持
*
* 缩放 Z 轴 */
scaleZ(
@@ -6650,6 +15310,8 @@ wx.getSetting({
scale: number
): Animation
/** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.skew(number ax, number ay)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.skew.html)
+ *
+ * 在插件中使用:支持
*
* 对 X、Y 轴坐标进行倾斜 */
skew(
@@ -6659,6 +15321,8 @@ wx.getSetting({
ay: number
): Animation
/** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.skewX(number angle)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.skewX.html)
+ *
+ * 在插件中使用:支持
*
* 对 X 轴坐标进行倾斜 */
skewX(
@@ -6666,6 +15330,8 @@ wx.getSetting({
angle: number
): Animation
/** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.skewY(number angle)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.skewY.html)
+ *
+ * 在插件中使用:支持
*
* 对 Y 轴坐标进行倾斜 */
skewY(
@@ -6673,10 +15339,14 @@ wx.getSetting({
angle: number
): Animation
/** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.step(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.step.html)
+ *
+ * 在插件中使用:支持
*
* 表示一组动画完成。可以在一组动画中调用任意多个动画方法,一组动画中的所有动画会同时开始,一组动画完成后才会进行下一组动画。 */
step(option?: StepOption): Animation
/** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.top(number|string value)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.top.html)
+ *
+ * 在插件中使用:支持
*
* 设置 top 值 */
top(
@@ -6684,6 +15354,8 @@ wx.getSetting({
value: number | string
): Animation
/** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.translate(number tx, number ty)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.translate.html)
+ *
+ * 在插件中使用:支持
*
* 平移变换 */
translate(
@@ -6693,6 +15365,8 @@ wx.getSetting({
ty?: number
): Animation
/** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.translate3d(number tx, number ty, number tz)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.translate3d.html)
+ *
+ * 在插件中使用:支持
*
* 对 xyz 坐标进行平移变换 */
translate3d(
@@ -6704,6 +15378,8 @@ wx.getSetting({
tz?: number
): Animation
/** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.translateX(number translation)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.translateX.html)
+ *
+ * 在插件中使用:支持
*
* 对 X 轴平移 */
translateX(
@@ -6711,6 +15387,8 @@ wx.getSetting({
translation: number
): Animation
/** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.translateY(number translation)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.translateY.html)
+ *
+ * 在插件中使用:支持
*
* 对 Y 轴平移 */
translateY(
@@ -6718,6 +15396,8 @@ wx.getSetting({
translation: number
): Animation
/** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.translateZ(number translation)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.translateZ.html)
+ *
+ * 在插件中使用:支持
*
* 对 Z 轴平移 */
translateZ(
@@ -6725,6 +15405,8 @@ wx.getSetting({
translation: number
): Animation
/** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.width(number|string value)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.width.html)
+ *
+ * 在插件中使用:支持
*
* 设置宽度 */
width(
@@ -6734,14 +15416,23 @@ wx.getSetting({
}
interface AudioContext {
/** [AudioContext.pause()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioContext.pause.html)
+ *
+ * 在插件中使用:支持
+ * @deprecated 基础库版本 [1.6.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [wx.createInnerAudioContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.createInnerAudioContext.html) 替换
*
* 暂停音频。 */
pause(): void
/** [AudioContext.play()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioContext.play.html)
+ *
+ * 在插件中使用:支持
+ * @deprecated 基础库版本 [1.6.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [wx.createInnerAudioContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.createInnerAudioContext.html) 替换
*
* 播放音频。 */
play(): void
/** [AudioContext.seek(number position)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioContext.seek.html)
+ *
+ * 在插件中使用:支持
+ * @deprecated 基础库版本 [1.6.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [wx.createInnerAudioContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.createInnerAudioContext.html) 替换
*
* 跳转到指定位置。 */
seek(
@@ -6749,6 +15440,9 @@ wx.getSetting({
position: number
): void
/** [AudioContext.setSrc(string src)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioContext.setSrc.html)
+ *
+ * 在插件中使用:支持
+ * @deprecated 基础库版本 [1.6.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [wx.createInnerAudioContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.createInnerAudioContext.html) 替换
*
* 设置音频地址 */
setSrc(
@@ -6759,111 +15453,183 @@ wx.getSetting({
interface BLEPeripheralServer {
/** [BLEPeripheralServer.addService(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.addService.html)
*
- * 添加服务。
+ * 需要基础库: `2.10.3`
*
- * 最低基础库: `2.10.3` */
+ * 在插件中使用:不支持
+ *
+ * 添加服务。 */
addService(option: AddServiceOption): void
/** [BLEPeripheralServer.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.close.html)
*
- * 关闭当前服务端。
+ * 需要基础库: `2.10.3`
*
- * 最低基础库: `2.10.3` */
+ * 在插件中使用:不支持
+ *
+ * 关闭当前服务端。 */
close(option?: BLEPeripheralServerCloseOption): void
- /** [BLEPeripheralServer.offCharacteristicReadRequest(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.offCharacteristicReadRequest.html)
- *
- * 取消监听已连接的设备请求读当前外围设备的特征值事件
- *
- * 最低基础库: `2.10.3` */
+ /** [BLEPeripheralServer.offCharacteristicReadRequest(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.offCharacteristicReadRequest.html)
+*
+* 需要基础库: `2.10.3`
+*
+* 在插件中使用:不支持
+*
+* 移除已连接的设备请求读当前外围设备的特征值事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+BLEPeripheralServer.onCharacteristicReadRequest(listener)
+BLEPeripheralServer.offCharacteristicReadRequest(listener) // 需传入与监听时同一个的函数对象
+``` */
offCharacteristicReadRequest(
- /** 已连接的设备请求读当前外围设备的特征值事件的回调函数 */
- callback?: OffCharacteristicReadRequestCallback
+ /** onCharacteristicReadRequest 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffCharacteristicReadRequestCallback
): void
- /** [BLEPeripheralServer.offCharacteristicSubscribed(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.offCharacteristicSubscribed.html)
- *
- * 取消监听特征值订阅事件
- *
- * 最低基础库: `2.13.0` */
+ /** [BLEPeripheralServer.offCharacteristicSubscribed(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.offCharacteristicSubscribed.html)
+*
+* 需要基础库: `2.13.0`
+*
+* 在插件中使用:不支持
+*
+* 移除特征订阅事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+BLEPeripheralServer.onCharacteristicSubscribed(listener)
+BLEPeripheralServer.offCharacteristicSubscribed(listener) // 需传入与监听时同一个的函数对象
+``` */
offCharacteristicSubscribed(
- /** 特征值订阅事件的回调函数 */
- callback?: OffCharacteristicSubscribedCallback
+ /** onCharacteristicSubscribed 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffCharacteristicSubscribedCallback
): void
- /** [BLEPeripheralServer.offCharacteristicUnsubscribed(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.offCharacteristicUnsubscribed.html)
- *
- * 取消监听取消特征值订阅事件
- *
- * 最低基础库: `2.13.0` */
+ /** [BLEPeripheralServer.offCharacteristicUnsubscribed(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.offCharacteristicUnsubscribed.html)
+*
+* 需要基础库: `2.13.0`
+*
+* 在插件中使用:不支持
+*
+* 移除取消特征订阅事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+BLEPeripheralServer.onCharacteristicUnsubscribed(listener)
+BLEPeripheralServer.offCharacteristicUnsubscribed(listener) // 需传入与监听时同一个的函数对象
+``` */
offCharacteristicUnsubscribed(
- /** 取消特征值订阅事件的回调函数 */
- callback?: OffCharacteristicUnsubscribedCallback
+ /** onCharacteristicUnsubscribed 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffCharacteristicUnsubscribedCallback
): void
- /** [BLEPeripheralServer.offCharacteristicWriteRequest(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.offCharacteristicWriteRequest.html)
- *
- * 取消监听已连接的设备请求写当前外围设备的特征值事件
- *
- * 最低基础库: `2.10.3` */
+ /** [BLEPeripheralServer.offCharacteristicWriteRequest(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.offCharacteristicWriteRequest.html)
+*
+* 需要基础库: `2.10.3`
+*
+* 在插件中使用:不支持
+*
+* 移除已连接的设备请求写当前外围设备的特征值事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+BLEPeripheralServer.onCharacteristicWriteRequest(listener)
+BLEPeripheralServer.offCharacteristicWriteRequest(listener) // 需传入与监听时同一个的函数对象
+``` */
offCharacteristicWriteRequest(
- /** 已连接的设备请求写当前外围设备的特征值事件的回调函数 */
- callback?: OffCharacteristicWriteRequestCallback
+ /** onCharacteristicWriteRequest 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffCharacteristicWriteRequestCallback
): void
- /** [BLEPeripheralServer.onCharacteristicReadRequest(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.onCharacteristicReadRequest.html)
+ /** [BLEPeripheralServer.onCharacteristicReadRequest(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.onCharacteristicReadRequest.html)
*
- * 监听已连接的设备请求读当前外围设备的特征值事件。收到该消息后需要立刻调用 `writeCharacteristicValue` 写回数据,否则主机不会收到响应。
+ * 需要基础库: `2.10.3`
*
- * 最低基础库: `2.10.3` */
+ * 在插件中使用:不支持
+ *
+ * 监听已连接的设备请求读当前外围设备的特征值事件。收到该消息后需要立刻调用 [writeCharacteristicValue](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.writeCharacteristicValue.html) 写回数据,否则主机不会收到响应。 */
onCharacteristicReadRequest(
- /** 已连接的设备请求读当前外围设备的特征值事件的回调函数 */
- callback: OnCharacteristicReadRequestCallback
+ /** 已连接的设备请求读当前外围设备的特征值事件的监听函数 */
+ listener: OnCharacteristicReadRequestCallback
): void
- /** [BLEPeripheralServer.onCharacteristicSubscribed(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.onCharacteristicSubscribed.html)
+ /** [BLEPeripheralServer.onCharacteristicSubscribed(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.onCharacteristicSubscribed.html)
*
- * 监听特征值订阅事件,仅 iOS 支持。
+ * 需要基础库: `2.13.0`
*
- * 最低基础库: `2.13.0` */
+ * 在插件中使用:不支持
+ *
+ * 监听特征订阅事件,仅 iOS 支持。 */
onCharacteristicSubscribed(
- /** 特征值订阅事件的回调函数 */
- callback: OnCharacteristicSubscribedCallback
+ /** 特征订阅事件的监听函数 */
+ listener: OnCharacteristicSubscribedCallback
): void
- /** [BLEPeripheralServer.onCharacteristicUnsubscribed(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.onCharacteristicUnsubscribed.html)
+ /** [BLEPeripheralServer.onCharacteristicUnsubscribed(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.onCharacteristicUnsubscribed.html)
*
- * 监听取消特征值订阅事件,仅 iOS 支持。
+ * 需要基础库: `2.13.0`
*
- * 最低基础库: `2.13.0` */
+ * 在插件中使用:不支持
+ *
+ * 监听取消特征订阅事件,仅 iOS 支持。 */
onCharacteristicUnsubscribed(
- /** 取消特征值订阅事件的回调函数 */
- callback: OnCharacteristicUnsubscribedCallback
+ /** 取消特征订阅事件的监听函数 */
+ listener: OnCharacteristicUnsubscribedCallback
): void
- /** [BLEPeripheralServer.onCharacteristicWriteRequest(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.onCharacteristicWriteRequest.html)
+ /** [BLEPeripheralServer.onCharacteristicWriteRequest(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.onCharacteristicWriteRequest.html)
*
- * 监听已连接的设备请求写当前外围设备的特征值事件。收到该消息后需要立刻调用 `writeCharacteristicValue` 写回数据,否则主机不会收到响应。
+ * 需要基础库: `2.10.3`
*
- * 最低基础库: `2.10.3` */
+ * 在插件中使用:不支持
+ *
+ * 监听已连接的设备请求写当前外围设备的特征值事件。收到该消息后需要立刻调用 [writeCharacteristicValue](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.writeCharacteristicValue.html) 写回数据,否则主机不会收到响应。 */
onCharacteristicWriteRequest(
- /** 已连接的设备请求写当前外围设备的特征值事件的回调函数 */
- callback: OnCharacteristicWriteRequestCallback
+ /** 已连接的设备请求写当前外围设备的特征值事件的监听函数 */
+ listener: OnCharacteristicWriteRequestCallback
): void
/** [BLEPeripheralServer.removeService(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.removeService.html)
*
- * 移除服务。
+ * 需要基础库: `2.10.3`
*
- * 最低基础库: `2.10.3` */
+ * 在插件中使用:不支持
+ *
+ * 移除服务。 */
removeService(option: RemoveServiceOption): void
/** [BLEPeripheralServer.startAdvertising(Object Object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.startAdvertising.html)
+ *
+ * 需要基础库: `2.10.3`
+ *
+ * 在插件中使用:不支持
*
* 开始广播本地创建的外围设备。
*
- * 最低基础库: `2.10.3` */
+ * **注意**
+ *
+ * - Android 8.0.9 开始,支持直接使用 16/32/128 位 UUID;
+ * - Android 8.0.9 以下版本只支持 128 位 UUID,使用 16/32 位的 UUID 时需要进行补位(系统会自动识别是否属于预分配区间),可以参考[蓝牙指南](https://developers.weixin.qq.com/miniprogram/dev/framework/device/ble.html);
+ * - iOS 必须直接使用 16 位的 UUID,不能补位到 128 位,否则系统组包时仍会按照 128 位传输。iOS 暂不支持 32 位 UUID。
+ * - iOS 同时只能发起一个广播,安卓支持同时发起多个广播。
+ * - 传 beacon 参数时,不能同时传入 deviceName,serviceUuids,manufacturerData 参数。 */
startAdvertising(Object: StartAdvertisingObject): void
/** [BLEPeripheralServer.stopAdvertising(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.stopAdvertising.html)
*
- * 停止广播。
+ * 需要基础库: `2.10.3`
*
- * 最低基础库: `2.10.3` */
+ * 在插件中使用:不支持
+ *
+ * 停止广播。 */
stopAdvertising(option?: StopAdvertisingOption): void
/** [BLEPeripheralServer.writeCharacteristicValue(Object Object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.writeCharacteristicValue.html)
*
- * 往指定特征值写入数据,并通知已连接的主机,从机的特征值已发生变化,该接口会处理是走回包还是走订阅。
+ * 需要基础库: `2.10.3`
*
- * 最低基础库: `2.10.3` */
+ * 在插件中使用:不支持
+ *
+ * 往指定特征写入二进制数据值,并通知已连接的主机,从机的特征值已发生变化,该接口会处理是走回包还是走订阅。 */
writeCharacteristicValue(Object: WriteCharacteristicValueObject): void
}
interface BackgroundAudioError {
@@ -6886,110 +15652,31 @@ wx.getSetting({
* | 10004 | | 格式错误 |
* | -1 | | 未知错误 | */ errCode: number
}
- interface BackgroundAudioManager {
- /** [BackgroundAudioManager.onCanplay(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onCanplay.html)
+ interface BeaconError {
+ /** 错误信息
*
- * 监听背景音频进入可播放状态事件。 但不保证后面可以流畅播放 */
- onCanplay(
- /** 背景音频进入可播放状态事件的回调函数 */
- callback: OnCanplayCallback
- ): void
- /** [BackgroundAudioManager.onEnded(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onEnded.html)
+ * | 错误码 | 错误信息 | 说明 |
+ * | - | - | - |
+ * | 0 | ok | 正常 |
+ * | 11000 | unsupport | 系统或设备不支持 |
+ * | 11001 | bluetooth service unavailable | 蓝牙服务不可用 |
+ * | 11002 | location service unavailable | 位置服务不可用 |
+ * | 11003 | already start | 已经开始搜索 |
+ * | 11004 | not startBeaconDiscovery | 还未开始搜索 |
+ * | 11005 | system error | 系统错误 |
+ * | 11006 | invalid data | 参数不正确 | */ errMsg: string
+ /** 错误码
*
- * 监听背景音频自然播放结束事件 */
- onEnded(
- /** 背景音频自然播放结束事件的回调函数 */
- callback: OnEndedCallback
- ): void
- /** [BackgroundAudioManager.onError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onError.html)
- *
- * 监听背景音频播放错误事件 */
- onError(
- /** 背景音频播放错误事件的回调函数 */
- callback: BackgroundAudioManagerOnErrorCallback
- ): void
- /** [BackgroundAudioManager.onNext(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onNext.html)
- *
- * 监听用户在系统音乐播放面板点击下一曲事件(仅iOS) */
- onNext(
- /** 用户在系统音乐播放面板点击下一曲事件的回调函数 */
- callback: OnNextCallback
- ): void
- /** [BackgroundAudioManager.onPause(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onPause.html)
- *
- * 监听背景音频暂停事件 */
- onPause(
- /** 背景音频暂停事件的回调函数 */
- callback: OnPauseCallback
- ): void
- /** [BackgroundAudioManager.onPlay(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onPlay.html)
- *
- * 监听背景音频播放事件 */
- onPlay(
- /** 背景音频播放事件的回调函数 */
- callback: OnPlayCallback
- ): void
- /** [BackgroundAudioManager.onPrev(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onPrev.html)
- *
- * 监听用户在系统音乐播放面板点击上一曲事件(仅iOS) */
- onPrev(
- /** 用户在系统音乐播放面板点击上一曲事件的回调函数 */
- callback: OnPrevCallback
- ): void
- /** [BackgroundAudioManager.onSeeked(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onSeeked.html)
- *
- * 监听背景音频完成跳转操作事件 */
- onSeeked(
- /** 背景音频完成跳转操作事件的回调函数 */
- callback: OnSeekedCallback
- ): void
- /** [BackgroundAudioManager.onSeeking(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onSeeking.html)
- *
- * 监听背景音频开始跳转操作事件 */
- onSeeking(
- /** 背景音频开始跳转操作事件的回调函数 */
- callback: OnSeekingCallback
- ): void
- /** [BackgroundAudioManager.onStop(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onStop.html)
- *
- * 监听背景音频停止事件 */
- onStop(
- /** 背景音频停止事件的回调函数 */
- callback: InnerAudioContextOnStopCallback
- ): void
- /** [BackgroundAudioManager.onTimeUpdate(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onTimeUpdate.html)
- *
- * 监听背景音频播放进度更新事件,只有小程序在前台时会回调。 */
- onTimeUpdate(
- /** 背景音频播放进度更新事件的回调函数 */
- callback: OnTimeUpdateCallback
- ): void
- /** [BackgroundAudioManager.onWaiting(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onWaiting.html)
- *
- * 监听音频加载中事件。当音频因为数据不足,需要停下来加载时会触发 */
- onWaiting(
- /** 音频加载中事件的回调函数 */
- callback: OnWaitingCallback
- ): void
- /** [BackgroundAudioManager.pause()](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.pause.html)
- *
- * 暂停音乐 */
- pause(): void
- /** [BackgroundAudioManager.play()](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.play.html)
- *
- * 播放音乐 */
- play(): void
- /** [BackgroundAudioManager.seek(number currentTime)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.seek.html)
- *
- * 跳转到指定位置 */
- seek(
- /** 跳转的位置,单位 s。精确到小数点后 3 位,即支持 ms 级别精确度 */
- currentTime: number
- ): void
- /** [BackgroundAudioManager.stop()](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.stop.html)
- *
- * 停止音乐 */
- stop(): void
+ * | 错误码 | 错误信息 | 说明 |
+ * | - | - | - |
+ * | 0 | ok | 正常 |
+ * | 11000 | unsupport | 系统或设备不支持 |
+ * | 11001 | bluetooth service unavailable | 蓝牙服务不可用 |
+ * | 11002 | location service unavailable | 位置服务不可用 |
+ * | 11003 | already start | 已经开始搜索 |
+ * | 11004 | not startBeaconDiscovery | 还未开始搜索 |
+ * | 11005 | system error | 系统错误 |
+ * | 11006 | invalid data | 参数不正确 | */ errCode: number
}
interface BluetoothError {
/** 错误信息
@@ -6997,15 +15684,15 @@ wx.getSetting({
* | 错误码 | 错误信息 | 说明 |
* | - | - | - |
* | 0 | ok | 正常 |
- * | -1 | already connet | 已连接 |
+ * | -1 | already connect | 已连接 |
* | 10000 | not init | 未初始化蓝牙适配器 |
* | 10001 | not available | 当前蓝牙适配器不可用 |
* | 10002 | no device | 没有找到指定设备 |
* | 10003 | connection fail | 连接失败 |
* | 10004 | no service | 没有找到指定服务 |
- * | 10005 | no characteristic | 没有找到指定特征值 |
+ * | 10005 | no characteristic | 没有找到指定特征 |
* | 10006 | no connection | 当前连接已断开 |
- * | 10007 | property not support | 当前特征值不支持此操作 |
+ * | 10007 | property not support | 当前特征不支持此操作 |
* | 10008 | system error | 其余所有系统上报的异常 |
* | 10009 | system not support | Android 系统特有,系统版本低于 4.3 不支持 BLE |
* | 10012 | operate time out | 连接超时 |
@@ -7015,15 +15702,15 @@ wx.getSetting({
* | 错误码 | 错误信息 | 说明 |
* | - | - | - |
* | 0 | ok | 正常 |
- * | -1 | already connet | 已连接 |
+ * | -1 | already connect | 已连接 |
* | 10000 | not init | 未初始化蓝牙适配器 |
* | 10001 | not available | 当前蓝牙适配器不可用 |
* | 10002 | no device | 没有找到指定设备 |
* | 10003 | connection fail | 连接失败 |
* | 10004 | no service | 没有找到指定服务 |
- * | 10005 | no characteristic | 没有找到指定特征值 |
+ * | 10005 | no characteristic | 没有找到指定特征 |
* | 10006 | no connection | 当前连接已断开 |
- * | 10007 | property not support | 当前特征值不支持此操作 |
+ * | 10007 | property not support | 当前特征不支持此操作 |
* | 10008 | system error | 其余所有系统上报的异常 |
* | 10009 | system not support | Android 系统特有,系统版本低于 4.3 不支持 BLE |
* | 10012 | operate time out | 连接超时 |
@@ -7032,24 +15719,36 @@ wx.getSetting({
interface CameraContext {
/** [CameraContext.setZoom(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraContext.setZoom.html)
*
- * 设置缩放级别
+ * 需要基础库: `2.10.0`
*
- * 最低基础库: `2.10.0` */
- setZoom(option: SetZoomOption): void
+ * 在插件中使用:支持
+ *
+ * 设置缩放级别 */
+ setZoom(option: CameraContextSetZoomOption): void
/** [CameraContext.startRecord(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraContext.startRecord.html)
+ *
+ * 在插件中使用:支持
*
* 开始录像 */
startRecord(option: CameraContextStartRecordOption): void
/** [CameraContext.stopRecord(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraContext.stopRecord.html)
+ *
+ * 在插件中使用:支持
*
* 结束录像 */
stopRecord(option: CameraContextStopRecordOption): void
/** [CameraContext.takePhoto(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraContext.takePhoto.html)
+ *
+ * 在插件中使用:支持
*
* 拍摄照片 */
takePhoto(option: TakePhotoOption): void
/** [[CameraFrameListener](https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraFrameListener.html) CameraContext.onCameraFrame(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraContext.onCameraFrame.html)
*
+* 需要基础库: `2.7.0`
+*
+* 在插件中使用:不支持
+*
* 获取 Camera 实时帧数据
*
* ****
@@ -7058,16 +15757,13 @@ wx.getSetting({
*
* **示例代码**
*
-*
* ```js
const context = wx.createCameraContext()
const listener = context.onCameraFrame((frame) => {
console.log(frame.data instanceof ArrayBuffer, frame.width, frame.height)
})
listener.start()
-```
-*
-* 最低基础库: `2.7.0` */
+``` */
onCameraFrame(
/** 回调函数 */
callback: OnCameraFrameCallback
@@ -7075,1545 +15771,30 @@ listener.start()
}
interface CameraFrameListener {
/** [CameraFrameListener.start(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraFrameListener.start.html)
+ *
+ * 在插件中使用:不支持
*
* 开始监听帧数据 */
start(option?: CameraFrameListenerStartOption): void
/** [CameraFrameListener.stop(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraFrameListener.stop.html)
+ *
+ * 在插件中使用:不支持
*
* 停止监听帧数据 */
stop(option?: StopOption): void
}
- interface Canvas {
- /** [Canvas.cancelAnimationFrame(number requestID)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.cancelAnimationFrame.html)
- *
- * 取消由 requestAnimationFrame 添加到计划中的动画帧请求。支持在 2D Canvas 和 WebGL Canvas 下使用, 但不支持混用 2D 和 WebGL 的方法。
- *
- * 最低基础库: `2.7.0` */
- cancelAnimationFrame(requestID: number): void
- /** [[ImageData](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/ImageData.html) Canvas.createImageData()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.createImageData.html)
- *
- * 创建一个 ImageData 对象。仅支持在 2D Canvas 中使用。
- *
- * 最低基础库: `2.9.0` */
- createImageData(): ImageData
- /** [[Image](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Image.html) Canvas.createImage()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.createImage.html)
- *
- * 创建一个图片对象。 支持在 2D Canvas 和 WebGL Canvas 下使用, 但不支持混用 2D 和 WebGL 的方法。
- *
- * 最低基础库: `2.7.0` */
- createImage(): Image
- /** [[Path2D](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Path2D.html) Canvas.createPath2D([Path2D](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Path2D.html) path)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.createPath2D.html)
- *
- * 创建 Path2D 对象
- *
- * 最低基础库: `2.11.0` */
- createPath2D(
- /** [Path2D](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Path2D.html)
- *
- * */
- path: Path2D
- ): Path2D
- /** [[RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) Canvas.getContext(string contextType)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.getContext.html)
- *
- * 该方法返回 Canvas 的绘图上下文
- *
- * ****
- *
- * 支持获取 2D 和 WebGL 绘图上下文
- *
- * 最低基础库: `2.7.0` */
- getContext(contextType: string): any
- /** [number Canvas.requestAnimationFrame(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.requestAnimationFrame.html)
- *
- * 在下次进行重绘时执行。 支持在 2D Canvas 和 WebGL Canvas 下使用, 但不支持混用 2D 和 WebGL 的方法。
- *
- * 最低基础库: `2.7.0` */
- requestAnimationFrame(
- /** 执行的 callback */
- callback: (...args: any[]) => any
- ): number
- /** [string Canvas.toDataURL(string type, number encoderOptions)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.toDataURL.html)
- *
- * 返回一个包含图片展示的 data URI 。可以使用 type 参数其类型,默认为 PNG 格式。
- *
- * 最低基础库: `2.11.0` */
- toDataURL(
- /** 图片格式,默认为 image/png */
- type: string,
- /** 在指定图片格式为 image/jpeg 或 image/webp的情况下,可以从 0 到 1 的区间内选择图片的质量。如果超出取值范围,将会使用默认值 0.92。其他参数会被忽略。 */
- encoderOptions: number
- ): string
- }
- interface CanvasContext {
- /** [CanvasContext.arc(number x, number y, number r, number sAngle, number eAngle, boolean counterclockwise)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.arc.html)
-*
-* 创建一条弧线。
-*
-* - 创建一个圆可以指定起始弧度为 0,终止弧度为 2 * Math.PI。
-* - 用 `stroke` 或者 `fill` 方法来在 `canvas` 中画弧线。
-*
-* **示例代码**
-*
-*
-* ```javascript
-const ctx = wx.createCanvasContext('myCanvas')
-
-// Draw coordinates
-ctx.arc(100, 75, 50, 0, 2 * Math.PI)
-ctx.setFillStyle('#EEEEEE')
-ctx.fill()
-
-ctx.beginPath()
-ctx.moveTo(40, 75)
-ctx.lineTo(160, 75)
-ctx.moveTo(100, 15)
-ctx.lineTo(100, 135)
-ctx.setStrokeStyle('#AAAAAA')
-ctx.stroke()
-
-ctx.setFontSize(12)
-ctx.setFillStyle('black')
-ctx.fillText('0', 165, 78)
-ctx.fillText('0.5*PI', 83, 145)
-ctx.fillText('1*PI', 15, 78)
-ctx.fillText('1.5*PI', 83, 10)
-
-// Draw points
-ctx.beginPath()
-ctx.arc(100, 75, 2, 0, 2 * Math.PI)
-ctx.setFillStyle('lightgreen')
-ctx.fill()
-
-ctx.beginPath()
-ctx.arc(100, 25, 2, 0, 2 * Math.PI)
-ctx.setFillStyle('blue')
-ctx.fill()
-
-ctx.beginPath()
-ctx.arc(150, 75, 2, 0, 2 * Math.PI)
-ctx.setFillStyle('red')
-ctx.fill()
-
-// Draw arc
-ctx.beginPath()
-ctx.arc(100, 75, 50, 0, 1.5 * Math.PI)
-ctx.setStrokeStyle('#333333')
-ctx.stroke()
-
-ctx.draw()
-```
-*
-* 
-*
-* 针对 arc(100, 75, 50, 0, 1.5 * Math.PI)的三个关键坐标如下:
-*
-* - 绿色: 圆心 (100, 75)
-* - 红色: 起始弧度 (0)
-* - 蓝色: 终止弧度 (1.5 * Math.PI) */
- arc(
- /** 圆心的 x 坐标 */
- x: number,
- /** 圆心的 y 坐标 */
- y: number,
- /** 圆的半径 */
- r: number,
- /** 起始弧度,单位弧度(在3点钟方向) */
- sAngle: number,
- /** 终止弧度 */
- eAngle: number,
- /** 弧度的方向是否是逆时针 */
- counterclockwise?: boolean
- ): void
- /** [CanvasContext.arcTo(number x1, number y1, number x2, number y2, number radius)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.arcTo.html)
- *
- * 根据控制点和半径绘制圆弧路径。
- *
- * 最低基础库: `1.9.90` */
- arcTo(
- /** 第一个控制点的 x 轴坐标 */
- x1: number,
- /** 第一个控制点的 y 轴坐标 */
- y1: number,
- /** 第二个控制点的 x 轴坐标 */
- x2: number,
- /** 第二个控制点的 y 轴坐标 */
- y2: number,
- /** 圆弧的半径 */
- radius: number
- ): void
- /** [CanvasContext.beginPath()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.beginPath.html)
-*
-* 开始创建一个路径。需要调用 `fill` 或者 `stroke` 才会使用路径进行填充或描边
-*
-* - 在最开始的时候相当于调用了一次 `beginPath`。
-* - 同一个路径内的多次 `setFillStyle`、`setStrokeStyle`、`setLineWidth`等设置,以最后一次设置为准。
-*
-* **示例代码**
-*
-*
-* ```javascript
-const ctx = wx.createCanvasContext('myCanvas')
-// begin path
-ctx.rect(10, 10, 100, 30)
-ctx.setFillStyle('yellow')
-ctx.fill()
-
-// begin another path
-ctx.beginPath()
-ctx.rect(10, 40, 100, 30)
-
-// only fill this rect, not in current path
-ctx.setFillStyle('blue')
-ctx.fillRect(10, 70, 100, 30)
-
-ctx.rect(10, 100, 100, 30)
-
-// it will fill current path
-ctx.setFillStyle('red')
-ctx.fill()
-ctx.draw()
-```
-*
-*  */
- beginPath(): void
- /** [CanvasContext.bezierCurveTo(number cp1x, number cp1y, number cp2x, number cp2y, number x, number y)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.bezierCurveTo.html)
-*
-* 创建三次方贝塞尔曲线路径。曲线的起始点为路径中前一个点。
-*
-* **示例代码**
-*
-*
-* ```javascript
-const ctx = wx.createCanvasContext('myCanvas')
-
-// Draw points
-ctx.beginPath()
-ctx.arc(20, 20, 2, 0, 2 * Math.PI)
-ctx.setFillStyle('red')
-ctx.fill()
-
-ctx.beginPath()
-ctx.arc(200, 20, 2, 0, 2 * Math.PI)
-ctx.setFillStyle('lightgreen')
-ctx.fill()
-
-ctx.beginPath()
-ctx.arc(20, 100, 2, 0, 2 * Math.PI)
-ctx.arc(200, 100, 2, 0, 2 * Math.PI)
-ctx.setFillStyle('blue')
-ctx.fill()
-
-ctx.setFillStyle('black')
-ctx.setFontSize(12)
-
-// Draw guides
-ctx.beginPath()
-ctx.moveTo(20, 20)
-ctx.lineTo(20, 100)
-ctx.lineTo(150, 75)
-
-ctx.moveTo(200, 20)
-ctx.lineTo(200, 100)
-ctx.lineTo(70, 75)
-ctx.setStrokeStyle('#AAAAAA')
-ctx.stroke()
-
-// Draw quadratic curve
-ctx.beginPath()
-ctx.moveTo(20, 20)
-ctx.bezierCurveTo(20, 100, 200, 100, 200, 20)
-ctx.setStrokeStyle('black')
-ctx.stroke()
-
-ctx.draw()
-```
-*
-* 
-*
-* 针对 moveTo(20, 20) bezierCurveTo(20, 100, 200, 100, 200, 20) 的三个关键坐标如下:
-*
-* - 红色:起始点(20, 20)
-* - 蓝色:两个控制点(20, 100) (200, 100)
-* - 绿色:终止点(200, 20) */
- bezierCurveTo(
- /** 第一个贝塞尔控制点的 x 坐标 */
- cp1x: number,
- /** 第一个贝塞尔控制点的 y 坐标 */
- cp1y: number,
- /** 第二个贝塞尔控制点的 x 坐标 */
- cp2x: number,
- /** 第二个贝塞尔控制点的 y 坐标 */
- cp2y: number,
- /** 结束点的 x 坐标 */
- x: number,
- /** 结束点的 y 坐标 */
- y: number
- ): void
- /** [CanvasContext.clearRect(number x, number y, number width, number height)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.clearRect.html)
-*
-* 清除画布上在该矩形区域内的内容
-*
-* **示例代码**
-*
-*
-* clearRect 并非画一个白色的矩形在地址区域,而是清空,为了有直观感受,对 canvas 加了一层背景色。
-* ```html
-*
-* ```
-* ```javascript
-const ctx = wx.createCanvasContext('myCanvas')
-ctx.setFillStyle('red')
-ctx.fillRect(0, 0, 150, 200)
-ctx.setFillStyle('blue')
-ctx.fillRect(150, 0, 150, 200)
-ctx.clearRect(10, 10, 150, 75)
-ctx.draw()
-```
-*  */
- clearRect(
- /** 矩形路径左上角的横坐标 */
- x: number,
- /** 矩形路径左上角的纵坐标 */
- y: number,
- /** 矩形路径的宽度 */
- width: number,
- /** 矩形路径的高度 */
- height: number
- ): void
- /** [CanvasContext.clip()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.clip.html)
-*
-* 从原始画布中剪切任意形状和尺寸。一旦剪切了某个区域,则所有之后的绘图都会被限制在被剪切的区域内(不能访问画布上的其他区域)。可以在使用 `clip` 方法前通过使用 `save` 方法对当前画布区域进行保存,并在以后的任意时间通过`restore`方法对其进行恢复。
-*
-* **示例代码**
-*
-*
-* ```javascript
-const ctx = wx.createCanvasContext('myCanvas')
-
-wx.downloadFile({
- url: 'http://is5.mzstatic.com/image/thumb/Purple128/v4/75/3b/90/753b907c-b7fb-5877-215a-759bd73691a4/source/50x50bb.jpg',
- success: function(res) {
- ctx.save()
- ctx.beginPath()
- ctx.arc(50, 50, 25, 0, 2*Math.PI)
- ctx.clip()
- ctx.drawImage(res.tempFilePath, 25, 25)
- ctx.restore()
- ctx.draw()
- }
-})
-```
-* 
-*
-* 最低基础库: `1.6.0` */
- clip(): void
- /** [CanvasContext.closePath()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.closePath.html)
-*
-* 关闭一个路径。会连接起点和终点。如果关闭路径后没有调用 `fill` 或者 `stroke` 并开启了新的路径,那之前的路径将不会被渲染。
-*
-* **示例代码**
-*
-*
-* ```javascript
-const ctx = wx.createCanvasContext('myCanvas')
-ctx.moveTo(10, 10)
-ctx.lineTo(100, 10)
-ctx.lineTo(100, 100)
-ctx.closePath()
-ctx.stroke()
-ctx.draw()
-```
-* 
-*
-* ```javascript
-const ctx = wx.createCanvasContext('myCanvas')
-// begin path
-ctx.rect(10, 10, 100, 30)
-ctx.closePath()
-
-// begin another path
-ctx.beginPath()
-ctx.rect(10, 40, 100, 30)
-
-// only fill this rect, not in current path
-ctx.setFillStyle('blue')
-ctx.fillRect(10, 70, 100, 30)
-
-ctx.rect(10, 100, 100, 30)
-
-// it will fill current path
-ctx.setFillStyle('red')
-ctx.fill()
-ctx.draw()
-```
-*
-*  */
- closePath(): void
- /** [CanvasContext.createPattern(string image, string repetition)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.createPattern.html)
- *
- * 对指定的图像创建模式的方法,可在指定的方向上重复元图像
- *
- * 最低基础库: `1.9.90` */
- createPattern(
- /** 重复的图像源,支持代码包路径和本地临时路径 (本地路径) */
- image: string,
- /** 如何重复图像
- *
- * 参数 repetition 可选值:
- * - 'repeat': 水平竖直方向都重复;
- * - 'repeat-x': 水平方向重复;
- * - 'repeat-y': 竖直方向重复;
- * - 'no-repeat': 不重复; */
- repetition: 'repeat' | 'repeat-x' | 'repeat-y' | 'no-repeat'
- ): void
- /** [CanvasContext.draw(boolean reserve, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.draw.html)
-*
-* 将之前在绘图上下文中的描述(路径、变形、样式)画到 canvas 中。
-*
-* **示例代码**
-*
-*
-* 第二次 draw() reserve 为 true。所以保留了上一次的绘制结果,在上下文设置的 fillStyle 'red' 也变成了默认的 'black'。
-*
-* ```javascript
-const ctx = wx.createCanvasContext('myCanvas')
-
-ctx.setFillStyle('red')
-ctx.fillRect(10, 10, 150, 100)
-ctx.draw()
-ctx.fillRect(50, 50, 150, 100)
-ctx.draw(true)
-```
-* 
-*
-* **示例代码**
-*
-*
-* 第二次 draw() reserve 为 false。所以没有保留了上一次的绘制结果和在上下文设置的 fillStyle 'red'。
-*
-* ```javascript
-const ctx = wx.createCanvasContext('myCanvas')
-
-ctx.setFillStyle('red')
-ctx.fillRect(10, 10, 150, 100)
-ctx.draw()
-ctx.fillRect(50, 50, 150, 100)
-ctx.draw()
-```
-*  */
- draw(
- /** 本次绘制是否接着上一次绘制。即 reserve 参数为 false,则在本次调用绘制之前 native 层会先清空画布再继续绘制;若 reserve 参数为 true,则保留当前画布上的内容,本次调用 drawCanvas 绘制的内容覆盖在上面,默认 false。 */
- reserve?: boolean,
- /** 绘制完成后执行的回调函数 */
- callback?: (...args: any[]) => any
- ): void
- /** [CanvasContext.drawImage(string imageResource, number sx, number sy, number sWidth, number sHeight, number dx, number dy, number dWidth, number dHeight)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.drawImage.html)
-*
-* 绘制图像到画布
-*
-* **示例代码**
-*
-*
-*
-* 有三个版本的写法:
-*
-* - drawImage(imageResource, dx, dy)
-* - drawImage(imageResource, dx, dy, dWidth, dHeight)
-* - drawImage(imageResource, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight) 从 1.9.0 起支持
-*
-* ```javascript
-const ctx = wx.createCanvasContext('myCanvas')
-
-wx.chooseImage({
- success: function(res){
- ctx.drawImage(res.tempFilePaths[0], 0, 0, 150, 100)
- ctx.draw()
- }
-})
-
-```
-*  */
- drawImage(
- /** 所要绘制的图片资源(网络图片要通过 getImageInfo / downloadFile 先下载) */
- imageResource: string,
- /** imageResource的左上角在目标 canvas 上 x 轴的位置 */
- dx: number,
- /** imageResource的左上角在目标 canvas 上 y 轴的位置 */
- dy: number
- ): void
- /** [CanvasContext.drawImage(string imageResource, number sx, number sy, number sWidth, number sHeight, number dx, number dy, number dWidth, number dHeight)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.drawImage.html)
-*
-* 绘制图像到画布
-*
-* **示例代码**
-*
-*
-*
-* 有三个版本的写法:
-*
-* - drawImage(imageResource, dx, dy)
-* - drawImage(imageResource, dx, dy, dWidth, dHeight)
-* - drawImage(imageResource, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight) 从 1.9.0 起支持
-*
-* ```javascript
-const ctx = wx.createCanvasContext('myCanvas')
-
-wx.chooseImage({
- success: function(res){
- ctx.drawImage(res.tempFilePaths[0], 0, 0, 150, 100)
- ctx.draw()
- }
-})
-
-```
-*  */
- drawImage(
- /** 所要绘制的图片资源(网络图片要通过 getImageInfo / downloadFile 先下载) */
- imageResource: string,
- /** imageResource的左上角在目标 canvas 上 x 轴的位置 */
- dx: number,
- /** imageResource的左上角在目标 canvas 上 y 轴的位置 */
- dy: number,
- /** 在目标画布上绘制imageResource的宽度,允许对绘制的imageResource进行缩放 */
- dWidth: number,
- /** 在目标画布上绘制imageResource的高度,允许对绘制的imageResource进行缩放 */
- dHeight: number
- ): void
- /** [CanvasContext.drawImage(string imageResource, number sx, number sy, number sWidth, number sHeight, number dx, number dy, number dWidth, number dHeight)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.drawImage.html)
-*
-* 绘制图像到画布
-*
-* **示例代码**
-*
-*
-*
-* 有三个版本的写法:
-*
-* - drawImage(imageResource, dx, dy)
-* - drawImage(imageResource, dx, dy, dWidth, dHeight)
-* - drawImage(imageResource, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight) 从 1.9.0 起支持
-*
-* ```javascript
-const ctx = wx.createCanvasContext('myCanvas')
-
-wx.chooseImage({
- success: function(res){
- ctx.drawImage(res.tempFilePaths[0], 0, 0, 150, 100)
- ctx.draw()
- }
-})
-
-```
-*  */
- drawImage(
- /** 所要绘制的图片资源(网络图片要通过 getImageInfo / downloadFile 先下载) */
- imageResource: string,
- /** 需要绘制到画布中的,imageResource的矩形(裁剪)选择框的左上角 x 坐标 */
- sx: number,
- /** 需要绘制到画布中的,imageResource的矩形(裁剪)选择框的左上角 y 坐标 */
- sy: number,
- /** 需要绘制到画布中的,imageResource的矩形(裁剪)选择框的宽度 */
- sWidth: number,
- /** 需要绘制到画布中的,imageResource的矩形(裁剪)选择框的高度 */
- sHeight: number,
- /** imageResource的左上角在目标 canvas 上 x 轴的位置 */
- dx: number,
- /** imageResource的左上角在目标 canvas 上 y 轴的位置 */
- dy: number,
- /** 在目标画布上绘制imageResource的宽度,允许对绘制的imageResource进行缩放 */
- dWidth: number,
- /** 在目标画布上绘制imageResource的高度,允许对绘制的imageResource进行缩放 */
- dHeight: number
- ): void
- /** [CanvasContext.fill()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.fill.html)
-*
-* 对当前路径中的内容进行填充。默认的填充色为黑色。
-*
-* **示例代码**
-*
-*
-*
-* 如果当前路径没有闭合,fill() 方法会将起点和终点进行连接,然后填充。
-*
-* ```javascript
-const ctx = wx.createCanvasContext('myCanvas')
-ctx.moveTo(10, 10)
-ctx.lineTo(100, 10)
-ctx.lineTo(100, 100)
-ctx.fill()
-ctx.draw()
-```
-*
-* fill() 填充的的路径是从 beginPath() 开始计算,但是不会将 fillRect() 包含进去。
-*
-* 
-*
-* ```javascript
-const ctx = wx.createCanvasContext('myCanvas')
-// begin path
-ctx.rect(10, 10, 100, 30)
-ctx.setFillStyle('yellow')
-ctx.fill()
-
-// begin another path
-ctx.beginPath()
-ctx.rect(10, 40, 100, 30)
-
-// only fill this rect, not in current path
-ctx.setFillStyle('blue')
-ctx.fillRect(10, 70, 100, 30)
-
-ctx.rect(10, 100, 100, 30)
-
-// it will fill current path
-ctx.setFillStyle('red')
-ctx.fill()
-ctx.draw()
-```
-*
-*  */
- fill(): void
- /** [CanvasContext.fillRect(number x, number y, number width, number height)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.fillRect.html)
-*
-* 填充一个矩形。用 [`setFillStyle`](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setFillStyle.html) 设置矩形的填充色,如果没设置默认是黑色。
-*
-* **示例代码**
-*
-*
-* ```javascript
-const ctx = wx.createCanvasContext('myCanvas')
-ctx.setFillStyle('red')
-ctx.fillRect(10, 10, 150, 75)
-ctx.draw()
-```
-*  */
- fillRect(
- /** 矩形路径左上角的横坐标 */
- x: number,
- /** 矩形路径左上角的纵坐标 */
- y: number,
- /** 矩形路径的宽度 */
- width: number,
- /** 矩形路径的高度 */
- height: number
- ): void
- /** [CanvasContext.fillText(string text, number x, number y, number maxWidth)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.fillText.html)
-*
-* 在画布上绘制被填充的文本
-*
-* **示例代码**
-*
-*
-* ```javascript
-const ctx = wx.createCanvasContext('myCanvas')
-
-ctx.setFontSize(20)
-ctx.fillText('Hello', 20, 20)
-ctx.fillText('MINA', 100, 100)
-
-ctx.draw()
-```
-*  */
- fillText(
- /** 在画布上输出的文本 */
- text: string,
- /** 绘制文本的左上角 x 坐标位置 */
- x: number,
- /** 绘制文本的左上角 y 坐标位置 */
- y: number,
- /** 需要绘制的最大宽度,可选 */
- maxWidth?: number
- ): void
- /** [CanvasContext.lineTo(number x, number y)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.lineTo.html)
-*
-* 增加一个新点,然后创建一条从上次指定点到目标点的线。用 `stroke` 方法来画线条
-*
-* **示例代码**
-*
-*
-* ```javascript
-const ctx = wx.createCanvasContext('myCanvas')
-ctx.moveTo(10, 10)
-ctx.rect(10, 10, 100, 50)
-ctx.lineTo(110, 60)
-ctx.stroke()
-ctx.draw()
-```
-*  */
- lineTo(
- /** 目标位置的 x 坐标 */
- x: number,
- /** 目标位置的 y 坐标 */
- y: number
- ): void
- /** [CanvasContext.moveTo(number x, number y)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.moveTo.html)
-*
-* 把路径移动到画布中的指定点,不创建线条。用 `stroke` 方法来画线条
-*
-* **示例代码**
-*
-*
-* ```javascript
-const ctx = wx.createCanvasContext('myCanvas')
-ctx.moveTo(10, 10)
-ctx.lineTo(100, 10)
-
-ctx.moveTo(10, 50)
-ctx.lineTo(100, 50)
-ctx.stroke()
-ctx.draw()
-```
-*  */
- moveTo(
- /** 目标位置的 x 坐标 */
- x: number,
- /** 目标位置的 y 坐标 */
- y: number
- ): void
- /** [CanvasContext.quadraticCurveTo(number cpx, number cpy, number x, number y)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.quadraticCurveTo.html)
-*
-* 创建二次贝塞尔曲线路径。曲线的起始点为路径中前一个点。
-*
-* **示例代码**
-*
-*
-* ```javascript
-const ctx = wx.createCanvasContext('myCanvas')
-
-// Draw points
-ctx.beginPath()
-ctx.arc(20, 20, 2, 0, 2 * Math.PI)
-ctx.setFillStyle('red')
-ctx.fill()
-
-ctx.beginPath()
-ctx.arc(200, 20, 2, 0, 2 * Math.PI)
-ctx.setFillStyle('lightgreen')
-ctx.fill()
-
-ctx.beginPath()
-ctx.arc(20, 100, 2, 0, 2 * Math.PI)
-ctx.setFillStyle('blue')
-ctx.fill()
-
-ctx.setFillStyle('black')
-ctx.setFontSize(12)
-
-// Draw guides
-ctx.beginPath()
-ctx.moveTo(20, 20)
-ctx.lineTo(20, 100)
-ctx.lineTo(200, 20)
-ctx.setStrokeStyle('#AAAAAA')
-ctx.stroke()
-
-// Draw quadratic curve
-ctx.beginPath()
-ctx.moveTo(20, 20)
-ctx.quadraticCurveTo(20, 100, 200, 20)
-ctx.setStrokeStyle('black')
-ctx.stroke()
-
-ctx.draw()
-```
-*
-* 
-*
-* 针对 moveTo(20, 20) quadraticCurveTo(20, 100, 200, 20) 的三个关键坐标如下:
-*
-* - 红色:起始点(20, 20)
-* - 蓝色:控制点(20, 100)
-* - 绿色:终止点(200, 20) */
- quadraticCurveTo(
- /** 贝塞尔控制点的 x 坐标 */
- cpx: number,
- /** 贝塞尔控制点的 y 坐标 */
- cpy: number,
- /** 结束点的 x 坐标 */
- x: number,
- /** 结束点的 y 坐标 */
- y: number
- ): void
- /** [CanvasContext.rect(number x, number y, number width, number height)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.rect.html)
-*
-* 创建一个矩形路径。需要用 [`fill`](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.fill.html) 或者 [`stroke`](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.stroke.html) 方法将矩形真正的画到 `canvas` 中
-*
-* **示例代码**
-*
-*
-* ```javascript
-const ctx = wx.createCanvasContext('myCanvas')
-ctx.rect(10, 10, 150, 75)
-ctx.setFillStyle('red')
-ctx.fill()
-ctx.draw()
-```
-*  */
- rect(
- /** 矩形路径左上角的横坐标 */
- x: number,
- /** 矩形路径左上角的纵坐标 */
- y: number,
- /** 矩形路径的宽度 */
- width: number,
- /** 矩形路径的高度 */
- height: number
- ): void
- /** [CanvasContext.restore()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.restore.html)
-*
-* 恢复之前保存的绘图上下文。
-*
-* **示例代码**
-*
-*
-* ```javascript
-const ctx = wx.createCanvasContext('myCanvas')
-
-// save the default fill style
-ctx.save()
-ctx.setFillStyle('red')
-ctx.fillRect(10, 10, 150, 100)
-
-// restore to the previous saved state
-ctx.restore()
-ctx.fillRect(50, 50, 150, 100)
-
-ctx.draw()
-```
-*  */
- restore(): void
- /** [CanvasContext.rotate(number rotate)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.rotate.html)
-*
-* 以原点为中心顺时针旋转当前坐标轴。多次调用旋转的角度会叠加。原点可以用 `translate` 方法修改。
-*
-* **示例代码**
-*
-*
-* ```javascript
-const ctx = wx.createCanvasContext('myCanvas')
-
-ctx.strokeRect(100, 10, 150, 100)
-ctx.rotate(20 * Math.PI / 180)
-ctx.strokeRect(100, 10, 150, 100)
-ctx.rotate(20 * Math.PI / 180)
-ctx.strokeRect(100, 10, 150, 100)
-
-ctx.draw()
-```
-*  */
- rotate(
- /** 旋转角度,以弧度计 degrees * Math.PI/180;degrees 范围为 0-360 */
- rotate: number
- ): void
- /** [CanvasContext.save()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.save.html)
-*
-* 保存绘图上下文。
-*
-* **示例代码**
-*
-*
-* ```javascript
-const ctx = wx.createCanvasContext('myCanvas')
-
-// save the default fill style
-ctx.save()
-ctx.setFillStyle('red')
-ctx.fillRect(10, 10, 150, 100)
-
-// restore to the previous saved state
-ctx.restore()
-ctx.fillRect(50, 50, 150, 100)
-
-ctx.draw()
-```
-*  */
- save(): void
- /** [CanvasContext.scale(number scaleWidth, number scaleHeight)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.scale.html)
-*
-* 在调用后,之后创建的路径其横纵坐标会被缩放。多次调用倍数会相乘。
-*
-* **示例代码**
-*
-*
-* ```javascript
-const ctx = wx.createCanvasContext('myCanvas')
-
-ctx.strokeRect(10, 10, 25, 15)
-ctx.scale(2, 2)
-ctx.strokeRect(10, 10, 25, 15)
-ctx.scale(2, 2)
-ctx.strokeRect(10, 10, 25, 15)
-
-ctx.draw()
-```
-*  */
- scale(
- /** 横坐标缩放的倍数 (1 = 100%,0.5 = 50%,2 = 200%) */
- scaleWidth: number,
- /** 纵坐标轴缩放的倍数 (1 = 100%,0.5 = 50%,2 = 200%) */
- scaleHeight: number
- ): void
- /** [CanvasContext.setFillStyle(string|[CanvasGradient](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasGradient.html) color)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setFillStyle.html)
-*
-* 设置填充色。
-*
-* **代码示例**
-*
-*
-* ```js
-const ctx = wx.createCanvasContext('myCanvas')
-ctx.setFillStyle('red')
-ctx.fillRect(10, 10, 150, 75)
-ctx.draw()
-```
-* 
-* @deprecated 基础库版本 [1.9.90](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [CanvasContext.fillStyle](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html) 替换
-* */
- setFillStyle(
- /** 填充的颜色,默认颜色为 black。 */
- color: string | CanvasGradient
- ): void
- /** [CanvasContext.setFontSize(number fontSize)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setFontSize.html)
-*
-* 设置字体的字号
-*
-* **示例代码**
-*
-*
-* ```javascript
-const ctx = wx.createCanvasContext('myCanvas')
-
-ctx.setFontSize(20)
-ctx.fillText('20', 20, 20)
-ctx.setFontSize(30)
-ctx.fillText('30', 40, 40)
-ctx.setFontSize(40)
-ctx.fillText('40', 60, 60)
-ctx.setFontSize(50)
-ctx.fillText('50', 90, 90)
-
-ctx.draw()
-```
-* 
-* @deprecated 基础库版本 [1.9.90](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [CanvasContext.font](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html) 替换
-* */
- setFontSize(
- /** 字体的字号 */
- fontSize: number
- ): void
- /** [CanvasContext.setGlobalAlpha(number alpha)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setGlobalAlpha.html)
-*
-* 设置全局画笔透明度。
-*
-* **示例代码**
-*
-*
-* ```javascript
-const ctx = wx.createCanvasContext('myCanvas')
-
-ctx.setFillStyle('red')
-ctx.fillRect(10, 10, 150, 100)
-ctx.setGlobalAlpha(0.2)
-ctx.setFillStyle('blue')
-ctx.fillRect(50, 50, 150, 100)
-ctx.setFillStyle('yellow')
-ctx.fillRect(100, 100, 150, 100)
-
-ctx.draw()
-```
-* 
-* @deprecated 基础库版本 [1.9.90](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [CanvasContext.globalAlpha](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html) 替换
-* */
- setGlobalAlpha(
- /** 透明度。范围 0-1,0 表示完全透明,1 表示完全不透明。 */
- alpha: number
- ): void
- /** [CanvasContext.setLineCap(string lineCap)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineCap.html)
-*
-* 设置线条的端点样式
-*
-* **示例代码**
-*
-*
-* ```javascript
-const ctx = wx.createCanvasContext('myCanvas')
-ctx.beginPath()
-ctx.moveTo(10, 10)
-ctx.lineTo(150, 10)
-ctx.stroke()
-
-ctx.beginPath()
-ctx.setLineCap('butt')
-ctx.setLineWidth(10)
-ctx.moveTo(10, 30)
-ctx.lineTo(150, 30)
-ctx.stroke()
-
-ctx.beginPath()
-ctx.setLineCap('round')
-ctx.setLineWidth(10)
-ctx.moveTo(10, 50)
-ctx.lineTo(150, 50)
-ctx.stroke()
-
-ctx.beginPath()
-ctx.setLineCap('square')
-ctx.setLineWidth(10)
-ctx.moveTo(10, 70)
-ctx.lineTo(150, 70)
-ctx.stroke()
-
-ctx.draw()
-```
-* 
-* @deprecated 基础库版本 [1.9.90](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [CanvasContext.lineCap](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html) 替换
-* */
- setLineCap(
- /** 线条的结束端点样式
- *
- * 参数 lineCap 可选值:
- * - 'butt': 向线条的每个末端添加平直的边缘。;
- * - 'round': 向线条的每个末端添加圆形线帽。;
- * - 'square': 向线条的每个末端添加正方形线帽。; */
- lineCap: 'butt' | 'round' | 'square'
- ): void
- /** [CanvasContext.setLineDash(Array.<number> pattern, number offset)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineDash.html)
-*
-* 设置虚线样式。
-*
-* **示例代码**
-*
-*
-* ```javascript
-const ctx = wx.createCanvasContext('myCanvas')
-
-ctx.setLineDash([10, 20], 5);
-
-ctx.beginPath();
-ctx.moveTo(0,100);
-ctx.lineTo(400, 100);
-ctx.stroke();
-
-ctx.draw()
-```
-* 
-*
-* 最低基础库: `1.6.0`
-* @deprecated 基础库版本 [1.9.90](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [CanvasContext.lineDashOffset](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html) 替换
-* */
- setLineDash(
- /** 一组描述交替绘制线段和间距(坐标空间单位)长度的数字 */
- pattern: number[],
- /** 虚线偏移量 */
- offset: number
- ): void
- /** [CanvasContext.setLineJoin(string lineJoin)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineJoin.html)
-*
-* 设置线条的交点样式
-*
-* **示例代码**
-*
-*
-* ```javascript
-const ctx = wx.createCanvasContext('myCanvas')
-ctx.beginPath()
-ctx.moveTo(10, 10)
-ctx.lineTo(100, 50)
-ctx.lineTo(10, 90)
-ctx.stroke()
-
-ctx.beginPath()
-ctx.setLineJoin('bevel')
-ctx.setLineWidth(10)
-ctx.moveTo(50, 10)
-ctx.lineTo(140, 50)
-ctx.lineTo(50, 90)
-ctx.stroke()
-
-ctx.beginPath()
-ctx.setLineJoin('round')
-ctx.setLineWidth(10)
-ctx.moveTo(90, 10)
-ctx.lineTo(180, 50)
-ctx.lineTo(90, 90)
-ctx.stroke()
-
-ctx.beginPath()
-ctx.setLineJoin('miter')
-ctx.setLineWidth(10)
-ctx.moveTo(130, 10)
-ctx.lineTo(220, 50)
-ctx.lineTo(130, 90)
-ctx.stroke()
-
-ctx.draw()
-```
-* 
-* @deprecated 基础库版本 [1.9.90](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [CanvasContext.lineJoin](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html) 替换
-* */
- setLineJoin(
- /** 线条的结束交点样式
- *
- * 参数 lineJoin 可选值:
- * - 'bevel': 斜角;
- * - 'round': 圆角;
- * - 'miter': 尖角; */
- lineJoin: 'bevel' | 'round' | 'miter'
- ): void
- /** [CanvasContext.setLineWidth(number lineWidth)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineWidth.html)
-*
-* 设置线条的宽度
-*
-* **示例代码**
-*
-*
-* ```javascript
-const ctx = wx.createCanvasContext('myCanvas')
-ctx.beginPath()
-ctx.moveTo(10, 10)
-ctx.lineTo(150, 10)
-ctx.stroke()
-
-ctx.beginPath()
-ctx.setLineWidth(5)
-ctx.moveTo(10, 30)
-ctx.lineTo(150, 30)
-ctx.stroke()
-
-ctx.beginPath()
-ctx.setLineWidth(10)
-ctx.moveTo(10, 50)
-ctx.lineTo(150, 50)
-ctx.stroke()
-
-ctx.beginPath()
-ctx.setLineWidth(15)
-ctx.moveTo(10, 70)
-ctx.lineTo(150, 70)
-ctx.stroke()
-
-ctx.draw()
-```
-*
-* 
-* @deprecated 基础库版本 [1.9.90](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [CanvasContext.lineWidth](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html) 替换
-* */
- setLineWidth(
- /** 线条的宽度,单位px */
- lineWidth: number
- ): void
- /** [CanvasContext.setMiterLimit(number miterLimit)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setMiterLimit.html)
-*
-* 设置最大斜接长度。斜接长度指的是在两条线交汇处内角和外角之间的距离。当 [CanvasContext.setLineJoin()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineJoin.html) 为 miter 时才有效。超过最大倾斜长度的,连接处将以 lineJoin 为 bevel 来显示。
-*
-* **示例代码**
-*
-*
-* ```javascript
-const ctx = wx.createCanvasContext('myCanvas')
-ctx.beginPath()
-ctx.setLineWidth(10)
-ctx.setLineJoin('miter')
-ctx.setMiterLimit(1)
-ctx.moveTo(10, 10)
-ctx.lineTo(100, 50)
-ctx.lineTo(10, 90)
-ctx.stroke()
-
-ctx.beginPath()
-ctx.setLineWidth(10)
-ctx.setLineJoin('miter')
-ctx.setMiterLimit(2)
-ctx.moveTo(50, 10)
-ctx.lineTo(140, 50)
-ctx.lineTo(50, 90)
-ctx.stroke()
-
-ctx.beginPath()
-ctx.setLineWidth(10)
-ctx.setLineJoin('miter')
-ctx.setMiterLimit(3)
-ctx.moveTo(90, 10)
-ctx.lineTo(180, 50)
-ctx.lineTo(90, 90)
-ctx.stroke()
-
-ctx.beginPath()
-ctx.setLineWidth(10)
-ctx.setLineJoin('miter')
-ctx.setMiterLimit(4)
-ctx.moveTo(130, 10)
-ctx.lineTo(220, 50)
-ctx.lineTo(130, 90)
-ctx.stroke()
-
-ctx.draw()
-```
-* 
-* @deprecated 基础库版本 [1.9.90](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [CanvasContext.miterLimit](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html) 替换
-* */
- setMiterLimit(
- /** 最大斜接长度 */
- miterLimit: number
- ): void
- /** [CanvasContext.setShadow(number offsetX, number offsetY, number blur, string color)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setShadow.html)
-*
-* 设定阴影样式。
-*
-* **示例代码**
-*
-*
-* ```javascript
-const ctx = wx.createCanvasContext('myCanvas')
-ctx.setFillStyle('red')
-ctx.setShadow(10, 50, 50, 'blue')
-ctx.fillRect(10, 10, 150, 75)
-ctx.draw()
-```
-* 
-* @deprecated 基础库版本 [1.9.90](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [CanvasContext.shadowOffsetX|CanvasContext.shadowOffsetY|CanvasContext.shadowColor|CanvasContext.shadowBlur](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html) 替换
-* */
- setShadow(
- /** 阴影相对于形状在水平方向的偏移,默认值为 0。 */
- offsetX: number,
- /** 阴影相对于形状在竖直方向的偏移,默认值为 0。 */
- offsetY: number,
- /** 阴影的模糊级别,数值越大越模糊。范围 0- 100。,默认值为 0。 */
- blur: number,
- /** 阴影的颜色。默认值为 black。 */
- color: string
- ): void
- /** [CanvasContext.setStrokeStyle(string|[CanvasGradient](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasGradient.html) color)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setStrokeStyle.html)
-*
-* 设置描边颜色。
-*
-* **代码示例**
-*
-*
-* ```js
-const ctx = wx.createCanvasContext('myCanvas')
-ctx.setStrokeStyle('red')
-ctx.strokeRect(10, 10, 150, 75)
-ctx.draw()
-```
-* 
-* @deprecated 基础库版本 [1.9.90](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [CanvasContext.strokeStyle](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html) 替换
-* */
- setStrokeStyle(
- /** 描边的颜色,默认颜色为 black。 */
- color: string | CanvasGradient
- ): void
- /** [CanvasContext.setTextAlign(string align)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setTextAlign.html)
-*
-* 设置文字的对齐
-*
-* **示例代码**
-*
-*
-*
-* ```javascript
-const ctx = wx.createCanvasContext('myCanvas')
-
-ctx.setStrokeStyle('red')
-ctx.moveTo(150, 20)
-ctx.lineTo(150, 170)
-ctx.stroke()
-
-ctx.setFontSize(15)
-ctx.setTextAlign('left')
-ctx.fillText('textAlign=left', 150, 60)
-
-ctx.setTextAlign('center')
-ctx.fillText('textAlign=center', 150, 80)
-
-ctx.setTextAlign('right')
-ctx.fillText('textAlign=right', 150, 100)
-
-ctx.draw()
-```
-*
-* 
-*
-* 最低基础库: `1.1.0` */
- setTextAlign(
- /** 文字的对齐方式
- *
- * 参数 align 可选值:
- * - 'left': 左对齐;
- * - 'center': 居中对齐;
- * - 'right': 右对齐; */
- align: 'left' | 'center' | 'right'
- ): void
- /** [CanvasContext.setTextBaseline(string textBaseline)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setTextBaseline.html)
-*
-* 设置文字的竖直对齐
-*
-* **示例代码**
-*
-*
-* ```javascript
-const ctx = wx.createCanvasContext('myCanvas')
-
-ctx.setStrokeStyle('red')
-ctx.moveTo(5, 75)
-ctx.lineTo(295, 75)
-ctx.stroke()
-
-ctx.setFontSize(20)
-
-ctx.setTextBaseline('top')
-ctx.fillText('top', 5, 75)
-
-ctx.setTextBaseline('middle')
-ctx.fillText('middle', 50, 75)
-
-ctx.setTextBaseline('bottom')
-ctx.fillText('bottom', 120, 75)
-
-ctx.setTextBaseline('normal')
-ctx.fillText('normal', 200, 75)
-
-ctx.draw()
-```
-* 
-*
-* 最低基础库: `1.4.0` */
- setTextBaseline(
- /** 文字的竖直对齐方式
- *
- * 参数 textBaseline 可选值:
- * - 'top': 顶部对齐;
- * - 'bottom': 底部对齐;
- * - 'middle': 居中对齐;
- * - 'normal': ; */
- textBaseline: 'top' | 'bottom' | 'middle' | 'normal'
- ): void
- /** [CanvasContext.setTransform(number scaleX, number skewX, number skewY, number scaleY, number translateX, number translateY)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setTransform.html)
- *
- * 使用矩阵重新设置(覆盖)当前变换的方法
- *
- * 最低基础库: `1.9.90` */
- setTransform(
- /** 水平缩放 */
- scaleX: number,
- /** 水平倾斜 */
- skewX: number,
- /** 垂直倾斜 */
- skewY: number,
- /** 垂直缩放 */
- scaleY: number,
- /** 水平移动 */
- translateX: number,
- /** 垂直移动 */
- translateY: number
- ): void
- /** [CanvasContext.stroke()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.stroke.html)
-*
-* 画出当前路径的边框。默认颜色色为黑色。
-*
-* **示例代码**
-*
-*
-* ```javascript
-const ctx = wx.createCanvasContext('myCanvas')
-ctx.moveTo(10, 10)
-ctx.lineTo(100, 10)
-ctx.lineTo(100, 100)
-ctx.stroke()
-ctx.draw()
-```
-* 
-*
-* stroke() 描绘的的路径是从 beginPath() 开始计算,但是不会将 strokeRect() 包含进去。
-*
-* ```javascript
-const ctx = wx.createCanvasContext('myCanvas')
-// begin path
-ctx.rect(10, 10, 100, 30)
-ctx.setStrokeStyle('yellow')
-ctx.stroke()
-
-// begin another path
-ctx.beginPath()
-ctx.rect(10, 40, 100, 30)
-
-// only stoke this rect, not in current path
-ctx.setStrokeStyle('blue')
-ctx.strokeRect(10, 70, 100, 30)
-
-ctx.rect(10, 100, 100, 30)
-
-// it will stroke current path
-ctx.setStrokeStyle('red')
-ctx.stroke()
-ctx.draw()
-```
-*
-*  */
- stroke(): void
- /** [CanvasContext.strokeRect(number x, number y, number width, number height)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.strokeRect.html)
-*
-* 画一个矩形(非填充)。 用 [`setStrokeStyle`](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setStrokeStyle.html) 设置矩形线条的颜色,如果没设置默认是黑色。
-*
-* **示例代码**
-*
-*
-* ```javascript
-const ctx = wx.createCanvasContext('myCanvas')
-ctx.setStrokeStyle('red')
-ctx.strokeRect(10, 10, 150, 75)
-ctx.draw()
-```
-*  */
- strokeRect(
- /** 矩形路径左上角的横坐标 */
- x: number,
- /** 矩形路径左上角的纵坐标 */
- y: number,
- /** 矩形路径的宽度 */
- width: number,
- /** 矩形路径的高度 */
- height: number
- ): void
- /** [CanvasContext.strokeText(string text, number x, number y, number maxWidth)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.strokeText.html)
- *
- * 给定的 (x, y) 位置绘制文本描边的方法
- *
- * 最低基础库: `1.9.90` */
- strokeText(
- /** 要绘制的文本 */
- text: string,
- /** 文本起始点的 x 轴坐标 */
- x: number,
- /** 文本起始点的 y 轴坐标 */
- y: number,
- /** 需要绘制的最大宽度,可选 */
- maxWidth?: number
- ): void
- /** [CanvasContext.transform(number scaleX, number skewX, number skewY, number scaleY, number translateX, number translateY)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.transform.html)
- *
- * 使用矩阵多次叠加当前变换的方法
- *
- * 最低基础库: `1.9.90` */
- transform(
- /** 水平缩放 */
- scaleX: number,
- /** 水平倾斜 */
- skewX: number,
- /** 垂直倾斜 */
- skewY: number,
- /** 垂直缩放 */
- scaleY: number,
- /** 水平移动 */
- translateX: number,
- /** 垂直移动 */
- translateY: number
- ): void
- /** [CanvasContext.translate(number x, number y)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.translate.html)
-*
-* 对当前坐标系的原点 (0, 0) 进行变换。默认的坐标系原点为页面左上角。
-*
-* **示例代码**
-*
-*
-*
-* ```javascript
-const ctx = wx.createCanvasContext('myCanvas')
-
-ctx.strokeRect(10, 10, 150, 100)
-ctx.translate(20, 20)
-ctx.strokeRect(10, 10, 150, 100)
-ctx.translate(20, 20)
-ctx.strokeRect(10, 10, 150, 100)
-
-ctx.draw()
-```
-*
-*  */
- translate(
- /** 水平坐标平移量 */
- x: number,
- /** 竖直坐标平移量 */
- y: number
- ): void
- /** [Object CanvasContext.measureText(string text)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.measureText.html)
- *
- * 测量文本尺寸信息。目前仅返回文本宽度。同步接口。
- *
- * 最低基础库: `1.9.90` */
- measureText(
- /** 要测量的文本 */
- text: string
- ): TextMetrics
- /** [[CanvasGradient](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasGradient.html) CanvasContext.createCircularGradient(number x, number y, number r)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.createCircularGradient.html)
-*
-* 创建一个圆形的渐变颜色。起点在圆心,终点在圆环。返回的`CanvasGradient`对象需要使用 [CanvasGradient.addColorStop()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasGradient.addColorStop.html) 来指定渐变点,至少要两个。
-*
-* **示例代码**
-*
-*
-* ```javascript
-const ctx = wx.createCanvasContext('myCanvas')
-
-// Create circular gradient
-const grd = ctx.createCircularGradient(75, 50, 50)
-grd.addColorStop(0, 'red')
-grd.addColorStop(1, 'white')
-
-// Fill with gradient
-ctx.setFillStyle(grd)
-ctx.fillRect(10, 10, 150, 80)
-ctx.draw()
-```
-*  */
- createCircularGradient(
- /** 圆心的 x 坐标 */
- x: number,
- /** 圆心的 y 坐标 */
- y: number,
- /** 圆的半径 */
- r: number
- ): CanvasGradient
- /** [[CanvasGradient](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasGradient.html) CanvasContext.createLinearGradient(number x0, number y0, number x1, number y1)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.createLinearGradient.html)
-*
-* 创建一个线性的渐变颜色。返回的`CanvasGradient`对象需要使用 [CanvasGradient.addColorStop()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasGradient.addColorStop.html) 来指定渐变点,至少要两个。
-*
-* **示例代码**
-*
-*
-* ```javascript
-const ctx = wx.createCanvasContext('myCanvas')
-
-// Create linear gradient
-const grd = ctx.createLinearGradient(0, 0, 200, 0)
-grd.addColorStop(0, 'red')
-grd.addColorStop(1, 'white')
-
-// Fill with gradient
-ctx.setFillStyle(grd)
-ctx.fillRect(10, 10, 150, 80)
-ctx.draw()
-```
-*  */
- createLinearGradient(
- /** 起点的 x 坐标 */
- x0: number,
- /** 起点的 y 坐标 */
- y0: number,
- /** 终点的 x 坐标 */
- x1: number,
- /** 终点的 y 坐标 */
- y1: number
- ): CanvasGradient
- }
interface CanvasGradient {
/** [CanvasGradient.addColorStop(number stop, string color)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasGradient.addColorStop.html)
*
+* 在插件中使用:不支持
+* @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
+*
+* @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
+*
* 添加颜色的渐变点。小于最小 stop 的部分会按最小 stop 的 color 来渲染,大于最大 stop 的部分会按最大 stop 的 color 来渲染
*
* **示例代码**
*
-*
* ```js
const ctx = wx.createCanvasContext('myCanvas')
@@ -8640,8 +15821,42 @@ ctx.draw()
color: string
): void
}
+ interface CommonPaymentError {
+ /** 错误信息
+ *
+ * | 错误码 | 错误信息 | 说明 |
+ * | - | - | - |
+ * | 1000 | | 系统错误 |
+ * | 1022 | | 参数json格式非法 |
+ * | 702001 | | 参数错误,具体原因见errMsg |
+ * | 702002 | | 用户态签名错误 |
+ * | 702003 | | 支付签名错误 |
+ * | 702004 | | mode不合法 |
+ * | 702005 | | out_trade_no重复,请更换新单号重试 |
+ * | 702006 | | 二级商户进件未完成 |
+ * | 702007 | | 用户未授权给品牌 |
+ * | 702008 | | 正式版小程序只能用生产环境下单 |
+ * | 702009 | | B2b授权关系校验不通过 | */ errMsg: string
+ /** 错误码
+ *
+ * | 错误码 | 错误信息 | 说明 |
+ * | - | - | - |
+ * | 1000 | | 系统错误 |
+ * | 1022 | | 参数json格式非法 |
+ * | 702001 | | 参数错误,具体原因见errMsg |
+ * | 702002 | | 用户态签名错误 |
+ * | 702003 | | 支付签名错误 |
+ * | 702004 | | mode不合法 |
+ * | 702005 | | out_trade_no重复,请更换新单号重试 |
+ * | 702006 | | 二级商户进件未完成 |
+ * | 702007 | | 用户未授权给品牌 |
+ * | 702008 | | 正式版小程序只能用生产环境下单 |
+ * | 702009 | | B2b授权关系校验不通过 | */ errCode: number
+ }
interface Console {
/** [console.debug()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.debug.html)
+ *
+ * 在插件中使用:不支持
*
* 向调试面板中打印 debug 日志 */
debug(
@@ -8649,6 +15864,8 @@ ctx.draw()
...args: any[]
): void
/** [console.error()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.error.html)
+ *
+ * 在插件中使用:不支持
*
* 向调试面板中打印 error 日志 */
error(
@@ -8656,27 +15873,31 @@ ctx.draw()
...args: any[]
): void
/** [console.group(string label)](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.group.html)
+ *
+ * 在插件中使用:不支持
*
* 在调试面板中创建一个新的分组。随后输出的内容都会被添加一个缩进,表示该内容属于当前分组。调用 [console.groupEnd](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.groupEnd.html)之后分组结束。
*
* **注意**
*
- *
* 仅在工具中有效,在 vConsole 中为空函数实现。 */
group(
/** 分组标记,可选。 */
label?: string
): void
/** [console.groupEnd()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.groupEnd.html)
+ *
+ * 在插件中使用:不支持
*
* 结束由 [console.group](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.group.html) 创建的分组
*
* **注意**
*
- *
* 仅在工具中有效,在 vConsole 中为空函数实现。 */
groupEnd(): void
/** [console.info()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.info.html)
+ *
+ * 在插件中使用:不支持
*
* 向调试面板中打印 info 日志 */
info(
@@ -8684,6 +15905,8 @@ ctx.draw()
...args: any[]
): void
/** [console.log()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.log.html)
+ *
+ * 在插件中使用:不支持
*
* 向调试面板中打印 log 日志 */
log(
@@ -8691,6 +15914,8 @@ ctx.draw()
...args: any[]
): void
/** [console.warn()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.warn.html)
+ *
+ * 在插件中使用:不支持
*
* 向调试面板中打印 warn 日志 */
warn(
@@ -8701,61 +15926,135 @@ ctx.draw()
interface DownloadTask {
/** [DownloadTask.abort()](https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.abort.html)
*
- * 中断下载任务
+ * 需要基础库: `1.4.0`
*
- * 最低基础库: `1.4.0` */
+ * 在插件中使用:支持
+ *
+ * 中断下载任务 */
abort(): void
- /** [DownloadTask.offHeadersReceived(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.offHeadersReceived.html)
- *
- * 取消监听 HTTP Response Header 事件
- *
- * 最低基础库: `2.1.0` */
+ /** [DownloadTask.offHeadersReceived(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.offHeadersReceived.html)
+*
+* 需要基础库: `2.1.0`
+*
+* 在插件中使用:支持
+*
+* 移除 HTTP Response Header 事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+DownloadTask.onHeadersReceived(listener)
+DownloadTask.offHeadersReceived(listener) // 需传入与监听时同一个的函数对象
+``` */
offHeadersReceived(
- /** HTTP Response Header 事件的回调函数 */
- callback?: OffHeadersReceivedCallback
+ /** onHeadersReceived 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: DownloadTaskOffHeadersReceivedCallback
): void
- /** [DownloadTask.offProgressUpdate(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.offProgressUpdate.html)
- *
- * 取消监听下载进度变化事件
- *
- * 最低基础库: `2.1.0` */
+ /** [DownloadTask.offProgressUpdate(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.offProgressUpdate.html)
+*
+* 需要基础库: `2.1.0`
+*
+* 在插件中使用:支持
+*
+* 移除下载进度变化事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+DownloadTask.onProgressUpdate(listener)
+DownloadTask.offProgressUpdate(listener) // 需传入与监听时同一个的函数对象
+``` */
offProgressUpdate(
- /** 下载进度变化事件的回调函数 */
- callback?: DownloadTaskOffProgressUpdateCallback
+ /** onProgressUpdate 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: DownloadTaskOffProgressUpdateCallback
): void
- /** [DownloadTask.onHeadersReceived(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.onHeadersReceived.html)
+ /** [DownloadTask.onHeadersReceived(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.onHeadersReceived.html)
*
- * 监听 HTTP Response Header 事件。会比请求完成事件更早
+ * 需要基础库: `2.1.0`
*
- * 最低基础库: `2.1.0` */
+ * 在插件中使用:支持
+ *
+ * 监听 HTTP Response Header 事件。会比请求完成事件更早 */
onHeadersReceived(
- /** HTTP Response Header 事件的回调函数 */
- callback: OnHeadersReceivedCallback
+ /** HTTP Response Header 事件的监听函数 */
+ listener: DownloadTaskOnHeadersReceivedCallback
): void
- /** [DownloadTask.onProgressUpdate(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.onProgressUpdate.html)
+ /** [DownloadTask.onProgressUpdate(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.onProgressUpdate.html)
*
- * 监听下载进度变化事件
+ * 需要基础库: `1.4.0`
*
- * 最低基础库: `1.4.0` */
+ * 在插件中使用:支持
+ *
+ * 监听下载进度变化事件 */
onProgressUpdate(
- /** 下载进度变化事件的回调函数 */
- callback: DownloadTaskOnProgressUpdateCallback
+ /** 下载进度变化事件的监听函数 */
+ listener: DownloadTaskOnProgressUpdateCallback
): void
}
+ interface DraggableSheetContext {
+ /** [DraggableSheetContext.scrollTo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/skyline/DraggableSheetContext.scrollTo.html)
+*
+* 需要基础库: `3.2.0`
+*
+* 在插件中使用:支持
+*
+* 滚动到指定位置。`size` 取值 `[0, 1]`,`size = 1` 时表示撑满 `draggable-sheet` 组件。`size` 和 `pixels` 同时传入时,仅 size 生效。
+*
+* **示例代码**
+*
+* ```javascript
+Page({
+ onReady() {
+ this.createSelectorQuery()
+ .select(".sheet")
+ .node()
+ .exec(res => {
+ const sheetContext = res[0].node
+ sheetContext.scrollTo({
+ size: 0.7,
+ animated: true,
+ duration: 300,
+ easingFunction: 'ease'
+ })
+ },
+})
+``` */
+ scrollTo(option: DraggableSheetContextScrollToOption): void
+ }
interface EditorContext {
/** [EditorContext.blur(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.blur.html)
*
- * 编辑器失焦,同时收起键盘。
+ * 需要基础库: `2.8.3`
*
- * 最低基础库: `2.8.3` */
+ * 在插件中使用:支持
+ *
+ * 编辑器失焦,同时收起键盘。 */
blur(option?: BlurOption): void
/** [EditorContext.clear(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.clear.html)
*
- * 清空编辑器内容
+ * 需要基础库: `2.7.0`
*
- * 最低基础库: `2.7.0` */
+ * 在插件中使用:支持
+ *
+ * 清空编辑器内容 */
clear(option?: ClearOption): void
+ /** [EditorContext.deleteText(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.deleteText.html)
+ *
+ * 需要基础库: `3.7.11`
+ *
+ * 在插件中使用:支持
+ *
+ * 删除指定选取区的内容 */
+ deleteText(option: DeleteTextOption): void
/** [EditorContext.format(string name, string value)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.format.html)
+ *
+ * 需要基础库: `2.7.0`
+ *
+ * 在插件中使用:支持
*
* 修改样式
*
@@ -8788,35 +16087,75 @@ ctx.draw()
* | wordBreak | css style | 2.10.2 |
* | whiteSpace | css style | 2.10.2 |
*
- * 对已经应用样式的选区设置会取消样式。css style 表示 css 中规定的允许值。
- *
- * 最低基础库: `2.7.0` */
+ * 对已经应用样式的选区设置会取消样式。css style 表示 css 中规定的允许值。 */
format(
/** 属性 */
name: string,
/** 值 */
value?: string
): void
+ /** [EditorContext.getBounds(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.getBounds.html)
+ *
+ * 需要基础库: `3.7.11`
+ *
+ * 在插件中使用:支持
+ *
+ * 获取指定选区的位置和大小 */
+ getBounds(option: GetBoundsOption): void
/** [EditorContext.getContents(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.getContents.html)
*
- * 获取编辑器内容
+ * 需要基础库: `2.7.0`
*
- * 最低基础库: `2.7.0` */
+ * 在插件中使用:支持
+ *
+ * 获取编辑器内容 */
getContents(option?: GetContentsOption): void
+ /** [EditorContext.getHistoryState(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.getHistoryState.html)
+ *
+ * 需要基础库: `3.9.3`
+ *
+ * 在插件中使用:支持
+ *
+ * 获取历史操作状态 */
+ getHistoryState(option?: GetHistoryStateOption): void
+ /** [EditorContext.getSelection(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.getSelection.html)
+ *
+ * 需要基础库: `3.7.11`
+ *
+ * 在插件中使用:支持
+ *
+ * 获取当前选区 */
+ getSelection(option?: GetSelectionOption): void
/** [EditorContext.getSelectionText(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.getSelectionText.html)
*
- * 获取编辑器已选区域内的纯文本内容。当编辑器失焦或未选中一段区间时,返回内容为空。
+ * 需要基础库: `2.10.2`
*
- * 最低基础库: `2.10.2` */
+ * 在插件中使用:支持
+ *
+ * 获取编辑器已选区域内的纯文本内容。当编辑器失焦或未选中一段区间时,返回内容为空。 */
getSelectionText(option?: GetSelectionTextOption): void
+ /** [EditorContext.insertCustomBlock(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.insertCustomBlock.html)
+ *
+ * 需要基础库: `3.7.11`
+ *
+ * 在插件中使用:支持
+ *
+ * 插入自定义区块 */
+ insertCustomBlock(option: InsertCustomBlockOption): void
/** [EditorContext.insertDivider(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.insertDivider.html)
*
- * 插入分割线
+ * 需要基础库: `2.7.0`
*
- * 最低基础库: `2.7.0` */
+ * 在插件中使用:支持
+ *
+ * 插入分割线 */
insertDivider(option?: InsertDividerOption): void
/** [EditorContext.insertImage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.insertImage.html)
*
+* 需要基础库: `2.7.0`
+*
+* 在插件中使用:支持
+*
* 插入图片。
*
* 地址为临时文件时,获取的编辑器html格式内容中 标签增加属性 data-local,delta 格式内容中图片 attributes 属性增加 data-local 字段,该值为传入的临时文件地址。
@@ -8825,7 +16164,6 @@ ctx.draw()
*
* **示例代码**
*
-*
* ```javascript
this.editorCtx.insertImage({
src: 'xx',
@@ -8833,73 +16171,136 @@ this.editorCtx.insertImage({
height: '50px',
extClass: className
})
-```
-*
-* 最低基础库: `2.7.0` */
+``` */
insertImage(option: InsertImageOption): void
/** [EditorContext.insertText(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.insertText.html)
*
- * 覆盖当前选区,设置一段文本
+ * 需要基础库: `2.7.0`
*
- * 最低基础库: `2.7.0` */
+ * 在插件中使用:支持
+ *
+ * 覆盖当前选区,设置一段文本 */
insertText(option: InsertTextOption): void
/** [EditorContext.redo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.redo.html)
*
- * 恢复
+ * 需要基础库: `2.7.0`
*
- * 最低基础库: `2.7.0` */
+ * 在插件中使用:支持
+ *
+ * 恢复 */
redo(option?: RedoOption): void
/** [EditorContext.removeFormat(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.removeFormat.html)
*
- * 清除当前选区的样式
+ * 需要基础库: `2.7.0`
*
- * 最低基础库: `2.7.0` */
+ * 在插件中使用:支持
+ *
+ * 清除当前选区的样式 */
removeFormat(option?: RemoveFormatOption): void
/** [EditorContext.scrollIntoView()](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.scrollIntoView.html)
*
- * 使得编辑器光标处滚动到窗口可视区域内。
+ * 需要基础库: `2.8.3`
*
- * 最低基础库: `2.8.3` */
+ * 在插件中使用:支持
+ *
+ * 使得编辑器光标处滚动到窗口可视区域内。 */
scrollIntoView(): void
/** [EditorContext.setContents(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.setContents.html)
*
- * 初始化编辑器内容,html和delta同时存在时仅delta生效
+ * 需要基础库: `2.7.0`
*
- * 最低基础库: `2.7.0` */
+ * 在插件中使用:支持
+ *
+ * 初始化编辑器内容,html和delta同时存在时仅delta生效 */
setContents(option: SetContentsOption): void
+ /** [EditorContext.setSelection(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.setSelection.html)
+ *
+ * 需要基础库: `3.7.11`
+ *
+ * 在插件中使用:支持
+ *
+ * 设置当前选区 */
+ setSelection(option: SetSelectionOption): void
/** [EditorContext.undo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.undo.html)
*
- * 撤销
+ * 需要基础库: `2.7.0`
*
- * 最低基础库: `2.7.0` */
+ * 在插件中使用:支持
+ *
+ * 撤销 */
undo(option?: UndoOption): void
}
+ interface EmptyEventChannel {
+ /** [EventChannel.emit(string eventName, any args)](https://developers.weixin.qq.com/miniprogram/dev/api/route/EventChannel.emit.html)
+ *
+ * 需要基础库: `2.7.3`
+ *
+ * 在插件中使用:支持
+ *
+ * 触发一个事件 */
+ emit: undefined
+ /** [EventChannel.off(string eventName, function fn)](https://developers.weixin.qq.com/miniprogram/dev/api/route/EventChannel.off.html)
+ *
+ * 需要基础库: `2.7.3`
+ *
+ * 在插件中使用:支持
+ *
+ * 取消监听一个事件。给出第二个参数时,只取消给出的监听函数,否则取消所有监听函数 */
+ off: undefined
+ /** [EventChannel.on(string eventName, function fn)](https://developers.weixin.qq.com/miniprogram/dev/api/route/EventChannel.on.html)
+ *
+ * 需要基础库: `2.7.3`
+ *
+ * 在插件中使用:支持
+ *
+ * 持续监听一个事件 */
+ on: undefined
+ /** [EventChannel.once(string eventName, function fn)](https://developers.weixin.qq.com/miniprogram/dev/api/route/EventChannel.once.html)
+ *
+ * 需要基础库: `2.7.3`
+ *
+ * 在插件中使用:支持
+ *
+ * 监听一个事件一次,触发后失效 */
+ once: undefined
+ }
interface EntryList {
- /** [Array EntryList.getEntries()](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/EntryList.getEntries.html)
+ /** [Array.<[PerformanceEntry](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/PerformanceEntry.html)> EntryList.getEntries()](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/EntryList.getEntries.html)
*
- * 该方法返回当前列表中的所有性能数据
+ * 需要基础库: `2.11.0`
*
- * 最低基础库: `2.11.0` */
- getEntries(): any[]
- /** [Array EntryList.getEntriesByName(string name, string entryType)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/EntryList.getEntriesByName.html)
+ * 在插件中使用:不支持
*
- * 获取当前列表中所有名称为 [name] 且类型为 [entryType] 的性能数据
+ * 该方法返回当前列表中的所有性能数据 */
+ getEntries(): PerformanceEntry[]
+ /** [Array.<[PerformanceEntry](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/PerformanceEntry.html)> EntryList.getEntriesByName(string name, string entryType)](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/EntryList.getEntriesByName.html)
*
- * 最低基础库: `2.11.0` */
- getEntriesByName(name: string, entryType?: string): any[]
- /** [Array EntryList.getEntriesByType(string entryType)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/EntryList.getEntriesByType.html)
+ * 需要基础库: `2.11.0`
*
- * 获取当前列表中所有类型为 [entryType] 的性能数据
+ * 在插件中使用:不支持
*
- * 最低基础库: `2.11.0` */
- getEntriesByType(entryType: string): any[]
+ * 获取当前列表中所有名称为 [name] 且类型为 [entryType] 的性能数据 */
+ getEntriesByName(
+ name: string,
+ entryType?: string
+ ): PerformanceEntry[]
+ /** [Array.<[PerformanceEntry](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/PerformanceEntry.html)> EntryList.getEntriesByType(string entryType)](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/EntryList.getEntriesByType.html)
+ *
+ * 需要基础库: `2.11.0`
+ *
+ * 在插件中使用:不支持
+ *
+ * 获取当前列表中所有类型为 [entryType] 的性能数据 */
+ getEntriesByType(entryType: string): PerformanceEntry[]
}
interface EventChannel {
/** [EventChannel.emit(string eventName, any args)](https://developers.weixin.qq.com/miniprogram/dev/api/route/EventChannel.emit.html)
*
- * 触发一个事件
+ * 需要基础库: `2.7.3`
*
- * 最低基础库: `2.7.3` */
+ * 在插件中使用:支持
+ *
+ * 触发一个事件 */
emit(
/** 事件名称 */
eventName: string,
@@ -8908,9 +16309,11 @@ this.editorCtx.insertImage({
): void
/** [EventChannel.off(string eventName, function fn)](https://developers.weixin.qq.com/miniprogram/dev/api/route/EventChannel.off.html)
*
- * 取消监听一个事件。给出第二个参数时,只取消给出的监听函数,否则取消所有监听函数
+ * 需要基础库: `2.7.3`
*
- * 最低基础库: `2.7.3` */
+ * 在插件中使用:支持
+ *
+ * 取消监听一个事件。给出第二个参数时,只取消给出的监听函数,否则取消所有监听函数 */
off(
/** 事件名称 */
eventName: string,
@@ -8919,9 +16322,11 @@ this.editorCtx.insertImage({
): void
/** [EventChannel.on(string eventName, function fn)](https://developers.weixin.qq.com/miniprogram/dev/api/route/EventChannel.on.html)
*
- * 持续监听一个事件
+ * 需要基础库: `2.7.3`
*
- * 最低基础库: `2.7.3` */
+ * 在插件中使用:支持
+ *
+ * 持续监听一个事件 */
on(
/** 事件名称 */
eventName: string,
@@ -8930,9 +16335,11 @@ this.editorCtx.insertImage({
): void
/** [EventChannel.once(string eventName, function fn)](https://developers.weixin.qq.com/miniprogram/dev/api/route/EventChannel.once.html)
*
- * 监听一个事件一次,触发后失效
+ * 需要基础库: `2.7.3`
*
- * 最低基础库: `2.7.3` */
+ * 在插件中使用:支持
+ *
+ * 监听一个事件一次,触发后失效 */
once(
/** 事件名称 */
eventName: string,
@@ -8940,36 +16347,294 @@ this.editorCtx.insertImage({
fn: EventCallback
): void
}
+ interface FileError {
+ /** 错误信息
+ *
+ * | 错误码 | 错误信息 | 说明 |
+ * | - | - | - |
+ * | 1300001 | operation not permitted | 操作不被允许(例如,filePath 预期传入一个文件而实际传入一个目录) |
+ * | 1300002 | no such file or directory ${path} | 文件/目录不存在,或者目标文件路径的上层目录不存在 |
+ * | 1300005 | Input/output error | 输入输出流不可用 |
+ * | 1300009 | bad file descriptor | 无效的文件描述符 |
+ * | 1300013 | permission denied | 权限错误,文件是只读或只写 |
+ * | 1300014 | Path permission denied | 传入的路径没有权限 |
+ * | 1300020 | not a directory | dirPath 指定路径不是目录,常见于指定的写入路径的上级路径为一个文件的情况 |
+ * | 1300021 | Is a directory | 指定路径是一个目录 |
+ * | 1300022 | Invalid argument | 无效参数,可以检查length或offset是否越界 |
+ * | 1300036 | File name too long | 文件名过长 |
+ * | 1300066 | directory not empty | 目录不为空 |
+ * | 1300201 | system error | 系统接口调用失败 |
+ * | 1300202 | the maximum size of the file storage limit is exceeded | 存储空间不足,或文件大小超出上限(上限100M) |
+ * | 1300203 | base64 encode error | 字符编码转换失败(例如 base64 格式错误) |
+ * | 1300300 | sdcard not mounted | android sdcard 挂载失败 |
+ * | 1300301 | unable to open as fileType | 无法以fileType打开文件 |
+ * | 1301000 | permission denied, cannot access file path | 目标路径无访问权限(usr目录) |
+ * | 1301002 | data to write is empty | 写入数据为空 |
+ * | 1301003 | illegal operation on a directory | 不可对目录进行此操作(例如,指定的 filePath 是一个已经存在的目录) |
+ * | 1301004 | illegal operation on a package directory | 不可对代码包目录进行此操作 |
+ * | 1301005 | file already exists ${dirPath} | 已有同名文件或目录 |
+ * | 1301006 | value of length is out of range | 传入的 length 不合法 |
+ * | 1301007 | value of offset is out of range | 传入的 offset 不合法 |
+ * | 1301009 | value of position is out of range | position值越界 |
+ * | 1301100 | store directory is empty | store目录为空 |
+ * | 1301102 | unzip open file fail | 压缩文件打开失败 |
+ * | 1301103 | unzip entry fail | 解压单个文件失败 |
+ * | 1301104 | unzip fail | 解压失败 |
+ * | 1301111 | brotli decompress fail | brotli解压失败(例如,指定的 compressionAlgorithm 与文件实际压缩格式不符) |
+ * | 1301112 | tempFilePath file not exist | 指定的 tempFilePath 找不到文件 |
+ * | 1302001 | fail permission denied | 指定的 fd 路径没有读权限/没有写权限 |
+ * | 1302002 | excced max concurrent fd limit | fd数量已达上限 |
+ * | 1302003 | invalid flag | 无效的flag |
+ * | 1302004 | permission denied when open using flag | 无法使用flag标志打开文件 |
+ * | 1302005 | array buffer does not exist | 未传入arrayBuffer |
+ * | 1302100 | array buffer is readonly | arrayBuffer只读 | */ errMsg: string
+ /** 错误码
+ *
+ * | 错误码 | 错误信息 | 说明 |
+ * | - | - | - |
+ * | 1300001 | operation not permitted | 操作不被允许(例如,filePath 预期传入一个文件而实际传入一个目录) |
+ * | 1300002 | no such file or directory ${path} | 文件/目录不存在,或者目标文件路径的上层目录不存在 |
+ * | 1300005 | Input/output error | 输入输出流不可用 |
+ * | 1300009 | bad file descriptor | 无效的文件描述符 |
+ * | 1300013 | permission denied | 权限错误,文件是只读或只写 |
+ * | 1300014 | Path permission denied | 传入的路径没有权限 |
+ * | 1300020 | not a directory | dirPath 指定路径不是目录,常见于指定的写入路径的上级路径为一个文件的情况 |
+ * | 1300021 | Is a directory | 指定路径是一个目录 |
+ * | 1300022 | Invalid argument | 无效参数,可以检查length或offset是否越界 |
+ * | 1300036 | File name too long | 文件名过长 |
+ * | 1300066 | directory not empty | 目录不为空 |
+ * | 1300201 | system error | 系统接口调用失败 |
+ * | 1300202 | the maximum size of the file storage limit is exceeded | 存储空间不足,或文件大小超出上限(上限100M) |
+ * | 1300203 | base64 encode error | 字符编码转换失败(例如 base64 格式错误) |
+ * | 1300300 | sdcard not mounted | android sdcard 挂载失败 |
+ * | 1300301 | unable to open as fileType | 无法以fileType打开文件 |
+ * | 1301000 | permission denied, cannot access file path | 目标路径无访问权限(usr目录) |
+ * | 1301002 | data to write is empty | 写入数据为空 |
+ * | 1301003 | illegal operation on a directory | 不可对目录进行此操作(例如,指定的 filePath 是一个已经存在的目录) |
+ * | 1301004 | illegal operation on a package directory | 不可对代码包目录进行此操作 |
+ * | 1301005 | file already exists ${dirPath} | 已有同名文件或目录 |
+ * | 1301006 | value of length is out of range | 传入的 length 不合法 |
+ * | 1301007 | value of offset is out of range | 传入的 offset 不合法 |
+ * | 1301009 | value of position is out of range | position值越界 |
+ * | 1301100 | store directory is empty | store目录为空 |
+ * | 1301102 | unzip open file fail | 压缩文件打开失败 |
+ * | 1301103 | unzip entry fail | 解压单个文件失败 |
+ * | 1301104 | unzip fail | 解压失败 |
+ * | 1301111 | brotli decompress fail | brotli解压失败(例如,指定的 compressionAlgorithm 与文件实际压缩格式不符) |
+ * | 1301112 | tempFilePath file not exist | 指定的 tempFilePath 找不到文件 |
+ * | 1302001 | fail permission denied | 指定的 fd 路径没有读权限/没有写权限 |
+ * | 1302002 | excced max concurrent fd limit | fd数量已达上限 |
+ * | 1302003 | invalid flag | 无效的flag |
+ * | 1302004 | permission denied when open using flag | 无法使用flag标志打开文件 |
+ * | 1302005 | array buffer does not exist | 未传入arrayBuffer |
+ * | 1302100 | array buffer is readonly | arrayBuffer只读 | */ errCode: number
+ }
interface FileSystemManager {
/** [Array.<string> FileSystemManager.readdirSync(string dirPath)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readdirSync.html)
- *
- * [FileSystemManager.readdir](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readdir.html) 的同步版本 */
+*
+* 在插件中使用:需要基础库 `2.19.2`
+*
+* [FileSystemManager.readdir](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readdir.html) 的同步版本
+*
+* **注意事项**
+*
+* - readdir接口无法访问文件系统根路径(wxfile://)。
+*
+* **示例代码**
+*
+* ```js
+const fs = wx.getFileSystemManager()
+fs.readdir({
+ dirPath: `${wx.env.USER_DATA_PATH}/example`,
+ success(res) {
+ console.log(res.files)
+ },
+ fail(res) {
+ console.error(res)
+ }
+})
+
+// 同步接口
+try {
+ const res = fs.readdirSync(`${wx.env.USER_DATA_PATH}/example`)
+ console.log(res)
+} catch(e) {
+ console.error(e)
+}
+``` */
readdirSync(
/** 要读取的目录路径 (本地路径) */
dirPath: string
): string[]
+ /** [ArrayBuffer FileSystemManager.readCompressedFileSync(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readCompressedFileSync.html)
+*
+* 需要基础库: `2.21.1`
+*
+* 在插件中使用:不支持
+*
+* 同步读取指定压缩类型的本地文件内容
+*
+* **示例代码**
+*
+* ```js
+const fs = wx.getFileSystemManager()
+
+// 异步接口
+fs.readCompressedFile({
+ filePath: '${wx.env.USER_DATA_PATH}/hello.br',
+ compressionAlgorithm: 'br',
+ success(res) {
+ console.log(res.data)
+ },
+ fail(res) {
+ console.log('readCompressedFile fail', res)
+ }
+})
+
+// 同步接口
+try {
+ const data = fs.readCompressedFileSync({
+ filePath: '${wx.env.USER_DATA_PATH}/hello.br',
+ compressionAlgorithm: 'br',
+ })
+ console.log(data)
+} catch (err) {
+ console.log(err)
+}
+``` */
+ readCompressedFileSync(
+ option: ReadCompressedFileSyncOption
+ ): ArrayBuffer
/** [FileSystemManager.access(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.access.html)
- *
- * 判断文件/目录是否存在 */
+*
+* 在插件中使用:需要基础库 `2.19.2`
+*
+* 判断文件/目录是否存在
+*
+* **示例代码**
+*
+* ```js
+const fs = wx.getFileSystemManager()
+// 判断文件/目录是否存在
+fs.access({
+ path: `${wx.env.USER_DATA_PATH}/hello.txt`,
+ success(res) {
+ // 文件存在
+ console.log(res)
+ },
+ fail(res) {
+ // 文件不存在或其他错误
+ console.error(res)
+ }
+})
+
+// 同步接口
+try {
+ fs.accessSync(`${wx.env.USER_DATA_PATH}/hello.txt`)
+} catch(e) {
+ console.error(e)
+}
+``` */
access(option: AccessOption): void
/** [FileSystemManager.accessSync(string path)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.accessSync.html)
- *
- * [FileSystemManager.access](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.access.html) 的同步版本 */
+*
+* 在插件中使用:需要基础库 `2.19.2`
+*
+* [FileSystemManager.access](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.access.html) 的同步版本
+*
+* **示例代码**
+*
+* ```js
+const fs = wx.getFileSystemManager()
+// 判断文件/目录是否存在
+fs.access({
+ path: `${wx.env.USER_DATA_PATH}/hello.txt`,
+ success(res) {
+ // 文件存在
+ console.log(res)
+ },
+ fail(res) {
+ // 文件不存在或其他错误
+ console.error(res)
+ }
+})
+
+// 同步接口
+try {
+ fs.accessSync(`${wx.env.USER_DATA_PATH}/hello.txt`)
+} catch(e) {
+ console.error(e)
+}
+``` */
accessSync(
/** 要判断是否存在的文件/目录路径 (本地路径) */
path: string
): void
/** [FileSystemManager.appendFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.appendFile.html)
- *
- * 在文件结尾追加内容
- *
- * 最低基础库: `2.1.0` */
+*
+* 需要基础库: `2.1.0`
+*
+* 在插件中使用:需要基础库 `2.19.2`
+*
+* 在文件结尾追加内容
+*
+* **示例代码**
+*
+* ```js
+const fs = wx.getFileSystemManager()
+
+fs.appendFile({
+ filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
+ data: 'some text',
+ encoding: 'utf8',
+ success(res) {
+ console.log(res)
+ },
+ fail(res) {
+ console.error(res)
+ }
+})
+
+// 同步接口
+try {
+ fs.appendFileSync(`${wx.env.USER_DATA_PATH}/hello.txt`, 'some text', 'utf8')
+} catch(e) {
+ console.error(e)
+}
+``` */
appendFile(option: AppendFileOption): void
/** [FileSystemManager.appendFileSync(string filePath, string|ArrayBuffer data, string encoding)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.appendFileSync.html)
- *
- * [FileSystemManager.appendFile](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.appendFile.html) 的同步版本
- *
- * 最低基础库: `2.1.0` */
+*
+* 需要基础库: `2.1.0`
+*
+* 在插件中使用:需要基础库 `2.19.2`
+*
+* [FileSystemManager.appendFile](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.appendFile.html) 的同步版本
+*
+* **示例代码**
+*
+* ```js
+const fs = wx.getFileSystemManager()
+
+fs.appendFile({
+ filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
+ data: 'some text',
+ encoding: 'utf8',
+ success(res) {
+ console.log(res)
+ },
+ fail(res) {
+ console.error(res)
+ }
+})
+
+// 同步接口
+try {
+ fs.appendFileSync(`${wx.env.USER_DATA_PATH}/hello.txt`, 'some text', 'utf8')
+} catch(e) {
+ console.error(e)
+}
+``` */
appendFileSync(
/** 要追加内容的文件路径 (本地路径) */
filePath: string,
@@ -9002,61 +16667,520 @@ this.editorCtx.insertImage({
| 'utf8'
| 'latin1'
): void
+ /** [FileSystemManager.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.close.html)
+*
+* 需要基础库: `2.16.1`
+*
+* 在插件中使用:需要基础库 `2.19.2`
+*
+* 关闭文件
+*
+* **示例代码**
+*
+* ```js
+const fs = wx.getFileSystemManager()
+// 打开文件
+fs.open({
+ filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
+ flag: 'a+',
+ success(res) {
+ // 关闭文件
+ fs.close({
+ fd: res.fd
+ })
+ }
+})
+``` */
+ close(option: FileSystemManagerCloseOption): void
/** [FileSystemManager.copyFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.copyFile.html)
- *
- * 复制文件 */
+*
+* 在插件中使用:需要基础库 `2.19.2`
+*
+* 复制文件
+*
+* **示例代码**
+*
+* ```js
+const fs = wx.getFileSystemManager()
+fs.copyFile({
+ srcPath: `${wx.env.USER_DATA_PATH}/hello.txt`,
+ destPath: `${wx.env.USER_DATA_PATH}/hello_copy.txt`
+ success(res) {
+ console.log(res)
+ },
+ fail(res) {
+ console.error(res)
+ }
+})
+
+// 同步接口
+try {
+ fs.copyFileSync(
+ `${wx.env.USER_DATA_PATH}/hello.txt`,
+ `${wx.env.USER_DATA_PATH}/hello_copy.txt`
+ )
+} catch(e) {
+ console.error(e)
+}
+``` */
copyFile(option: CopyFileOption): void
/** [FileSystemManager.copyFileSync(string srcPath, string destPath)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.copyFileSync.html)
- *
- * [FileSystemManager.copyFile](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.copyFile.html) 的同步版本 */
+*
+* 在插件中使用:需要基础库 `2.19.2`
+*
+* [FileSystemManager.copyFile](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.copyFile.html) 的同步版本
+*
+* **示例代码**
+*
+* ```js
+const fs = wx.getFileSystemManager()
+fs.copyFile({
+ srcPath: `${wx.env.USER_DATA_PATH}/hello.txt`,
+ destPath: `${wx.env.USER_DATA_PATH}/hello_copy.txt`
+ success(res) {
+ console.log(res)
+ },
+ fail(res) {
+ console.error(res)
+ }
+})
+
+// 同步接口
+try {
+ fs.copyFileSync(
+ `${wx.env.USER_DATA_PATH}/hello.txt`,
+ `${wx.env.USER_DATA_PATH}/hello_copy.txt`
+ )
+} catch(e) {
+ console.error(e)
+}
+``` */
copyFileSync(
/** 源文件路径,支持本地路径 */
srcPath: string,
/** 目标文件路径,支持本地路径 */
destPath: string
): void
+ /** [FileSystemManager.fstat(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.fstat.html)
+*
+* 需要基础库: `2.16.1`
+*
+* 在插件中使用:需要基础库 `2.19.2`
+*
+* 获取文件的状态信息
+*
+* **示例代码**
+*
+* ```js
+const fs = wx.getFileSystemManager()
+// 打开文件
+fs.open({
+ filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
+ flag: 'a+',
+ success(res) {
+ // 获取文件的状态信息
+ fs.fstat({
+ fd: res.fd,
+ success(res) {
+ console.log(res.stats)
+ }
+ })
+ }
+})
+``` */
+ fstat(option: FstatOption): void
+ /** [FileSystemManager.ftruncate(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.ftruncate.html)
+*
+* 需要基础库: `2.16.1`
+*
+* 在插件中使用:需要基础库 `2.19.2`
+*
+* 对文件内容进行截断操作
+*
+* **示例代码**
+*
+* ```js
+const fs = wx.getFileSystemManager()
+// 打开文件
+fs.open({
+ filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
+ flag: 'a+',
+ success(res) {
+ // 对文件内容进行截断操作
+ fs.ftruncate({
+ fd: res.fd,
+ length: 10, // 从第10个字节开始截断文件
+ success(res) {
+ console.log(res)
+ }
+ })
+ }
+})
+``` */
+ ftruncate(option: FtruncateOption): void
/** [FileSystemManager.getFileInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.getFileInfo.html)
+ *
+ * 在插件中使用:不支持
*
* 获取该小程序下的 本地临时文件 或 本地缓存文件 信息 */
- getFileInfo(option: FileSystemManagerGetFileInfoOption): void
+ getFileInfo(option: GetFileInfoOption): void
/** [FileSystemManager.getSavedFileList(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.getSavedFileList.html)
*
- * 获取该小程序下已保存的本地缓存文件列表 */
- getSavedFileList(option?: FileSystemManagerGetSavedFileListOption): void
- /** [FileSystemManager.mkdir(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.mkdir.html)
+ * 在插件中使用:不支持
*
- * 创建目录 */
+ * 获取该小程序下已保存的本地缓存文件列表 */
+ getSavedFileList(option?: GetSavedFileListOption): void
+ /** [FileSystemManager.mkdir(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.mkdir.html)
+*
+* 在插件中使用:需要基础库 `2.19.2`
+*
+* 创建目录
+*
+* **示例代码**
+*
+* ```js
+const fs = wx.getFileSystemManager()
+fs.mkdir({
+ dirPath: `${wx.env.USER_DATA_PATH}/example`,
+ recursive: false,
+ success(res) {
+ console.log(res)
+ },
+ fail(res) {
+ console.error(res)
+ }
+})
+
+// 同步接口
+try {
+ fs.mkdirSync(`${wx.env.USER_DATA_PATH}/example`, false)
+} catch(e) {
+ console.error(e)
+}
+``` */
mkdir(option: MkdirOption): void
/** [FileSystemManager.mkdirSync(string dirPath, boolean recursive)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.mkdirSync.html)
- *
- * [FileSystemManager.mkdir](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.mkdir.html) 的同步版本 */
+*
+* 在插件中使用:需要基础库 `2.19.2`
+*
+* [FileSystemManager.mkdir](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.mkdir.html) 的同步版本
+*
+* **示例代码**
+*
+* ```js
+const fs = wx.getFileSystemManager()
+fs.mkdir({
+ dirPath: `${wx.env.USER_DATA_PATH}/example`,
+ recursive: false,
+ success(res) {
+ console.log(res)
+ },
+ fail(res) {
+ console.error(res)
+ }
+})
+
+// 同步接口
+try {
+ fs.mkdirSync(`${wx.env.USER_DATA_PATH}/example`, false)
+} catch(e) {
+ console.error(e)
+}
+``` */
mkdirSync(
/** 创建的目录路径 (本地路径) */
dirPath: string,
- /** 是否在递归创建该目录的上级目录后再创建该目录。如果对应的上级目录已经存在,则不创建该上级目录。如 dirPath 为 a/b/c/d 且 recursive 为 true,将创建 a 目录,再在 a 目录下创建 b 目录,以此类推直至创建 a/b/c 目录下的 d 目录。
+ /** 需要基础库: `2.3.0`
*
- * 最低基础库: `2.3.0` */
+ * 是否在递归创建该目录的上级目录后再创建该目录。如果对应的上级目录已经存在,则不创建该上级目录。如 dirPath 为 a/b/c/d 且 recursive 为 true,将创建 a 目录,再在 a 目录下创建 b 目录,以此类推直至创建 a/b/c 目录下的 d 目录。 */
recursive?: boolean
): void
+ /** [FileSystemManager.open(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.open.html)
+*
+* 需要基础库: `2.16.1`
+*
+* 在插件中使用:需要基础库 `2.19.2`
+*
+* 打开文件,返回文件描述符
+*
+* **示例代码**
+*
+* ```js
+const fs = wx.getFileSystemManager()
+fs.open({
+ filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
+ flag: 'a+',
+ success(res) {
+ console.log(res.fd)
+ }
+})
+``` */
+ open(option: OpenOption): void
+ /** [FileSystemManager.read(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.read.html)
+*
+* 需要基础库: `2.16.1`
+*
+* 在插件中使用:需要基础库 `2.19.2`
+*
+* 读文件
+*
+* **示例代码**
+*
+* ```js
+const fs = wx.getFileSystemManager()
+const ab = new ArrayBuffer(1024)
+// 打开文件
+fs.open({
+ filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
+ flag: 'a+',
+ success(res) {
+ // 读取文件到 ArrayBuffer 中
+ fs.read({
+ fd: res.fd,
+ arrayBuffer: ab,
+ length: 10,
+ success(res) {
+ console.log(res)
+ }
+ })
+ }
+})
+```
+* ## 注意事项
+* - 小游戏 iOS 高性能模式(iOSHighPerformance)暂不支持 FileSystemManager.read 接口,请使用 FileSystemManager.readFile 接口代替 */
+ read(option: ReadOption): void
+ /** [FileSystemManager.readCompressedFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readCompressedFile.html)
+*
+* 需要基础库: `2.21.1`
+*
+* 在插件中使用:不支持
+*
+* 读取指定压缩类型的本地文件内容
+*
+* **示例代码**
+*
+* ```js
+const fs = wx.getFileSystemManager()
+
+// 异步接口
+fs.readCompressedFile({
+ filePath: '${wx.env.USER_DATA_PATH}/hello.br',
+ compressionAlgorithm: 'br',
+ success(res) {
+ console.log(res.data)
+ },
+ fail(res) {
+ console.log('readCompressedFile fail', res)
+ }
+})
+
+// 同步接口
+const data = fs.readCompressedFileSync({
+ filePath: '${wx.env.USER_DATA_PATH}/hello.br',
+ compressionAlgorithm: 'br',
+})
+console.log(data)
+``` */
+ readCompressedFile(option: ReadCompressedFileOption): void
/** [FileSystemManager.readFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readFile.html)
- *
- * 读取本地文件内容 */
+*
+* 在插件中使用:需要基础库 `2.19.2`
+*
+* 读取本地文件内容。单个文件大小上限为100M。
+*
+* **示例代码**
+*
+* ```js
+const fs = wx.getFileSystemManager()
+fs.readFile({
+ filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
+ encoding: 'utf8',
+ position: 0,
+ success(res) {
+ console.log(res.data)
+ },
+ fail(res) {
+ console.error(res)
+ }
+})
+
+// 同步接口
+try {
+ const res = fs.readFileSync(`${wx.env.USER_DATA_PATH}/hello.txt`, 'utf8', 0)
+ console.log(res)
+} catch(e) {
+ console.error(e)
+}
+``` */
readFile(option: ReadFileOption): void
+ /** [FileSystemManager.readZipEntry(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readZipEntry.html)
+*
+* 需要基础库: `2.17.3`
+*
+* 在插件中使用:需要基础库 `2.19.2`
+*
+* 读取压缩包内的文件
+*
+* **示例代码**
+*
+* ```js
+const fs = wx.getFileSystemManager()
+// 读取zip内某个或多个文件
+fs.readZipEntry({
+ filePath: 'wxfile://from/to.zip',
+ entries: [{
+ path: 'some_folder/my_file.txt', // zip内文件路径
+ encoding: 'utf-8', // 指定读取文件的字符编码,如果不传 encoding,则以 ArrayBuffer 格式读取文件的二进制内容
+ position: 0, // 从文件指定位置开始读,如果不指定,则从文件头开始读。读取的范围应该是左闭右开区间 [position, position+length)。有效范围:[0, fileLength - 1]。单位:byte
+ length: 10000, // 指定文件的长度,如果不指定,则读到文件末尾。有效范围:[1, fileLength]。单位:byte
+ }, {
+ path: 'other_folder/orther_file.txt', // zip内文件路径
+ }],
+ success(res) {
+ console.log(res.entries)
+ // res.entries === {
+ // 'some_folder/my_file.txt': {
+ // errMsg: 'readZipEntry:ok',
+ // data: 'xxxxxx'
+ // },
+ // 'other_folder/orther_file.txt': {
+ // data: (ArrayBuffer)
+ // }
+ // }
+ },
+ fail(res) {
+ console.log(res.errMsg)
+ },
+})
+
+// 读取zip内所有文件。允许指定统一的encoding。position、length则不再允许指定,分别默认为0和文件长度
+fs.readZipEntry({
+ filePath: 'wxfile://from/to.zip',
+ entries: 'all'
+ encoding: 'utf-8', // 统一指定读取文件的字符编码,如果不传 encoding,则以 ArrayBuffer 格式读取文件的二进制内容
+ success(res) {
+ console.log(res.entries)
+ // res.entries === {
+ // 'some_folder/my_file.txt': {
+ // errMsg: 'readZipEntry:ok',
+ // data: 'xxxxxx'
+ // },
+ // 'other_folder/orther_file.txt': {
+ // errMsg: 'readZipEntry:ok',
+ // data: 'xxxxxx'
+ // }
+ // }
+ },
+ fail(res) {
+ console.log(res.errMsg)
+ },
+})
+``` */
+ readZipEntry(option: ReadZipEntryOption): void
/** [FileSystemManager.readdir(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readdir.html)
- *
- * 读取目录内文件列表 */
+*
+* 在插件中使用:需要基础库 `2.19.2`
+*
+* 读取目录内文件列表
+*
+* **注意事项**
+*
+* - readdir接口无法访问文件系统根路径(wxfile://)。
+*
+* **示例代码**
+*
+* ```js
+const fs = wx.getFileSystemManager()
+fs.readdir({
+ dirPath: `${wx.env.USER_DATA_PATH}/example`,
+ success(res) {
+ console.log(res.files)
+ },
+ fail(res) {
+ console.error(res)
+ }
+})
+
+// 同步接口
+try {
+ const res = fs.readdirSync(`${wx.env.USER_DATA_PATH}/example`)
+ console.log(res)
+} catch(e) {
+ console.error(e)
+}
+``` */
readdir(option: ReaddirOption): void
/** [FileSystemManager.removeSavedFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.removeSavedFile.html)
*
- * 删除该小程序下已保存的本地缓存文件 */
- removeSavedFile(option: FileSystemManagerRemoveSavedFileOption): void
- /** [FileSystemManager.rename(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.rename.html)
+ * 在插件中使用:不支持
*
- * 重命名文件。可以把文件从 oldPath 移动到 newPath */
+ * 删除该小程序下已保存的本地缓存文件 */
+ removeSavedFile(option: RemoveSavedFileOption): void
+ /** [FileSystemManager.rename(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.rename.html)
+*
+* 在插件中使用:需要基础库 `2.19.2`
+*
+* 重命名文件。可以把文件从 oldPath 移动到 newPath
+*
+* **示例代码**
+*
+* ```js
+const fs = wx.getFileSystemManager()
+fs.rename({
+ oldPath: `${wx.env.USER_DATA_PATH}/hello.txt`,
+ newPath: `${wx.env.USER_DATA_PATH}/hello_new.txt`,
+ success(res) {
+ console.log(res)
+ },
+ fail(res) {
+ console.error(res)
+ }
+})
+
+// 同步接口
+try {
+ const res = fs.renameSync(
+ `${wx.env.USER_DATA_PATH}/hello.txt`,
+ `${wx.env.USER_DATA_PATH}/hello_new.txt`
+ )
+ console.log(res)
+} catch(e) {
+ console.error(e)
+}
+``` */
rename(option: RenameOption): void
/** [FileSystemManager.renameSync(string oldPath, string newPath)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.renameSync.html)
- *
- * [FileSystemManager.rename](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.rename.html) 的同步版本 */
+*
+* 在插件中使用:需要基础库 `2.19.2`
+*
+* [FileSystemManager.rename](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.rename.html) 的同步版本
+*
+* **示例代码**
+*
+* ```js
+const fs = wx.getFileSystemManager()
+fs.rename({
+ oldPath: `${wx.env.USER_DATA_PATH}/hello.txt`,
+ newPath: `${wx.env.USER_DATA_PATH}/hello_new.txt`,
+ success(res) {
+ console.log(res)
+ },
+ fail(res) {
+ console.error(res)
+ }
+})
+
+// 同步接口
+try {
+ const res = fs.renameSync(
+ `${wx.env.USER_DATA_PATH}/hello.txt`,
+ `${wx.env.USER_DATA_PATH}/hello_new.txt`
+ )
+ console.log(res)
+} catch(e) {
+ console.error(e)
+}
+``` */
renameSync(
/** 源文件路径,支持本地路径 */
oldPath: string,
@@ -9064,50 +17188,286 @@ this.editorCtx.insertImage({
newPath: string
): void
/** [FileSystemManager.rmdir(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.rmdir.html)
- *
- * 删除目录 */
+*
+* 在插件中使用:需要基础库 `2.19.2`
+*
+* 删除目录
+*
+* **示例代码**
+*
+* ```js
+const fs = wx.getFileSystemManager()
+fs.rmdir({
+ dirPath: `${wx.env.USER_DATA_PATH}/example`,
+ recursive: false,
+ success(res) {
+ console.log(res)
+ },
+ fail(res) {
+ console.error(res)
+ }
+})
+
+// 同步接口
+try {
+ const res = fs.rmdirSync(`${wx.env.USER_DATA_PATH}/example`, false)
+ console.log(res)
+} catch(e) {
+ console.error(e)
+}
+``` */
rmdir(option: RmdirOption): void
/** [FileSystemManager.rmdirSync(string dirPath, boolean recursive)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.rmdirSync.html)
- *
- * [FileSystemManager.rmdir](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.rmdir.html) 的同步版本 */
+*
+* 在插件中使用:需要基础库 `2.19.2`
+*
+* [FileSystemManager.rmdir](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.rmdir.html) 的同步版本
+*
+* **示例代码**
+*
+* ```js
+const fs = wx.getFileSystemManager()
+fs.rmdir({
+ dirPath: `${wx.env.USER_DATA_PATH}/example`,
+ recursive: false,
+ success(res) {
+ console.log(res)
+ },
+ fail(res) {
+ console.error(res)
+ }
+})
+
+// 同步接口
+try {
+ const res = fs.rmdirSync(`${wx.env.USER_DATA_PATH}/example`, false)
+ console.log(res)
+} catch(e) {
+ console.error(e)
+}
+``` */
rmdirSync(
/** 要删除的目录路径 (本地路径) */
dirPath: string,
- /** 是否递归删除目录。如果为 true,则删除该目录和该目录下的所有子目录以及文件。
+ /** 需要基础库: `2.3.0`
*
- * 最低基础库: `2.3.0` */
+ * 是否递归删除目录。如果为 true,则删除该目录和该目录下的所有子目录以及文件。 */
recursive?: boolean
): void
/** [FileSystemManager.saveFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.saveFile.html)
+ *
+ * 在插件中使用:不支持
*
* 保存临时文件到本地。此接口会移动临时文件,因此调用成功后,tempFilePath 将不可用。 */
- saveFile(option: FileSystemManagerSaveFileOption): void
+ saveFile(option: SaveFileOption): void
/** [FileSystemManager.stat(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.stat.html)
+ *
+ * 在插件中使用:需要基础库 `2.19.2`
*
* 获取文件 Stats 对象 */
stat(option: StatOption): void
+ /** [FileSystemManager.truncate(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.truncate.html)
+*
+* 需要基础库: `2.16.1`
+*
+* 在插件中使用:需要基础库 `2.19.2`
+*
+* 对文件内容进行截断操作
+*
+* **示例代码**
+*
+* ```js
+const fs = wx.getFileSystemManager()
+fs.truncate({
+ filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
+ length: 10, // 从第10个字节开始截断
+ success(res) {
+ console.log(res)
+ }
+})
+``` */
+ truncate(option: TruncateOption): void
/** [FileSystemManager.unlink(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.unlink.html)
- *
- * 删除文件 */
+*
+* 在插件中使用:需要基础库 `2.19.2`
+*
+* 删除文件
+*
+* **示例代码**
+*
+* ```js
+const fs = wx.getFileSystemManager()
+fs.unlink({
+ filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
+ success(res) {
+ console.log(res)
+ },
+ fail(res) {
+ console.error(res)
+ }
+})
+
+// 同步接口
+try {
+ const res = fs.unlinkSync(`${wx.env.USER_DATA_PATH}/hello.txt`)
+ console.log(res)
+} catch(e) {
+ console.error(e)
+}
+``` */
unlink(option: UnlinkOption): void
/** [FileSystemManager.unlinkSync(string filePath)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.unlinkSync.html)
- *
- * [FileSystemManager.unlink](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.unlink.html) 的同步版本 */
+*
+* 在插件中使用:需要基础库 `2.19.2`
+*
+* [FileSystemManager.unlink](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.unlink.html) 的同步版本
+*
+* **示例代码**
+*
+* ```js
+const fs = wx.getFileSystemManager()
+fs.unlink({
+ filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
+ success(res) {
+ console.log(res)
+ },
+ fail(res) {
+ console.error(res)
+ }
+})
+
+// 同步接口
+try {
+ const res = fs.unlinkSync(`${wx.env.USER_DATA_PATH}/hello.txt`)
+ console.log(res)
+} catch(e) {
+ console.error(e)
+}
+``` */
unlinkSync(
/** 要删除的文件路径 (本地路径) */
filePath: string
): void
/** [FileSystemManager.unzip(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.unzip.html)
- *
- * 解压文件 */
+*
+* 在插件中使用:需要基础库 `2.19.2`
+*
+* 解压文件
+*
+* **示例代码**
+*
+* ```js
+const fs = wx.getFileSystemManager()
+fs.unzip({
+ zipFilePath: `${wx.env.USER_DATA_PATH}/example.zip`,
+ targetPath: '${wx.env.USER_DATA_PATH}/example',
+ success(res) {
+ console.log(res)
+ },
+ fail(res) {
+ console.error(res)
+ }
+})
+``` */
unzip(option: UnzipOption): void
+ /** [FileSystemManager.write(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.write.html)
+*
+* 需要基础库: `2.16.1`
+*
+* 在插件中使用:需要基础库 `2.19.2`
+*
+* 写入文件
+*
+* **示例代码**
+*
+* ```js
+const fs = wx.getFileSystemManager()
+// 打开文件
+fs.open({
+ filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
+ flag: 'a+',
+ success(res) {
+ // 写入文件
+ fs.write({
+ fd: res.fd,
+ data: 'some text',
+ success(res) {
+ console.log(res.bytesWritten)
+ }
+ })
+ }
+})
+``` */
+ write(option: WriteOption): void
/** [FileSystemManager.writeFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.writeFile.html)
- *
- * 写文件 */
+*
+* 在插件中使用:需要基础库 `2.19.2`
+*
+* 写文件
+*
+* **示例代码**
+*
+* ```js
+const fs = wx.getFileSystemManager()
+fs.writeFile({
+ filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
+ data: 'some text or arrayBuffer',
+ encoding: 'utf8',
+ success(res) {
+ console.log(res)
+ },
+ fail(res) {
+ console.error(res)
+ }
+})
+
+// 同步接口
+try {
+ const res = fs.writeFileSync(
+ `${wx.env.USER_DATA_PATH}/hello.txt`,
+ 'some text or arrayBuffer',
+ 'utf8'
+ )
+ console.log(res)
+} catch(e) {
+ console.error(e)
+}
+``` */
writeFile(option: WriteFileOption): void
/** [FileSystemManager.writeFileSync(string filePath, string|ArrayBuffer data, string encoding)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.writeFileSync.html)
- *
- * [FileSystemManager.writeFile](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.writeFile.html) 的同步版本 */
+*
+* 在插件中使用:需要基础库 `2.19.2`
+*
+* [FileSystemManager.writeFile](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.writeFile.html) 的同步版本
+*
+* **示例代码**
+*
+* ```js
+const fs = wx.getFileSystemManager()
+fs.writeFile({
+ filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
+ data: 'some text or arrayBuffer',
+ encoding: 'utf8',
+ success(res) {
+ console.log(res)
+ },
+ fail(res) {
+ console.error(res)
+ }
+})
+
+// 同步接口
+try {
+ const res = fs.writeFileSync(
+ `${wx.env.USER_DATA_PATH}/hello.txt`,
+ 'some text or arrayBuffer',
+ 'utf8'
+ )
+ console.log(res)
+} catch(e) {
+ console.error(e)
+}
+``` */
writeFileSync(
/** 要写入的文件路径 (本地路径) */
filePath: string,
@@ -9117,7 +17477,7 @@ this.editorCtx.insertImage({
*
* 参数 encoding 可选值:
* - 'ascii': ;
- * - 'base64': ;
+ * - 'base64': (注意,选择 base64 编码,data 只需要传 base64 内容本身,不要传 Data URI 前缀,否则会报 fail base64 encode error 错误。例如,传 aGVsbG8= 而不是传 data:image/png;base64,aGVsbG8= );
* - 'binary': ;
* - 'hex': ;
* - 'ucs2': 以小端序读取;
@@ -9140,18 +17500,111 @@ this.editorCtx.insertImage({
| 'utf8'
| 'latin1'
): void
- /** [[Stats](https://developers.weixin.qq.com/miniprogram/dev/api/file/Stats.html)|Object FileSystemManager.statSync(string path, boolean recursive)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.statSync.html)
+ /** [[ReadResult](https://developers.weixin.qq.com/miniprogram/dev/api/file/ReadResult.html) FileSystemManager.readSync(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readSync.html)
+*
+* 需要基础库: `2.16.1`
+*
+* 在插件中使用:需要基础库 `2.19.2`
+*
+* 读文件
+*
+* **示例代码**
+*
+* ```js
+const fs = wx.getFileSystemManager()
+const ab = new ArrayBuffer(1024)
+const fd = fs.openSync({
+ filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
+ flag: 'a+'
+})
+const res = fs.readSync({
+ fd: fd,
+ arrayBuffer: ab,
+ length: 10
+})
+console.log(res)
+```
+* ## 注意事项
+* - 小游戏 iOS 高性能模式(iOSHighPerformance)暂不支持 FileSystemManager.readSync 接口,请使用 FileSystemManager.readFileSync 接口代替 */
+ readSync(option: ReadSyncOption): ReadResult
+ /** [[Stats](https://developers.weixin.qq.com/miniprogram/dev/api/file/Stats.html) FileSystemManager.fstatSync(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.fstatSync.html)
+*
+* 需要基础库: `2.16.1`
+*
+* 在插件中使用:需要基础库 `2.19.2`
+*
+* 同步获取文件的状态信息
+*
+* **示例代码**
+*
+* ```js
+const fs = wx.getFileSystemManager()
+const fd = fs.openSync({
+ filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
+ flag: 'a+'
+})
+const stats = fs.fstatSync({fd: fd})
+console.log(stats)
+``` */
+ fstatSync(option: FstatSyncOption): Stats
+ /** [[Stats](https://developers.weixin.qq.com/miniprogram/dev/api/file/Stats.html)|Array.<[FileStats](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileStats.html)> FileSystemManager.statSync(string path, boolean recursive)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.statSync.html)
+ *
+ * 在插件中使用:需要基础库 `2.19.2`
*
* [FileSystemManager.stat](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.stat.html) 的同步版本 */
statSync(
/** 文件/目录路径 (本地路径) */
path: string,
- /** 是否递归获取目录下的每个文件的 Stats 信息
+ /** 需要基础库: `2.3.0`
*
- * 最低基础库: `2.3.0` */
+ * 是否递归获取目录下的每个文件的 Stats 信息 */
recursive?: boolean
- ): Stats | IAnyObject
+ ): Stats | FileStats[]
+ /** [[WriteResult](https://developers.weixin.qq.com/miniprogram/dev/api/file/WriteResult.html) FileSystemManager.writeSync(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.writeSync.html)
+*
+* 需要基础库: `2.16.1`
+*
+* 在插件中使用:需要基础库 `2.19.2`
+*
+* 同步写入文件
+*
+* **示例代码**
+*
+* ```js
+const fs = wx.getFileSystemManager()
+const fd = fs.openSync({
+ filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
+ flag: 'a+'
+})
+const res = fs.writeSync({
+ fd: fd,
+ data: 'some text'
+})
+console.log(res.bytesWritten)
+``` */
+ writeSync(option: WriteSyncOption): WriteResult
+ /** [string FileSystemManager.openSync(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.openSync.html)
+*
+* 需要基础库: `2.16.1`
+*
+* 在插件中使用:需要基础库 `2.19.2`
+*
+* 同步打开文件,返回文件描述符
+*
+* **示例代码**
+*
+* ```js
+const fs = wx.getFileSystemManager()
+const fd = fs.openSync({
+ filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
+ flag: 'a+'
+})
+console.log(fd)
+``` */
+ openSync(option: OpenSyncOption): string
/** [string FileSystemManager.saveFileSync(string tempFilePath, string filePath)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.saveFileSync.html)
+ *
+ * 在插件中使用:不支持
*
* [FileSystemManager.saveFile](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.saveFile.html) 的同步版本 */
saveFileSync(
@@ -9161,8 +17614,35 @@ this.editorCtx.insertImage({
filePath?: string
): string
/** [string|ArrayBuffer FileSystemManager.readFileSync(string filePath, string encoding, number position, number length)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readFileSync.html)
- *
- * [FileSystemManager.readFile](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readFile.html) 的同步版本 */
+*
+* 在插件中使用:需要基础库 `2.19.2`
+*
+* [FileSystemManager.readFile](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readFile.html) 的同步版本
+*
+* **示例代码**
+*
+* ```js
+const fs = wx.getFileSystemManager()
+fs.readFile({
+ filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
+ encoding: 'utf8',
+ position: 0,
+ success(res) {
+ console.log(res.data)
+ },
+ fail(res) {
+ console.error(res)
+ }
+})
+
+// 同步接口
+try {
+ const res = fs.readFileSync(`${wx.env.USER_DATA_PATH}/hello.txt`, 'utf8', 0)
+ console.log(res)
+} catch(e) {
+ console.error(e)
+}
+``` */
readFileSync(
/** 要读取的文件的路径 (本地路径) */
filePath: string,
@@ -9192,242 +17672,263 @@ this.editorCtx.insertImage({
| 'utf-8'
| 'utf8'
| 'latin1',
- /** 从文件指定位置开始读,如果不指定,则从文件头开始读。读取的范围应该是左闭右开区间 [position, position+length)。有效范围:[0, fileLength - 1]。单位:byte
+ /** 需要基础库: `2.10.0`
*
- * 最低基础库: `2.10.0` */
+ * 从文件指定位置开始读,如果不指定,则从文件头开始读。读取的范围应该是左闭右开区间 [position, position+length)。有效范围:[0, fileLength - 1]。单位:byte */
position?: number,
- /** 指定文件的长度,如果不指定,则读到文件末尾。有效范围:[1, fileLength]。单位:byte
+ /** 需要基础库: `2.10.0`
*
- * 最低基础库: `2.10.0` */
+ * 指定文件的长度,如果不指定,则读到文件末尾。有效范围:[1, fileLength]。单位:byte */
length?: number
): string | ArrayBuffer
+ /** [undefined FileSystemManager.closeSync(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.closeSync.html)
+*
+* 需要基础库: `2.16.1`
+*
+* 在插件中使用:需要基础库 `2.19.2`
+*
+* 同步关闭文件
+*
+* **示例代码**
+*
+* ```js
+const fs = wx.getFileSystemManager()
+const fd = fs.openSync({
+ filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
+ flag: 'a+'
+})
+
+// 关闭文件
+fs.closeSync({fd: fd})
+``` */
+ closeSync(option: CloseSyncOption): undefined
+ /** [undefined FileSystemManager.ftruncateSync(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.ftruncateSync.html)
+*
+* 需要基础库: `2.16.1`
+*
+* 在插件中使用:需要基础库 `2.19.2`
+*
+* 对文件内容进行截断操作
+*
+* **示例代码**
+*
+* ```js
+const fs = wx.getFileSystemManager()
+const fd = fs.openSync({
+ filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
+ flag: 'a+'
+})
+fs.ftruncateSync({
+ fd: fd,
+ length: 10 // 从第10个字节开始截断文件
+})
+``` */
+ ftruncateSync(option: FtruncateSyncOption): undefined
+ /** [undefined FileSystemManager.truncateSync(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.truncateSync.html)
+*
+* 需要基础库: `2.16.1`
+*
+* 在插件中使用:需要基础库 `2.19.2`
+*
+* 对文件内容进行截断操作 (truncate 的同步版本)
+*
+* **示例代码**
+*
+* ```js
+const fs = wx.getFileSystemManager()
+fs.truncateSync({
+ filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
+ length: 10, // 从第10个字节开始截断
+})
+``` */
+ truncateSync(option: TruncateSyncOption): undefined
}
- interface GeneralCallbackResult {
- errMsg: string
- }
- interface IBeaconError {
+ interface GetGroupEnterInfoError {
/** 错误信息
*
* | 错误码 | 错误信息 | 说明 |
* | - | - | - |
- * | 0 | ok | 正常 |
- * | 11000 | unsupport | 系统或设备不支持 |
- * | 11001 | bluetooth service unavailable | 蓝牙服务不可用 |
- * | 11002 | location service unavailable | 位置服务不可用 |
- * | 11003 | already start | 已经开始搜索 |
- * | 11004 | not startBeaconDiscovery | 还未开始搜索 |
- * | 11005 | system error | 系统错误 |
- * | 11006 | invalid data | 参数不正确 | */ errMsg: string
+ * | 40097 | | 场景错误 |
+ * | 65206 | | 用户已不在该群内 | */ errMsg: string
/** 错误码
*
* | 错误码 | 错误信息 | 说明 |
* | - | - | - |
- * | 0 | ok | 正常 |
- * | 11000 | unsupport | 系统或设备不支持 |
- * | 11001 | bluetooth service unavailable | 蓝牙服务不可用 |
- * | 11002 | location service unavailable | 位置服务不可用 |
- * | 11003 | already start | 已经开始搜索 |
- * | 11004 | not startBeaconDiscovery | 还未开始搜索 |
- * | 11005 | system error | 系统错误 |
- * | 11006 | invalid data | 参数不正确 | */ errCode: number
+ * | 40097 | | 场景错误 |
+ * | 65206 | | 用户已不在该群内 | */ errCode: number
}
- interface InnerAudioContext {
- /** [InnerAudioContext.destroy()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.destroy.html)
- *
- * 销毁当前实例 */
+ interface InferenceSession {
+ /** [InferenceSession.destroy()](https://developers.weixin.qq.com/miniprogram/dev/api/ai/inference/InferenceSession.destroy.html)
+*
+* 需要基础库: `2.30.0`
+*
+* 在插件中使用:需要基础库 `2.30.0`
+*
+* 销毁 InferenceSession 实例
+*
+* **示例代码**
+*
+* ```js
+// 销毁会话
+session.destroy()
+``` */
destroy(): void
- /** [InnerAudioContext.offCanplay(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offCanplay.html)
+ /** [InferenceSession.offError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/inference/InferenceSession.offError.html)
*
- * 取消监听音频进入可以播放状态的事件
+ * 需要基础库: `2.30.0`
*
- * 最低基础库: `1.9.0` */
- offCanplay(
- /** 音频进入可以播放状态的事件的回调函数 */
- callback?: OffCanplayCallback
- ): void
- /** [InnerAudioContext.offEnded(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offEnded.html)
+ * 在插件中使用:需要基础库 `2.30.0`
*
- * 取消监听音频自然播放至结束的事件
- *
- * 最低基础库: `1.9.0` */
- offEnded(
- /** 音频自然播放至结束的事件的回调函数 */
- callback?: OffEndedCallback
- ): void
- /** [InnerAudioContext.offError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offError.html)
- *
- * 取消监听音频播放错误事件
- *
- * 最低基础库: `1.9.0` */
+ * 取消监听模型加载失败事件 */
offError(
- /** 音频播放错误事件的回调函数 */
- callback?: InnerAudioContextOffErrorCallback
+ /** 模型加载失败回调函数。传入指定回调函数则只取消指定回调,不传则取消所有回调 */
+ callback: (...args: any[]) => any
): void
- /** [InnerAudioContext.offPause(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offPause.html)
+ /** [InferenceSession.offLoad(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/inference/InferenceSession.offLoad.html)
*
- * 取消监听音频暂停事件
+ * 需要基础库: `2.30.0`
*
- * 最低基础库: `1.9.0` */
- offPause(
- /** 音频暂停事件的回调函数 */
- callback?: OffPauseCallback
+ * 在插件中使用:需要基础库 `2.30.0`
+ *
+ * 取消监听模型加载完成事件 */
+ offLoad(
+ /** 模型加载完成回调函数。传入指定回调函数则只取消指定回调,不传则取消所有回调 */
+ callback: (...args: any[]) => any
): void
- /** [InnerAudioContext.offPlay(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offPlay.html)
- *
- * 取消监听音频播放事件
- *
- * 最低基础库: `1.9.0` */
- offPlay(
- /** 音频播放事件的回调函数 */
- callback?: OffPlayCallback
- ): void
- /** [InnerAudioContext.offSeeked(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offSeeked.html)
- *
- * 取消监听音频完成跳转操作的事件
- *
- * 最低基础库: `1.9.0` */
- offSeeked(
- /** 音频完成跳转操作的事件的回调函数 */
- callback?: OffSeekedCallback
- ): void
- /** [InnerAudioContext.offSeeking(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offSeeking.html)
- *
- * 取消监听音频进行跳转操作的事件
- *
- * 最低基础库: `1.9.0` */
- offSeeking(
- /** 音频进行跳转操作的事件的回调函数 */
- callback?: OffSeekingCallback
- ): void
- /** [InnerAudioContext.offStop(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offStop.html)
- *
- * 取消监听音频停止事件
- *
- * 最低基础库: `1.9.0` */
- offStop(
- /** 音频停止事件的回调函数 */
- callback?: OffStopCallback
- ): void
- /** [InnerAudioContext.offTimeUpdate(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offTimeUpdate.html)
- *
- * 取消监听音频播放进度更新事件
- *
- * 最低基础库: `1.9.0` */
- offTimeUpdate(
- /** 音频播放进度更新事件的回调函数 */
- callback?: OffTimeUpdateCallback
- ): void
- /** [InnerAudioContext.offWaiting(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offWaiting.html)
- *
- * 取消监听音频加载中事件
- *
- * 最低基础库: `1.9.0` */
- offWaiting(
- /** 音频加载中事件的回调函数 */
- callback?: OffWaitingCallback
- ): void
- /** [InnerAudioContext.onCanplay(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onCanplay.html)
- *
- * 监听音频进入可以播放状态的事件。但不保证后面可以流畅播放 */
- onCanplay(
- /** 音频进入可以播放状态的事件的回调函数 */
- callback: OnCanplayCallback
- ): void
- /** [InnerAudioContext.onEnded(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onEnded.html)
- *
- * 监听音频自然播放至结束的事件 */
- onEnded(
- /** 音频自然播放至结束的事件的回调函数 */
- callback: OnEndedCallback
- ): void
- /** [InnerAudioContext.onError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onError.html)
- *
- * 监听音频播放错误事件
- *
- * **Tips**
- *
- *
- * 1. errCode=100001 时,如若 errMsg 中有 INNERCODE -11828 ,请先检查 response header 是否缺少 Content-Length
- * 2. errCode=100001 时,如若 errMsg 中有 systemErrCode:200333420,请检查文件编码格式和 fileExtension 是否一致 */
+ /** [InferenceSession.onError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/inference/InferenceSession.onError.html)
+*
+* 需要基础库: `2.30.0`
+*
+* 在插件中使用:需要基础库 `2.30.0`
+*
+* 监听模型加载失败事件
+*
+* **示例代码**
+*
+* ```js
+// 创建会话,加载模型
+const session = wx.createInferenceSession({
+ model: `${wx.env.USER_DATA_PATH}/MNIST.onnx`,
+ precisionLevel: 4,
+ typicalShape:{input1:[1, 3, 224, 224], input2:[1, 1, 224, 224]}, //除非使用动态轴,一般不用显式指定
+ allowNPU: false,
+ allowQuantize: false
+})
+
+// 监听error事件
+session.onError(err => {
+ console.error(err)
+})
+``` */
onError(
- /** 音频播放错误事件的回调函数 */
- callback: InnerAudioContextOnErrorCallback
+ /** 模型加载失败回调函数 */
+ callback: (...args: any[]) => any
): void
- /** [InnerAudioContext.onPause(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onPause.html)
- *
- * 监听音频暂停事件 */
- onPause(
- /** 音频暂停事件的回调函数 */
- callback: OnPauseCallback
+ /** [InferenceSession.onLoad(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/inference/InferenceSession.onLoad.html)
+*
+* 需要基础库: `2.30.0`
+*
+* 在插件中使用:需要基础库 `2.30.0`
+*
+* 监听模型加载完成事件
+*
+* **示例代码**
+*
+* ```js
+// 创建会话,加载模型
+const session = wx.createInferenceSession({
+ model: `${wx.env.USER_DATA_PATH}/MNIST.onnx`,
+ precisionLevel: 4,
+ typicalShape:{input1:[1, 3, 224, 224], input2:[1, 1, 224, 224]}, //除非使用动态轴,一般不用显式指定
+ allowNPU: false,
+ allowQuantize: false
+})
+
+// 监听模型加载完成事件
+session.onLoad(() => {
+ // 运行推理
+ // 其中input1, input2, output0 必须与使用的onnx模型中实际的输入输出名字完全一致,不可随意填写。
+ // 模型输入输出信息可以通过Netron 打开onnx模型看到
+ session.run({
+ input1: {
+ type: 'float32',
+ data: new Float32Array(3 * 224 * 224).buffer,
+ shape: [1, 3, 224, 224] // NCHW 顺序
+ },
+ // 多个input的添加方法,假设第二个input需要数据类型为uint8
+ input2: {
+ type: 'uint8',
+ data: new Uint8Array(224 * 224).buffer,
+ shape: [1, 1, 224, 224]
+ },
+ }).then(res => {
+ console.log(res.output0)
+ })
+})
+``` */
+ onLoad(
+ /** 模型加载完成回调函数 */
+ callback: (...args: any[]) => any
): void
- /** [InnerAudioContext.onPlay(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onPlay.html)
- *
- * 监听音频播放事件 */
- onPlay(
- /** 音频播放事件的回调函数 */
- callback: OnPlayCallback
- ): void
- /** [InnerAudioContext.onSeeked(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onSeeked.html)
- *
- * 监听音频完成跳转操作的事件 */
- onSeeked(
- /** 音频完成跳转操作的事件的回调函数 */
- callback: OnSeekedCallback
- ): void
- /** [InnerAudioContext.onSeeking(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onSeeking.html)
- *
- * 监听音频进行跳转操作的事件 */
- onSeeking(
- /** 音频进行跳转操作的事件的回调函数 */
- callback: OnSeekingCallback
- ): void
- /** [InnerAudioContext.onStop(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onStop.html)
- *
- * 监听音频停止事件 */
- onStop(
- /** 音频停止事件的回调函数 */
- callback: InnerAudioContextOnStopCallback
- ): void
- /** [InnerAudioContext.onTimeUpdate(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onTimeUpdate.html)
- *
- * 监听音频播放进度更新事件 */
- onTimeUpdate(
- /** 音频播放进度更新事件的回调函数 */
- callback: OnTimeUpdateCallback
- ): void
- /** [InnerAudioContext.onWaiting(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onWaiting.html)
- *
- * 监听音频加载中事件。当音频因为数据不足,需要停下来加载时会触发 */
- onWaiting(
- /** 音频加载中事件的回调函数 */
- callback: OnWaitingCallback
- ): void
- /** [InnerAudioContext.pause()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.pause.html)
- *
- * 暂停。暂停后的音频再播放会从暂停处开始播放 */
- pause(): void
- /** [InnerAudioContext.play()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.play.html)
- *
- * 播放 */
- play(): void
- /** [InnerAudioContext.seek(number position)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.seek.html)
- *
- * 跳转到指定位置 */
- seek(
- /** 跳转的时间,单位 s。精确到小数点后 3 位,即支持 ms 级别精确度 */
- position: number
- ): void
- /** [InnerAudioContext.stop()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.stop.html)
- *
- * 停止。停止后的音频再播放会从头开始播放。 */
- stop(): void
+ /** [Promise<[Tensors](https://developers.weixin.qq.com/miniprogram/dev/api/ai/inference/Tensors.html)> InferenceSession.run([Tensors](https://developers.weixin.qq.com/miniprogram/dev/api/ai/inference/Tensors.html) tensors)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/inference/InferenceSession.run.html)
+*
+* 需要基础库: `2.30.0`
+*
+* 在插件中使用:需要基础库 `2.30.0`
+*
+* 运行推断。需要在 session.onLoad 回调后使用。接口参数为 Tensors 对象,返回 Promise。一个 InferenceSession 被创建完成后可以重复多次调用 InferenceSession.run(), 直到调用 session.destroy() 进行销毁。
+*
+* **示例代码**
+*
+* ```js
+// 创建会话,加载模型
+const session = wx.createInferenceSession({
+ model: `${wx.env.USER_DATA_PATH}/MNIST.onnx`,
+ precisionLevel: 4,
+ typicalShape:{input1:[1, 3, 224, 224], input2:[1, 1, 224, 224]}, //除非使用动态轴,一般不用显式指定
+ allowNPU: false,
+ allowQuantize: false
+})
+
+// 监听模型加载完成事件
+session.onLoad(() => {
+ // 运行推理
+ // 其中input1, input2, output0 必须与使用的onnx模型中实际的输入输出名字完全一致,不可随意填写。
+ // 模型输入输出信息可以通过Netron 打开onnx模型看到
+ session.run({
+ input1: {
+ type: 'float32',
+ data: new Float32Array(3 * 224 * 224).buffer,
+ shape: [1, 3, 224, 224] // NCHW 顺序
+ },
+ // 多个input的添加方法,假设第二个input需要数据类型为uint8
+ input2: {
+ type: 'uint8',
+ data: new Uint8Array(224 * 224).buffer,
+ shape: [1, 1, 224, 224]
+ },
+ }).then(res => {
+ console.log(res.output0)
+ })
+})
+``` */
+ run(
+ /** [Tensors](https://developers.weixin.qq.com/miniprogram/dev/api/ai/inference/Tensors.html)
+ *
+ * key-value 形式的对象,对象的 key 会作为 input name,对象的 value 则是 Tensor。 Tensor 结构如下。 */
+ tensors: Tensors
+ ): Promise
}
interface IntersectionObserver {
/** [IntersectionObserver.disconnect()](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/IntersectionObserver.disconnect.html)
+ *
+ * 在插件中使用:支持
*
* 停止监听。回调函数将不再触发 */
disconnect(): void
/** [IntersectionObserver.observe(string targetSelector, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/IntersectionObserver.observe.html)
+ *
+ * 在插件中使用:支持
*
* 指定目标节点并开始监听相交状态变化情况 */
observe(
@@ -9437,6 +17938,8 @@ this.editorCtx.insertImage({
callback: IntersectionObserverObserveCallback
): void
/** [[IntersectionObserver](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/IntersectionObserver.html) IntersectionObserver.relativeTo(string selector, Object margins)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/IntersectionObserver.relativeTo.html)
+ *
+ * 在插件中使用:支持
*
* 使用选择器指定一个节点,作为参照区域之一。 */
relativeTo(
@@ -9447,11 +17950,12 @@ this.editorCtx.insertImage({
): IntersectionObserver
/** [[IntersectionObserver](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/IntersectionObserver.html) IntersectionObserver.relativeToViewport(Object margins)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/IntersectionObserver.relativeToViewport.html)
*
+* 在插件中使用:支持
+*
* 指定页面显示区域作为参照区域之一
*
* **示例代码**
*
-*
* 下面的示例代码中,如果目标节点(用选择器 .target-class 指定)进入显示区域以下 100px 时,就会触发回调函数。
* ```javascript
Page({
@@ -9475,47 +17979,84 @@ Page({
interface InterstitialAd {
/** [InterstitialAd.destroy()](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.destroy.html)
*
- * 销毁插屏广告实例。
+ * 需要基础库: `2.8.0`
*
- * 最低基础库: `2.8.0` */
+ * 在插件中使用:不支持
+ *
+ * 销毁插屏广告实例。 */
destroy(): void
- /** [InterstitialAd.offClose(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.offClose.html)
- *
- * 取消监听插屏广告关闭事件 */
+ /** [InterstitialAd.offClose(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.offClose.html)
+*
+* 在插件中使用:不支持
+*
+* 移除插屏广告关闭事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+InterstitialAd.onClose(listener)
+InterstitialAd.offClose(listener) // 需传入与监听时同一个的函数对象
+``` */
offClose(
- /** 插屏广告关闭事件的回调函数 */
- callback?: UDPSocketOffCloseCallback
+ /** onClose 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: UDPSocketOffCloseCallback
): void
- /** [InterstitialAd.offError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.offError.html)
- *
- * 取消监听插屏错误事件 */
+ /** [InterstitialAd.offError(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.offError.html)
+*
+* 在插件中使用:不支持
+*
+* 移除插屏错误事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+InterstitialAd.onError(listener)
+InterstitialAd.offError(listener) // 需传入与监听时同一个的函数对象
+``` */
offError(
- /** 插屏错误事件的回调函数 */
- callback?: InterstitialAdOffErrorCallback
+ /** onError 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: InterstitialAdOffErrorCallback
): void
- /** [InterstitialAd.offLoad(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.offLoad.html)
- *
- * 取消监听插屏广告加载事件 */
+ /** [InterstitialAd.offLoad(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.offLoad.html)
+*
+* 在插件中使用:不支持
+*
+* 移除插屏广告加载事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+InterstitialAd.onLoad(listener)
+InterstitialAd.offLoad(listener) // 需传入与监听时同一个的函数对象
+``` */
offLoad(
- /** 插屏广告加载事件的回调函数 */
- callback?: OffLoadCallback
+ /** onLoad 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffLoadCallback
): void
- /** [InterstitialAd.onClose(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.onClose.html)
+ /** [InterstitialAd.onClose(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.onClose.html)
+ *
+ * 在插件中使用:不支持
*
* 监听插屏广告关闭事件。 */
onClose(
- /** 插屏广告关闭事件的回调函数 */
- callback: UDPSocketOnCloseCallback
+ /** 插屏广告关闭事件的监听函数 */
+ listener: UDPSocketOnCloseCallback
): void
- /** [InterstitialAd.onError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.onError.html)
+ /** [InterstitialAd.onError(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.onError.html)
+ *
+ * 在插件中使用:不支持
*
* 监听插屏错误事件。
*
* **错误码信息与解决方案表**
*
- *
- * 错误码是通过onError获取到的错误信息。调试期间,可以通过异常返回来捕获信息。
- * 在小程序发布上线之后,如果遇到异常问题,可以在[“运维中心“](https://mp.weixin.qq.com/)里面搜寻错误日志,还可以针对异常返回加上适当的监控信息。
+ * 错误码是通过onError获取到的错误信息。调试期间,可以通过异常返回来捕获信息。可以针对异常返回加上适当的监控信息辅助排查现网情况。
*
* | 代码 | 异常情况 | 理由 | 解决方案 |
* | ------ | -------------- | --------------- | -------------------------- |
@@ -9526,32 +18067,37 @@ Page({
* | 1004 | 无适合的广告 | 广告不是每一次都会出现,这次没有出现可能是由于该用户不适合浏览广告 | 属于正常情况,且开发者需要针对这种情况做形态上的兼容。 |
* | 1005 | 广告组件审核中 | 你的广告正在被审核,无法展现广告 | 请前往mp.weixin.qq.com确认审核状态,且开发者需要针对这种情况做形态上的兼容。|
* | 1006 | 广告组件被驳回 | 你的广告审核失败,无法展现广告 | 请前往mp.weixin.qq.com确认审核状态,且开发者需要针对这种情况做形态上的兼容。|
- * | 1007 | 广告组件被驳回 | 你的广告能力已经被封禁,封禁期间无法展现广告 | 请前往mp.weixin.qq.com确认小程序广告封禁状态。 |
+ * | 1007 | 广告组件被封禁 | 你的广告能力已经被封禁,封禁期间无法展现广告 | 请前往mp.weixin.qq.com确认小程序广告封禁状态。 |
* | 1008 | 广告单元已关闭 | 该广告位的广告能力已经被关闭 | 请前往mp.weixin.qq.com重新打开对应广告位的展现。| */
onError(
- /** 插屏错误事件的回调函数 */
- callback: InterstitialAdOnErrorCallback
+ /** 插屏错误事件的监听函数 */
+ listener: InterstitialAdOnErrorCallback
): void
- /** [InterstitialAd.onLoad(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.onLoad.html)
+ /** [InterstitialAd.onLoad(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.onLoad.html)
+ *
+ * 在插件中使用:不支持
*
* 监听插屏广告加载事件。 */
onLoad(
- /** 插屏广告加载事件的回调函数 */
- callback: OnLoadCallback
+ /** 插屏广告加载事件的监听函数 */
+ listener: OnLoadCallback
): void
/** [Promise InterstitialAd.load()](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.load.html)
*
- * 加载插屏广告。
+ * 需要基础库: `2.8.0`
*
- * 最低基础库: `2.8.0` */
+ * 在插件中使用:不支持
+ *
+ * 加载插屏广告。 */
load(): Promise
/** [Promise InterstitialAd.show()](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.show.html)
+ *
+ * 在插件中使用:不支持
*
* 显示插屏广告。
*
* **错误码信息表**
*
- *
* 如果插屏广告显示失败,InterstitialAd.show() 方法会返回一个rejected Promise,开发者可以获取到错误码及对应的错误信息。
*
* | 代码 | 异常情况 | 理由 |
@@ -9566,47 +18112,99 @@ Page({
interface IsoDep {
/** [IsoDep.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.close.html)
*
- * 断开连接
+ * 需要基础库: `2.11.2`
*
- * 最低基础库: `2.11.2` */
+ * 在插件中使用:支持
+ *
+ * 断开连接 */
close(option?: NdefCloseOption): void
/** [IsoDep.connect(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.connect.html)
*
- * 连接 NFC 标签
+ * 需要基础库: `2.11.2`
*
- * 最低基础库: `2.11.2` */
- connect(option?: ConnectOption): void
+ * 在插件中使用:支持
+ *
+ * 连接 NFC 标签 */
+ connect(option?: NdefConnectOption): void
/** [IsoDep.getHistoricalBytes(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.getHistoricalBytes.html)
*
- * 获取复位信息
+ * 需要基础库: `2.11.2`
*
- * 最低基础库: `2.11.2` */
+ * 在插件中使用:支持
+ *
+ * 获取复位信息 */
getHistoricalBytes(option?: GetHistoricalBytesOption): void
/** [IsoDep.getMaxTransceiveLength(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.getMaxTransceiveLength.html)
*
- * 获取最大传输长度
+ * 需要基础库: `2.11.2`
*
- * 最低基础库: `2.11.2` */
+ * 在插件中使用:支持
+ *
+ * 获取最大传输长度 */
getMaxTransceiveLength(option?: GetMaxTransceiveLengthOption): void
/** [IsoDep.isConnected(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.isConnected.html)
*
- * 检查是否已连接
+ * 需要基础库: `2.11.2`
*
- * 最低基础库: `2.11.2` */
+ * 在插件中使用:支持
+ *
+ * @warning **该接口已废弃,连接状态开发者自行维护即可**
+ *
+ * 检查是否已连接 */
isConnected(option?: IsConnectedOption): void
/** [IsoDep.setTimeout(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.setTimeout.html)
*
- * 设置超时时间
+ * 需要基础库: `2.11.2`
*
- * 最低基础库: `2.11.2` */
+ * 在插件中使用:支持
+ *
+ * 设置超时时间 */
setTimeout(option: SetTimeoutOption): void
/** [IsoDep.transceive(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.transceive.html)
*
- * 发送数据
+ * 需要基础库: `2.11.2`
*
- * 最低基础库: `2.11.2` */
+ * 在插件中使用:支持
+ *
+ * 发送数据 */
transceive(option: TransceiveOption): void
}
+ interface Join1v1ChatError {
+ /** 错误信息
+ *
+ * | 错误码 | 错误信息 | 说明 |
+ * | - | - | - |
+ * | -20000 | not open 1v1 Chat | 未开通双人通话 |
+ * | -20001 | device not support | 当前设备不支持 |
+ * | -20002 | on call | 正在通话中 |
+ * | -20003 | occupied by other miniprogram | 其它小程序正在通话中 |
+ * | -30000 | system error | 内部系统错误 |
+ * | -30001 | wechat has no camera authorization | 微信缺失相机权限 |
+ * | -30002 | wechat has no record authorization | 微信缺失录音权限 |
+ * | -30003 | miniprogram has no record authorization | 小程序缺失录音权限 |
+ * | -30004 | miniprogram has no camera authorization | 小程序缺失相机权限 |
+ * | -1 | | 当前已在房间内 |
+ * | -2 | | 录音设备被占用,可能是当前正在使用微信内语音通话或系统通话 |
+ * | -3 | | 加入会话期间退出(可能是用户主动退出,或者退后台、来电等原因),因此加入失败 |
+ * | -1000 | | 系统错误 | */ errMsg: string
+ /** 错误码
+ *
+ * | 错误码 | 错误信息 | 说明 |
+ * | - | - | - |
+ * | -20000 | not open 1v1 Chat | 未开通双人通话 |
+ * | -20001 | device not support | 当前设备不支持 |
+ * | -20002 | on call | 正在通话中 |
+ * | -20003 | occupied by other miniprogram | 其它小程序正在通话中 |
+ * | -30000 | system error | 内部系统错误 |
+ * | -30001 | wechat has no camera authorization | 微信缺失相机权限 |
+ * | -30002 | wechat has no record authorization | 微信缺失录音权限 |
+ * | -30003 | miniprogram has no record authorization | 小程序缺失录音权限 |
+ * | -30004 | miniprogram has no camera authorization | 小程序缺失相机权限 |
+ * | -1 | | 当前已在房间内 |
+ * | -2 | | 录音设备被占用,可能是当前正在使用微信内语音通话或系统通话 |
+ * | -3 | | 加入会话期间退出(可能是用户主动退出,或者退后台、来电等原因),因此加入失败 |
+ * | -1000 | | 系统错误 | */ errCode: number
+ }
interface JoinVoIPChatError {
/** 错误信息
*
@@ -9626,147 +18224,373 @@ Page({
* | -1000 | 系统错误 | | */ errCode: number
}
interface LivePlayerContext {
+ /** [LivePlayerContext.exitBackgroundPlayback()](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.exitBackgroundPlayback.html)
+ *
+ * 需要基础库: `2.14.3`
+ *
+ * 在插件中使用:支持
+ *
+ * 退出后台音频播放模式。 */
+ exitBackgroundPlayback(): void
+ /** [LivePlayerContext.exitCasting(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.exitCasting.html)
+ *
+ * 需要基础库: `2.32.0`
+ *
+ * 在插件中使用:支持
+ *
+ * 退出投屏。仅支持在 tap 事件回调内调用。 */
+ exitCasting(option?: ExitCastingOption): void
/** [LivePlayerContext.exitFullScreen(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.exitFullScreen.html)
+ *
+ * 在插件中使用:支持
*
* 退出全屏 */
exitFullScreen(option?: ExitFullScreenOption): void
/** [LivePlayerContext.exitPictureInPicture(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.exitPictureInPicture.html)
+ *
+ * 在插件中使用:支持
*
* 退出小窗,该方法可在任意页面调用 */
exitPictureInPicture(option?: ExitPictureInPictureOption): void
/** [LivePlayerContext.mute(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.mute.html)
+ *
+ * 在插件中使用:支持
*
* 静音 */
mute(option?: MuteOption): void
/** [LivePlayerContext.pause(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.pause.html)
*
- * 暂停
+ * 需要基础库: `1.9.90`
*
- * 最低基础库: `1.9.90` */
+ * 在插件中使用:支持
+ *
+ * 暂停 */
pause(option?: PauseOption): void
/** [LivePlayerContext.play(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.play.html)
+ *
+ * 在插件中使用:支持
*
* 播放 */
play(option?: PlayOption): void
+ /** [LivePlayerContext.reconnectCasting(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.reconnectCasting.html)
+ *
+ * 需要基础库: `2.32.0`
+ *
+ * 在插件中使用:支持
+ *
+ * 重连投屏设备。仅支持在 tap 事件回调内调用。 */
+ reconnectCasting(option?: ReconnectCastingOption): void
+ /** [LivePlayerContext.requestBackgroundPlayback()](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.requestBackgroundPlayback.html)
+ *
+ * 需要基础库: `2.14.3`
+ *
+ * 在插件中使用:支持
+ *
+ * 进入后台音频播放模式。 */
+ requestBackgroundPlayback(): void
/** [LivePlayerContext.requestFullScreen(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.requestFullScreen.html)
+ *
+ * 在插件中使用:支持
*
* 进入全屏 */
requestFullScreen(
option: LivePlayerContextRequestFullScreenOption
): void
- /** [LivePlayerContext.requestPictureInPicture(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.requestPictureInPicture.html)
- *
- * 进入小窗
- *
- * 最低基础库: `2.15.0` */
- requestPictureInPicture(option?: RequestPictureInPictureOption): void
/** [LivePlayerContext.resume(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.resume.html)
*
- * 恢复
+ * 需要基础库: `1.9.90`
*
- * 最低基础库: `1.9.90` */
+ * 在插件中使用:支持
+ *
+ * 恢复 */
resume(option?: ResumeOption): void
/** [LivePlayerContext.snapshot(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.snapshot.html)
*
- * 截图
+ * 需要基础库: `2.7.1`
*
- * 最低基础库: `2.7.1` */
+ * 在插件中使用:支持
+ *
+ * 截图 */
snapshot(option: LivePlayerContextSnapshotOption): void
+ /** [LivePlayerContext.startCasting(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.startCasting.html)
+ *
+ * 需要基础库: `2.32.0`
+ *
+ * 在插件中使用:支持
+ *
+ * 开始投屏, 拉起半屏搜索设备。仅支持在 tap 事件回调内调用。 */
+ startCasting(option?: StartCastingOption): void
/** [LivePlayerContext.stop(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.stop.html)
+ *
+ * 在插件中使用:支持
*
* 停止 */
stop(option?: StopOption): void
+ /** [LivePlayerContext.switchCasting(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.switchCasting.html)
+ *
+ * 需要基础库: `2.32.0`
+ *
+ * 在插件中使用:支持
+ *
+ * 切换投屏设备。仅支持在 tap 事件回调内调用。 */
+ switchCasting(option?: SwitchCastingOption): void
}
interface LivePusherContext {
+ /** [LivePusherContext.applyBlusherStickMakeup(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.applyBlusherStickMakeup.html)
+ *
+ * 需要基础库: `2.14.0`
+ *
+ * 在插件中使用:不支持
+ *
+ * 添加腮红美妆特效 */
+ applyBlusherStickMakeup(option: ApplyBlusherStickMakeupOption): void
+ /** [LivePusherContext.applyEyeBrowMakeup(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.applyEyeBrowMakeup.html)
+ *
+ * 需要基础库: `2.14.0`
+ *
+ * 在插件中使用:不支持
+ *
+ * 添加眉毛美妆特效 */
+ applyEyeBrowMakeup(option: ApplyEyeBrowMakeupOption): void
+ /** [LivePusherContext.applyEyeShadowMakeup(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.applyEyeShadowMakeup.html)
+ *
+ * 需要基础库: `2.14.0`
+ *
+ * 在插件中使用:不支持
+ *
+ * 添加眼影美妆特效 */
+ applyEyeShadowMakeup(option: ApplyEyeShadowMakeupOption): void
+ /** [LivePusherContext.applyFaceContourMakeup(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.applyFaceContourMakeup.html)
+ *
+ * 需要基础库: `2.14.0`
+ *
+ * 在插件中使用:不支持
+ *
+ * 添加修容美妆特效 */
+ applyFaceContourMakeup(option: ApplyFaceContourMakeupOption): void
+ /** [LivePusherContext.applyFilter(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.applyFilter.html)
+ *
+ * 需要基础库: `2.14.0`
+ *
+ * 在插件中使用:不支持
+ *
+ * 添加滤镜效果 */
+ applyFilter(option: ApplyFilterOption): void
+ /** [LivePusherContext.applyLipStickMakeup(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.applyLipStickMakeup.html)
+ *
+ * 需要基础库: `2.14.0`
+ *
+ * 在插件中使用:不支持
+ *
+ * 添加口红美妆特效 */
+ applyLipStickMakeup(option: ApplyLipStickMakeupOption): void
+ /** [LivePusherContext.applySticker(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.applySticker.html)
+ *
+ * 需要基础库: `2.14.0`
+ *
+ * 在插件中使用:不支持
+ *
+ * 添加贴纸特效 */
+ applySticker(option: ApplyStickerOption): void
+ /** [LivePusherContext.clearFilters(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.clearFilters.html)
+ *
+ * 需要基础库: `2.14.0`
+ *
+ * 在插件中使用:不支持
+ *
+ * 清除所有滤镜效果 */
+ clearFilters(option?: ClearFiltersOption): void
+ /** [LivePusherContext.clearMakeups(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.clearMakeups.html)
+ *
+ * 需要基础库: `2.14.0`
+ *
+ * 在插件中使用:不支持
+ *
+ * 清除所有美妆特效 */
+ clearMakeups(option?: ClearMakeupsOption): void
+ /** [LivePusherContext.clearStickers(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.clearStickers.html)
+ *
+ * 需要基础库: `2.14.0`
+ *
+ * 在插件中使用:不支持
+ *
+ * 清除所有贴纸特效 */
+ clearStickers(option?: ClearStickersOption): void
+ /** [LivePusherContext.createOffscreenCanvas(object options)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.createOffscreenCanvas.html)
+ *
+ * 需要基础库: `2.29.0`
+ *
+ * 在插件中使用:支持
+ *
+ * 创建一个能够承接 LivePusher 采集纹理的离屏 Canvas,客户端 8.0.31 版本开始支持。 */
+ createOffscreenCanvas(
+ /** 同[wx.createOffscreenCanvas](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/wx.createOffscreenCanvas.html) */
+ options: IAnyObject
+ ): void
+ /** [LivePusherContext.exitPictureInPicture(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.exitPictureInPicture.html)
+ *
+ * 需要基础库: `2.25.0`
+ *
+ * 在插件中使用:支持
+ *
+ * 退出小窗,该方法可在任意页面调用 */
+ exitPictureInPicture(option?: ExitPictureInPictureOption): void
+ /** [LivePusherContext.getMaxZoom(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.getMaxZoom.html)
+ *
+ * 需要基础库: `2.31.0`
+ *
+ * 在插件中使用:支持
+ *
+ * 获取最大缩放级别 */
+ getMaxZoom(option?: GetMaxZoomOption): void
+ /** [LivePusherContext.onCustomRendererEvent(string event, function|function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.onCustomRendererEvent.html)
+ *
+ * 需要基础库: `2.29.0`
+ *
+ * 在插件中使用:支持
+ *
+ * 开启自定义渲染时,开发者通过此方法订阅相关事件,客户端 8.0.31 版本开始支持。 */
+ onCustomRendererEvent(
+ /** 事件类型,后订阅的监听器会取消之前的监听器
+ *
+ * 参数 event 可选值:
+ * - 'frame': 采集到视频帧后触发;
+ * - 'update': 推流尺寸变更时触发; */
+ event: 'frame' | 'update',
+ /** 自定义渲染事件处理回调函数 */
+ callback: CustomRendererFrameEventCallback
+ ): void
/** [LivePusherContext.pause(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.pause.html)
+ *
+ * 在插件中使用:支持
*
* 暂停推流 */
pause(option?: PauseOption): void
/** [LivePusherContext.pauseBGM(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.pauseBGM.html)
*
- * 暂停背景音
+ * 需要基础库: `2.4.0`
*
- * 最低基础库: `2.4.0` */
+ * 在插件中使用:支持
+ *
+ * 暂停背景音 */
pauseBGM(option?: PauseBGMOption): void
/** [LivePusherContext.playBGM(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.playBGM.html)
*
- * 播放背景音
+ * 需要基础库: `2.4.0`
*
- * 最低基础库: `2.4.0` */
+ * 在插件中使用:支持
+ *
+ * 播放背景音 */
playBGM(option: PlayBGMOption): void
/** [LivePusherContext.resume(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.resume.html)
+ *
+ * 在插件中使用:支持
*
* 恢复推流 */
resume(option?: ResumeOption): void
/** [LivePusherContext.resumeBGM(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.resumeBGM.html)
*
- * 恢复背景音
+ * 需要基础库: `2.4.0`
*
- * 最低基础库: `2.4.0` */
+ * 在插件中使用:支持
+ *
+ * 恢复背景音 */
resumeBGM(option?: ResumeBGMOption): void
/** [LivePusherContext.sendMessage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.sendMessage.html)
*
- * 发送SEI消息
+ * 需要基础库: `2.10.0`
*
- * 最低基础库: `2.10.0` */
- sendMessage(option?: SendMessageOption): void
+ * 在插件中使用:支持
+ *
+ * 发送SEI消息 */
+ sendMessage(option: SendMessageOption): void
/** [LivePusherContext.setBGMVolume(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.setBGMVolume.html)
*
- * 设置背景音音量
+ * 需要基础库: `2.4.0`
*
- * 最低基础库: `2.4.0` */
+ * 在插件中使用:支持
+ *
+ * 设置背景音音量 */
setBGMVolume(option: SetBGMVolumeOption): void
/** [LivePusherContext.setMICVolume(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.setMICVolume.html)
*
- * 设置麦克风音量
+ * 需要基础库: `2.10.0`
*
- * 最低基础库: `2.10.0` */
+ * 在插件中使用:支持
+ *
+ * 设置麦克风音量 */
setMICVolume(option: SetMICVolumeOption): void
+ /** [LivePusherContext.setZoom(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.setZoom.html)
+ *
+ * 需要基础库: `2.31.0`
+ *
+ * 在插件中使用:支持
+ *
+ * 设置缩放级别 */
+ setZoom(option: LivePusherContextSetZoomOption): void
/** [LivePusherContext.snapshot(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.snapshot.html)
*
- * 快照
+ * 需要基础库: `1.9.90`
*
- * 最低基础库: `1.9.90` */
+ * 在插件中使用:支持
+ *
+ * 快照 */
snapshot(option: LivePusherContextSnapshotOption): void
/** [LivePusherContext.start(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.start.html)
+ *
+ * 在插件中使用:支持
*
* 开始推流,同时开启摄像头预览 */
- start(option?: CameraFrameListenerStartOption): void
+ start(option?: LivePusherContextStartOption): void
/** [LivePusherContext.startPreview(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.startPreview.html)
*
- * 开启摄像头预览
+ * 需要基础库: `2.7.0`
*
- * 最低基础库: `2.7.0` */
+ * 在插件中使用:支持
+ *
+ * 开启摄像头预览 */
startPreview(option?: StartPreviewOption): void
/** [LivePusherContext.stop(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.stop.html)
+ *
+ * 在插件中使用:支持
*
* 停止推流,同时停止摄像头预览 */
stop(option?: StopOption): void
/** [LivePusherContext.stopBGM(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.stopBGM.html)
*
- * 停止背景音
+ * 需要基础库: `2.4.0`
*
- * 最低基础库: `2.4.0` */
+ * 在插件中使用:支持
+ *
+ * 停止背景音 */
stopBGM(option?: StopBGMOption): void
/** [LivePusherContext.stopPreview(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.stopPreview.html)
*
- * 关闭摄像头预览
+ * 需要基础库: `2.7.0`
*
- * 最低基础库: `2.7.0` */
+ * 在插件中使用:支持
+ *
+ * 关闭摄像头预览 */
stopPreview(option?: StopPreviewOption): void
/** [LivePusherContext.switchCamera(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.switchCamera.html)
+ *
+ * 在插件中使用:支持
*
* 切换前后摄像头 */
switchCamera(option?: SwitchCameraOption): void
/** [LivePusherContext.toggleTorch(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.toggleTorch.html)
*
- * 切换手电筒
+ * 需要基础库: `2.1.0`
*
- * 最低基础库: `2.1.0` */
+ * 在插件中使用:支持
+ *
+ * 切换手电筒 */
toggleTorch(option?: ToggleTorchOption): void
}
interface LogManager {
/** [LogManager.debug()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/LogManager.debug.html)
+ *
+ * 在插件中使用:不支持
*
* 写 debug 日志 */
debug(
@@ -9774,6 +18598,8 @@ Page({
...args: any[]
): void
/** [LogManager.info()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/LogManager.info.html)
+ *
+ * 在插件中使用:不支持
*
* 写 info 日志 */
info(
@@ -9781,6 +18607,8 @@ Page({
...args: any[]
): void
/** [LogManager.log()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/LogManager.log.html)
+ *
+ * 在插件中使用:不支持
*
* 写 log 日志 */
log(
@@ -9788,6 +18616,8 @@ Page({
...args: any[]
): void
/** [LogManager.warn()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/LogManager.warn.html)
+ *
+ * 在插件中使用:不支持
*
* 写 warn 日志 */
warn(
@@ -9796,95 +18626,169 @@ Page({
): void
}
interface MapContext {
+ /** [MapContext.addArc(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.addArc.html)
+ *
+ * 需要基础库: `2.22.0`
+ *
+ * 在插件中使用:支持
+ *
+ * 添加弧线,途经点与夹角必须设置一个。途经点必须在起终点有效坐标范围内,否则不能生成正确的弧线,同时设置夹角角度时,以夹角角度为准。夹角定义为起点到终点,与起点外切线逆时针旋转的角度。工具侧暂未支持。 */
+ addArc(option: AddArcOption): void
/** [MapContext.addCustomLayer(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.addCustomLayer.html)
*
- * 添加个性化图层。
+ * 需要基础库: `2.12.0`
*
- * 最低基础库: `2.12.0` */
+ * 在插件中使用:支持
+ *
+ * 添加个性化图层。图层创建[参考文档](https://lbs.qq.com/dev/console/customLayer/create) */
addCustomLayer(option: AddCustomLayerOption): void
/** [MapContext.addGroundOverlay(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.addGroundOverlay.html)
*
- * 创建自定义图片图层,图片会随着地图缩放而缩放。
+ * 需要基础库: `2.14.0`
*
- * 最低基础库: `2.14.0` */
+ * 在插件中使用:支持
+ *
+ * 创建自定义图片图层,图片会随着地图缩放而缩放。 */
addGroundOverlay(option: AddGroundOverlayOption): void
/** [MapContext.addMarkers(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.addMarkers.html)
*
- * 添加 marker。
+ * 需要基础库: `2.13.0`
*
- * 最低基础库: `2.13.0` */
+ * 在插件中使用:支持
+ *
+ * 添加 marker。 */
addMarkers(option: AddMarkersOption): void
+ /** [MapContext.addVisualLayer(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.addVisualLayer.html)
+ *
+ * 需要基础库: `2.20.1`
+ *
+ * 在插件中使用:支持
+ *
+ * 添加可视化图层。需要刷新时,interval 可设置的最小值为 15 s。 */
+ addVisualLayer(option: AddVisualLayerOption): void
+ /** [MapContext.eraseLines(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.eraseLines.html)
+ *
+ * 需要基础库: `2.5.0`
+ *
+ * 在插件中使用:支持
+ *
+ * 擦除或置灰已添加到地图中的线段。 */
+ eraseLines(option: EraseLinesOption): void
+ /** [MapContext.executeVisualLayerCommand(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.executeVisualLayerCommand.html)
+ *
+ * 需要基础库: `2.26.0`
+ *
+ * 在插件中使用:支持
+ *
+ * 执行可视化图层指令,结合 `MapContext.on('visualLayerEvent')` 监听事件使用。 */
+ executeVisualLayerCommand(option: ExecuteVisualLayerCommandOption): void
/** [MapContext.fromScreenLocation(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.fromScreenLocation.html)
*
- * 获取屏幕上的点对应的经纬度,坐标原点为地图左上角。
+ * 需要基础库: `2.14.0`
*
- * 最低基础库: `2.14.0` */
+ * 在插件中使用:支持
+ *
+ * 获取屏幕上的点对应的经纬度,坐标原点为地图左上角。 */
fromScreenLocation(option: FromScreenLocationOption): void
/** [MapContext.getCenterLocation(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.getCenterLocation.html)
+ *
+ * 在插件中使用:支持
*
* 获取当前地图中心的经纬度。返回的是 gcj02 坐标系,可以用于 [wx.openLocation()](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.openLocation.html) */
- getCenterLocation(option?: GetCenterLocationOption): void
+ getCenterLocation(option: GetCenterLocationOption): void
/** [MapContext.getRegion(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.getRegion.html)
*
- * 获取当前地图的视野范围
+ * 需要基础库: `1.4.0`
*
- * 最低基础库: `1.4.0` */
+ * 在插件中使用:支持
+ *
+ * 获取当前地图的视野范围 */
getRegion(option?: GetRegionOption): void
/** [MapContext.getRotate(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.getRotate.html)
*
- * 获取当前地图的旋转角
+ * 需要基础库: `2.8.0`
*
- * 最低基础库: `2.8.0` */
+ * 在插件中使用:支持
+ *
+ * 获取当前地图的旋转角 */
getRotate(option?: GetRotateOption): void
/** [MapContext.getScale(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.getScale.html)
*
- * 获取当前地图的缩放级别
+ * 需要基础库: `1.4.0`
*
- * 最低基础库: `1.4.0` */
+ * 在插件中使用:支持
+ *
+ * 获取当前地图的缩放级别 */
getScale(option?: GetScaleOption): void
/** [MapContext.getSkew(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.getSkew.html)
*
- * 获取当前地图的倾斜角
+ * 需要基础库: `2.8.0`
*
- * 最低基础库: `2.8.0` */
+ * 在插件中使用:支持
+ *
+ * 获取当前地图的倾斜角 */
getSkew(option?: GetSkewOption): void
/** [MapContext.includePoints(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.includePoints.html)
*
- * 缩放视野展示所有经纬度
+ * 需要基础库: `1.2.0`
*
- * 最低基础库: `1.2.0` */
+ * 在插件中使用:支持
+ *
+ * 缩放视野展示所有经纬度 */
includePoints(option: IncludePointsOption): void
/** [MapContext.initMarkerCluster(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.initMarkerCluster.html)
*
- * 初始化点聚合的配置,未调用时采用默认配置。
+ * 需要基础库: `2.13.0`
*
- * 最低基础库: `2.13.0` */
+ * 在插件中使用:支持
+ *
+ * 初始化点聚合的配置,未调用时采用默认配置。 */
initMarkerCluster(option: InitMarkerClusterOption): void
/** [MapContext.moveAlong(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.moveAlong.html)
*
- * 沿指定路径移动 `marker`,用于轨迹回放等场景。动画完成时触发回调事件,若动画进行中,对同一 `marker` 再次调用 `moveAlong` 方法,前一次的动画将被打断。
+ * 需要基础库: `2.13.0`
*
- * 最低基础库: `2.13.0` */
+ * 在插件中使用:支持
+ *
+ * 沿指定路径移动 `marker`,用于轨迹回放等场景。动画完成时触发回调事件,若动画进行中,对同一 `marker` 再次调用 `moveAlong` 方法,前一次的动画将被打断。 */
moveAlong(option: MoveAlongOption): void
/** [MapContext.moveToLocation(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.moveToLocation.html)
*
- * 将地图中心移置当前定位点,此时需设置地图组件 show-location 为true。[2.8.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起支持将地图中心移动到指定位置。
+ * 需要基础库: `1.2.0`
*
- * 最低基础库: `1.2.0` */
+ * 在插件中使用:支持
+ *
+ * 将地图中心移置当前定位点,此时需设置地图组件 show-location 为true。[2.8.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起支持将地图中心移动到指定位置。 */
moveToLocation(option?: MoveToLocationOption): void
/** [MapContext.on(string event, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.on.html)
*
+* 需要基础库: `2.13.0`
+*
+* 在插件中使用:支持
+*
* 监听地图事件。
*
+* ### visualLayerEvent
+*
+* 可视化图层 visualLayer 统一回调出口,[2.26.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起支持。
+*
+* #### 返回参数
+*
+* | 参数 | 类型 | 说明 |
+* | --------- | ------ | -------- |
+* | layerId | String | 图层 id |
+* | eventType | String | 事件类型 |
+* | eventInfo | String | 事件信息 |
+*
* ### markerClusterCreate
*
* 缩放或拖动导致新的聚合簇产生时触发,仅返回新创建的聚合簇信息。
*
* #### 返回参数
*
-* | 参数 | 类型 | 说明 |
-* | --------- | ------ | --------- |
-* | clusters | `Array<ClusterInfo>` | 聚合簇数据 |
+* | 参数 | 类型 | 说明 |
+* | -------- | -------------------- | ---------- |
+* | clusters | `Array` | 聚合簇数据 |
*
* ### markerClusterClick
*
@@ -9896,122 +18800,155 @@ Page({
* | --------- | ------------- | --------- |
* | cluster | ClusterInfo | 聚合簇 |
*
-*
* #### ClusterInfo 结构
*
-* | 参数 | 类型 | 说明 |
-* | ---------- | -------------------- | -------------------------- |
-* | clusterId | Number | 聚合簇的 id |
-* | center | LatLng | 聚合簇的坐标 |
-* | markerIds | `Array<Number>` | 该聚合簇内的点标记数据数组 |
+* | 参数 | 类型 | 说明 |
+* | --------- | --------------- | -------------------------- |
+* | clusterId | Number | 聚合簇的 id |
+* | center | LatLng | 聚合簇的坐标 |
+* | markerIds | `Array` | 该聚合簇内的点标记数据数组 |
+*
+* ### markerCollisionStatusChange
+*
+* marker 参与碰撞后隐藏时的回调,[3.4.3](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起支持。
+*
+* #### 返回参数
+*
+* | 参数 | 类型 | 说明 |
+* | --------- | ------ | -------- |
+* | show | `Array` | 碰撞时隐藏后又显示的 `markerIds` |
+* | hide | `Array` | 碰撞时被隐藏的 `markerIds` |
*
* **示例代码**
*
-*
-*
* ```js
+ MapContext.on('visualLayerEvent', (res) => {})
MapContext.on('markerClusterCreate', (res) => {})
MapContext.on('markerClusterClick', (res) => {})
-```
-*
-* 最低基础库: `2.13.0` */
+ MapContext.on('markerCollisionStatusChange', (res) => {})
+``` */
on(
/** 事件名
*
* 参数 event 可选值:
* - 'markerClusterCreate': ;
- * - 'markerClusterClick': ; */
- event: 'markerClusterCreate' | 'markerClusterClick',
+ * - 'markerClusterClick': ;
+ * - 'visualLayerEvent': ;
+ * - 'markerCollisionStatusChange': ; */
+ event:
+ | 'markerClusterCreate'
+ | 'markerClusterClick'
+ | 'visualLayerEvent'
+ | 'markerCollisionStatusChange',
/** 事件的回调函数 */
callback: (...args: any[]) => any
): void
/** [MapContext.openMapApp(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.openMapApp.html)
*
- * 拉起地图APP选择导航。
+ * 需要基础库: `2.14.0`
*
- * 最低基础库: `2.14.0` */
+ * 在插件中使用:支持
+ *
+ * 拉起地图APP选择导航。 */
openMapApp(option: OpenMapAppOption): void
+ /** [MapContext.removeArc(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.removeArc.html)
+ *
+ * 需要基础库: `2.22.0`
+ *
+ * 在插件中使用:支持
+ *
+ * 删除弧线。工具侧暂未支持。 */
+ removeArc(option: RemoveArcOption): void
/** [MapContext.removeCustomLayer(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.removeCustomLayer.html)
*
- * 移除个性化图层。
+ * 需要基础库: `2.12.0`
*
- * 最低基础库: `2.12.0` */
+ * 在插件中使用:支持
+ *
+ * 移除个性化图层。 */
removeCustomLayer(option: RemoveCustomLayerOption): void
/** [MapContext.removeGroundOverlay(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.removeGroundOverlay.html)
*
- * 移除自定义图片图层。
+ * 需要基础库: `2.14.0`
*
- * 最低基础库: `2.14.0` */
+ * 在插件中使用:支持
+ *
+ * 移除自定义图片图层。 */
removeGroundOverlay(option: RemoveGroundOverlayOption): void
/** [MapContext.removeMarkers(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.removeMarkers.html)
*
- * 移除 marker。
+ * 需要基础库: `2.13.0`
*
- * 最低基础库: `2.13.0` */
+ * 在插件中使用:支持
+ *
+ * 移除 marker。 */
removeMarkers(option: RemoveMarkersOption): void
+ /** [MapContext.removeVisualLayer(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.removeVisualLayer.html)
+ *
+ * 需要基础库: `2.20.1`
+ *
+ * 在插件中使用:支持
+ *
+ * 移除可视化图层。 */
+ removeVisualLayer(option: RemoveVisualLayerOption): void
+ /** [MapContext.setBoundary(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.setBoundary.html)
+ *
+ * 需要基础库: `2.22.0`
+ *
+ * 在插件中使用:支持
+ *
+ * 限制地图的显示范围。此接口同时会限制地图的最小缩放整数级别。 */
+ setBoundary(option: SetBoundaryOption): void
/** [MapContext.setCenterOffset(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.setCenterOffset.html)
*
- * 设置地图中心点偏移,向后向下为增长,屏幕比例范围(0.25~0.75),默认偏移为[0.5, 0.5]
+ * 需要基础库: `2.10.0`
*
- * 最低基础库: `2.10.0` */
+ * 在插件中使用:支持
+ *
+ * 设置地图中心点偏移,向后向下为增长,屏幕比例范围(0.25~0.75),默认偏移为[0.5, 0.5] */
setCenterOffset(option: SetCenterOffsetOption): void
+ /** [MapContext.setLocMarkerIcon(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.setLocMarkerIcon.html)
+ *
+ * 需要基础库: `2.16.0`
+ *
+ * 在插件中使用:支持
+ *
+ * 设置定位点图标,支持网络路径、本地路径、代码包路径 */
+ setLocMarkerIcon(option: SetLocMarkerIconOption): void
/** [MapContext.toScreenLocation(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.toScreenLocation.html)
*
- * 获取经纬度对应的屏幕坐标,坐标原点为地图左上角。
+ * 需要基础库: `2.14.0`
*
- * 最低基础库: `2.14.0` */
+ * 在插件中使用:支持
+ *
+ * 获取经纬度对应的屏幕坐标,坐标原点为地图左上角。 */
toScreenLocation(option: ToScreenLocationOption): void
/** [MapContext.translateMarker(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.translateMarker.html)
*
- * 平移marker,带动画。
+ * 需要基础库: `1.2.0`
*
- * 最低基础库: `1.2.0` */
+ * 在插件中使用:支持
+ * @deprecated 基础库版本 [3.11.2](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [建议使用 [MapContext.moveAlong](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.html)]((建议使用 [MapContext.moveAlong](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.html))) 替换
+ *
+ * 平移marker,带动画。 */
translateMarker(option: TranslateMarkerOption): void
/** [MapContext.updateGroundOverlay(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.updateGroundOverlay.html)
*
- * 更新自定义图片图层。
+ * 需要基础库: `2.14.0`
*
- * 最低基础库: `2.14.0` */
+ * 在插件中使用:支持
+ *
+ * 更新自定义图片图层。 */
updateGroundOverlay(option: UpdateGroundOverlayOption): void
}
- interface MediaAudioPlayer {
- /** [Promise MediaAudioPlayer.addAudioSource([VideoDecoder](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.html) source)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/MediaAudioPlayer.addAudioSource.html)
- *
- * 添加音频源 */
- addAudioSource(
- /** [VideoDecoder](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.html)
- *
- * 视频解码器实例。作为音频源添加到音频播放器中 */
- source: VideoDecoder
- ): Promise
- /** [Promise MediaAudioPlayer.destroy()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/MediaAudioPlayer.destroy.html)
- *
- * 销毁播放器 */
- destroy(): Promise
- /** [Promise MediaAudioPlayer.removeAudioSource([VideoDecoder](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.html) source)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/MediaAudioPlayer.removeAudioSource.html)
- *
- * 移除音频源 */
- removeAudioSource(
- /** [VideoDecoder](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.html)
- *
- * 视频解码器实例 */
- source: VideoDecoder
- ): Promise
- /** [Promise MediaAudioPlayer.start()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/MediaAudioPlayer.start.html)
- *
- * 启动播放器 */
- start(): Promise
- /** [Promise MediaAudioPlayer.stop()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/MediaAudioPlayer.stop.html)
- *
- * 停止播放器 */
- stop(): Promise
- }
interface MediaContainer {
/** [MediaContainer.addTrack([MediaTrack](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaTrack.html) track)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaContainer.addTrack.html)
*
- * 将音频或视频轨道添加到容器
+ * 需要基础库: `2.9.0`
*
- * 最低基础库: `2.9.0` */
+ * 在插件中使用:支持
+ *
+ * 将音频或视频轨道添加到容器 */
addTrack(
/** [MediaTrack](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaTrack.html)
*
@@ -10020,27 +18957,35 @@ Page({
): void
/** [MediaContainer.destroy()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaContainer.destroy.html)
*
- * 将容器销毁,释放资源
+ * 需要基础库: `2.9.0`
*
- * 最低基础库: `2.9.0` */
+ * 在插件中使用:支持
+ *
+ * 将容器销毁,释放资源 */
destroy(): void
/** [MediaContainer.export()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaContainer.export.html)
*
- * 将容器内的轨道合并并导出视频文件
+ * 需要基础库: `2.9.0`
*
- * 最低基础库: `2.9.0` */
+ * 在插件中使用:支持
+ *
+ * 将容器内的轨道合并并导出视频文件 */
export(): void
/** [MediaContainer.extractDataSource(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaContainer.extractDataSource.html)
*
- * 将传入的视频源分离轨道。不会自动将轨道添加到待合成的容器里。
+ * 需要基础库: `2.9.0`
*
- * 最低基础库: `2.9.0` */
+ * 在插件中使用:支持
+ *
+ * 将传入的视频源分离轨道。不会自动将轨道添加到待合成的容器里。 */
extractDataSource(option: ExtractDataSourceOption): void
/** [MediaContainer.removeTrack([MediaTrack](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaTrack.html) track)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaContainer.removeTrack.html)
*
- * 将音频或视频轨道从容器中移除
+ * 需要基础库: `2.9.0`
*
- * 最低基础库: `2.9.0` */
+ * 在插件中使用:支持
+ *
+ * 将音频或视频轨道从容器中移除 */
removeTrack(
/** [MediaTrack](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaTrack.html)
*
@@ -10050,10 +18995,14 @@ Page({
}
interface MediaQueryObserver {
/** [MediaQueryObserver.disconnect()](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/MediaQueryObserver.disconnect.html)
+ *
+ * 在插件中使用:支持
*
* 停止监听。回调函数将不再触发 */
disconnect(): void
/** [MediaQueryObserver.observe(Object descriptor, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/MediaQueryObserver.observe.html)
+ *
+ * 在插件中使用:支持
*
* 开始监听页面 media query 变化情况 */
observe(
@@ -10064,17 +19013,13 @@ Page({
): void
}
interface MediaRecorder {
- /** [MediaRecorder.destroy()](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.destroy.html)
- *
- * 销毁录制器
- *
- * 最低基础库: `2.11.0` */
- destroy(): void
/** [MediaRecorder.off(string eventName, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.off.html)
*
- * 取消监听录制事件。当对应事件触发时,该回调函数不再执行。
+ * 需要基础库: `2.11.0`
*
- * 最低基础库: `2.11.0` */
+ * 在插件中使用:支持
+ *
+ * 取消监听录制事件。当对应事件触发时,该回调函数不再执行。 */
off(
/** 事件名 */
eventName: string,
@@ -10083,206 +19028,177 @@ Page({
): void
/** [MediaRecorder.on(string eventName, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.on.html)
*
- * 注册监听录制事件的回调函数。当对应事件触发时,回调函数会被执行。
+ * 需要基础库: `2.11.0`
*
- * 最低基础库: `2.11.0` */
+ * 在插件中使用:支持
+ *
+ * 注册监听录制事件的回调函数。当对应事件触发时,回调函数会被执行。 */
on(
/** 事件名
*
* 参数 eventName 可选值:
* - 'start': 录制开始事件。;
- * - 'stop': 录制结束事件。返回 {tempFilePath, duration, fileSize}; */
- eventName: 'start' | 'stop',
+ * - 'stop': 录制结束事件。返回 {tempFilePath, duration, fileSize};
+ * - 'pause': 录制暂停事件。;
+ * - 'resume': 录制继续事件。;
+ * - 'timeupdate': 录制时间更新事件。; */
+ eventName: 'start' | 'stop' | 'pause' | 'resume' | 'timeupdate',
/** 事件触发时执行的回调函数 */
callback: (...args: any[]) => any
): void
- /** [MediaRecorder.pause()](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.pause.html)
+ /** [Promise MediaRecorder.destroy()](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.destroy.html)
*
- * 暂停录制
+ * 需要基础库: `2.11.0`
*
- * 最低基础库: `2.11.0` */
- pause(): void
- /** [MediaRecorder.requestFrame(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.requestFrame.html)
+ * 在插件中使用:支持
*
- * 请求下一帧录制,在 callback 里完成一帧渲染后开始录制当前帧
+ * 销毁录制器 */
+ destroy(): Promise
+ /** [Promise MediaRecorder.pause()](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.pause.html)
*
- * 最低基础库: `2.11.0` */
- requestFrame(callback: (...args: any[]) => any): void
- /** [MediaRecorder.resume()](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.resume.html)
+ * 需要基础库: `2.11.0`
*
- * 恢复录制
+ * 在插件中使用:支持
*
- * 最低基础库: `2.11.0` */
- resume(): void
- /** [MediaRecorder.start()](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.start.html)
+ * 暂停录制 */
+ pause(): Promise
+ /** [Promise MediaRecorder.requestFrame(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.requestFrame.html)
*
- * 开始录制
+ * 需要基础库: `2.11.0`
*
- * 最低基础库: `2.11.0` */
- start(): void
- /** [MediaRecorder.stop()](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.stop.html)
+ * 在插件中使用:支持
*
- * 结束录制
+ * 请求下一帧录制,在 callback 里完成一帧渲染后开始录制当前帧 */
+ requestFrame(callback: (...args: any[]) => any): Promise
+ /** [Promise MediaRecorder.resume()](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.resume.html)
*
- * 最低基础库: `2.11.0` */
- stop(): void
+ * 需要基础库: `2.11.0`
+ *
+ * 在插件中使用:支持
+ *
+ * 恢复录制 */
+ resume(): Promise
+ /** [Promise MediaRecorder.start()](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.start.html)
+ *
+ * 需要基础库: `2.11.0`
+ *
+ * 在插件中使用:支持
+ *
+ * 开始录制 */
+ start(): Promise
+ /** [Promise MediaRecorder.stop()](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.stop.html)
+ *
+ * 需要基础库: `2.11.0`
+ *
+ * 在插件中使用:支持
+ *
+ * 结束录制 */
+ stop(): Promise
}
interface MifareClassic {
/** [MifareClassic.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareClassic.close.html)
*
- * 断开连接
+ * 需要基础库: `2.11.2`
*
- * 最低基础库: `2.11.2` */
+ * 在插件中使用:支持
+ *
+ * 断开连接 */
close(option?: NdefCloseOption): void
/** [MifareClassic.connect(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareClassic.connect.html)
*
- * 连接 NFC 标签
+ * 需要基础库: `2.11.2`
*
- * 最低基础库: `2.11.2` */
- connect(option?: ConnectOption): void
+ * 在插件中使用:支持
+ *
+ * 连接 NFC 标签 */
+ connect(option?: NdefConnectOption): void
/** [MifareClassic.getMaxTransceiveLength(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareClassic.getMaxTransceiveLength.html)
*
- * 获取最大传输长度
+ * 需要基础库: `2.11.2`
*
- * 最低基础库: `2.11.2` */
+ * 在插件中使用:支持
+ *
+ * 获取最大传输长度 */
getMaxTransceiveLength(option?: GetMaxTransceiveLengthOption): void
/** [MifareClassic.isConnected(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareClassic.isConnected.html)
*
- * 检查是否已连接
+ * 需要基础库: `2.11.2`
*
- * 最低基础库: `2.11.2` */
+ * 在插件中使用:支持
+ *
+ * @warning **该接口已废弃,连接状态开发者自行维护即可**
+ *
+ * 检查是否已连接 */
isConnected(option?: IsConnectedOption): void
/** [MifareClassic.setTimeout(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareClassic.setTimeout.html)
*
- * 设置超时时间
+ * 需要基础库: `2.11.2`
*
- * 最低基础库: `2.11.2` */
+ * 在插件中使用:支持
+ *
+ * 设置超时时间 */
setTimeout(option: SetTimeoutOption): void
/** [MifareClassic.transceive(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareClassic.transceive.html)
*
- * 发送数据
+ * 需要基础库: `2.11.2`
*
- * 最低基础库: `2.11.2` */
+ * 在插件中使用:支持
+ *
+ * 发送数据 */
transceive(option: TransceiveOption): void
}
interface MifareUltralight {
/** [MifareUltralight.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareUltralight.close.html)
*
- * 断开连接
+ * 需要基础库: `2.11.2`
*
- * 最低基础库: `2.11.2` */
+ * 在插件中使用:支持
+ *
+ * 断开连接 */
close(option?: NdefCloseOption): void
/** [MifareUltralight.connect(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareUltralight.connect.html)
*
- * 连接 NFC 标签
+ * 需要基础库: `2.11.2`
*
- * 最低基础库: `2.11.2` */
- connect(option?: ConnectOption): void
+ * 在插件中使用:支持
+ *
+ * 连接 NFC 标签 */
+ connect(option?: NdefConnectOption): void
/** [MifareUltralight.getMaxTransceiveLength(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareUltralight.getMaxTransceiveLength.html)
*
- * 获取最大传输长度
+ * 需要基础库: `2.11.2`
*
- * 最低基础库: `2.11.2` */
+ * 在插件中使用:支持
+ *
+ * 获取最大传输长度 */
getMaxTransceiveLength(option?: GetMaxTransceiveLengthOption): void
/** [MifareUltralight.isConnected(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareUltralight.isConnected.html)
*
- * 检查是否已连接
+ * 需要基础库: `2.11.2`
*
- * 最低基础库: `2.11.2` */
+ * 在插件中使用:支持
+ *
+ * @warning **该接口已废弃,连接状态开发者自行维护即可**
+ *
+ * 检查是否已连接 */
isConnected(option?: IsConnectedOption): void
/** [MifareUltralight.setTimeout(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareUltralight.setTimeout.html)
*
- * 设置超时时间
+ * 需要基础库: `2.11.2`
*
- * 最低基础库: `2.11.2` */
+ * 在插件中使用:支持
+ *
+ * 设置超时时间 */
setTimeout(option: SetTimeoutOption): void
/** [MifareUltralight.transceive(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareUltralight.transceive.html)
*
- * 发送数据
+ * 需要基础库: `2.11.2`
*
- * 最低基础库: `2.11.2` */
+ * 在插件中使用:支持
+ *
+ * 发送数据 */
transceive(option: TransceiveOption): void
}
- interface NFCAdapter {
- /** [NFCAdapter.offDiscovered(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.offDiscovered.html)
- *
- * 取消监听 NFC Tag
- *
- * 最低基础库: `2.11.2` */
- offDiscovered(
- /** 的回调函数 */
- callback?: OffDiscoveredCallback
- ): void
- /** [NFCAdapter.onDiscovered(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.onDiscovered.html)
- *
- * 监听 NFC Tag
- *
- * 最低基础库: `2.11.2` */
- onDiscovered(
- /** 的回调函数 */
- callback: OnDiscoveredCallback
- ): void
- /** [NFCAdapter.startDiscovery(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.startDiscovery.html)
- *
- *
- *
- * 最低基础库: `2.11.2` */
- startDiscovery(option?: StartDiscoveryOption): void
- /** [NFCAdapter.stopDiscovery(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.stopDiscovery.html)
- *
- *
- *
- * 最低基础库: `2.11.2` */
- stopDiscovery(option?: StopDiscoveryOption): void
- /** [[IsoDep](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.html) NFCAdapter.getIsoDep()](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getIsoDep.html)
- *
- * 获取IsoDep实例,实例支持ISO-DEP (ISO 14443-4)标准的读写
- *
- * 最低基础库: `2.11.2` */
- getIsoDep(): IsoDep
- /** [[MifareClassic](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareClassic.html) NFCAdapter.getMifareClassic()](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getMifareClassic.html)
- *
- * 获取MifareClassic实例,实例支持MIFARE Classic标签的读写
- *
- * 最低基础库: `2.11.2` */
- getMifareClassic(): MifareClassic
- /** [[MifareUltralight](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareUltralight.html) NFCAdapter.getMifareUltralight()](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getMifareUltralight.html)
- *
- * 获取MifareUltralight实例,实例支持MIFARE Ultralight标签的读写
- *
- * 最低基础库: `2.11.2` */
- getMifareUltralight(): MifareUltralight
- /** [[Ndef](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/Ndef.html) NFCAdapter.getNdef()](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getNdef.html)
- *
- * 获取Ndef实例,实例支持对NDEF格式的NFC标签上的NDEF数据的读写
- *
- * 最低基础库: `2.11.2` */
- getNdef(): Ndef
- /** [[NfcA](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.html) NFCAdapter.getNfcA()](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getNfcA.html)
- *
- * 获取NfcA实例,实例支持NFC-A (ISO 14443-3A)标准的读写
- *
- * 最低基础库: `2.11.2` */
- getNfcA(): NfcA
- /** [[NfcB](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcB.html) NFCAdapter.getNfcB()](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getNfcB.html)
- *
- * 获取NfcB实例,实例支持NFC-B (ISO 14443-3B)标准的读写
- *
- * 最低基础库: `2.11.2` */
- getNfcB(): NfcB
- /** [[NfcF](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcF.html) NFCAdapter.getNfcF()](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getNfcF.html)
- *
- * 获取NfcF实例,实例支持NFC-F (JIS 6319-4)标准的读写
- *
- * 最低基础库: `2.11.2` */
- getNfcF(): NfcF
- /** [[NfcV](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcV.html) NFCAdapter.getNfcV()](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getNfcV.html)
- *
- * 获取NfcV实例,实例支持NFC-V (ISO 15693)标准的读写
- *
- * 最低基础库: `2.11.2` */
- getNfcV(): NfcV
- }
interface NFCError {
/** 错误信息
*
@@ -10312,209 +19228,285 @@ Page({
interface Ndef {
/** [Ndef.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/Ndef.close.html)
*
- * 断开连接
+ * 需要基础库: `2.11.2`
*
- * 最低基础库: `2.11.2` */
+ * 在插件中使用:支持
+ *
+ * 断开连接 */
close(option?: NdefCloseOption): void
/** [Ndef.connect(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/Ndef.connect.html)
*
- * 连接 NFC 标签
+ * 需要基础库: `2.11.2`
*
- * 最低基础库: `2.11.2` */
- connect(option?: ConnectOption): void
+ * 在插件中使用:支持
+ *
+ * 连接 NFC 标签 */
+ connect(option?: NdefConnectOption): void
/** [Ndef.isConnected(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/Ndef.isConnected.html)
*
- * 检查是否已连接
+ * 需要基础库: `2.11.2`
*
- * 最低基础库: `2.11.2` */
+ * 在插件中使用:支持
+ *
+ * @warning **该接口已废弃,连接状态开发者自行维护即可**
+ *
+ * 检查是否已连接 */
isConnected(option?: IsConnectedOption): void
/** [Ndef.offNdefMessage(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/Ndef.offNdefMessage.html)
*
- * 取消监听 Ndef 消息
+ * 需要基础库: `2.11.2`
*
- * 最低基础库: `2.11.2` */
+ * 在插件中使用:支持
+ *
+ * 取消监听 Ndef 消息 */
offNdefMessage(callback: (...args: any[]) => any): void
/** [Ndef.onNdefMessage(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/Ndef.onNdefMessage.html)
*
- * 监听 Ndef 消息
+ * 需要基础库: `2.11.2`
*
- * 最低基础库: `2.11.2` */
+ * 在插件中使用:支持
+ *
+ * 监听 Ndef 消息 */
onNdefMessage(callback: (...args: any[]) => any): void
/** [Ndef.setTimeout(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/Ndef.setTimeout.html)
*
- * 设置超时时间
+ * 需要基础库: `2.11.2`
*
- * 最低基础库: `2.11.2` */
+ * 在插件中使用:支持
+ *
+ * 设置超时时间 */
setTimeout(option: SetTimeoutOption): void
/** [Ndef.writeNdefMessage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/Ndef.writeNdefMessage.html)
*
- * 重写 Ndef 标签内容
+ * 需要基础库: `2.11.2`
*
- * 最低基础库: `2.11.2` */
+ * 在插件中使用:支持
+ *
+ * 重写 Ndef 标签内容 */
writeNdefMessage(option: WriteNdefMessageOption): void
}
interface NfcA {
/** [NfcA.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.close.html)
*
- * 断开连接
+ * 需要基础库: `2.11.2`
*
- * 最低基础库: `2.11.2` */
+ * 在插件中使用:支持
+ *
+ * 断开连接 */
close(option?: NdefCloseOption): void
/** [NfcA.connect(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.connect.html)
*
- * 连接 NFC 标签
+ * 需要基础库: `2.11.2`
*
- * 最低基础库: `2.11.2` */
- connect(option?: ConnectOption): void
+ * 在插件中使用:支持
+ *
+ * 连接 NFC 标签 */
+ connect(option?: NdefConnectOption): void
/** [NfcA.getAtqa(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.getAtqa.html)
*
- * 获取ATQA信息
+ * 需要基础库: `2.11.2`
*
- * 最低基础库: `2.11.2` */
+ * 在插件中使用:支持
+ *
+ * 获取ATQA信息 */
getAtqa(option?: GetAtqaOption): void
/** [NfcA.getMaxTransceiveLength(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.getMaxTransceiveLength.html)
*
- * 获取最大传输长度
+ * 需要基础库: `2.11.2`
*
- * 最低基础库: `2.11.2` */
+ * 在插件中使用:支持
+ *
+ * 获取最大传输长度 */
getMaxTransceiveLength(option?: GetMaxTransceiveLengthOption): void
/** [NfcA.getSak(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.getSak.html)
*
- * 获取SAK信息
+ * 需要基础库: `2.11.2`
*
- * 最低基础库: `2.11.2` */
+ * 在插件中使用:支持
+ *
+ * 获取SAK信息 */
getSak(option?: GetSakOption): void
/** [NfcA.isConnected(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.isConnected.html)
*
- * 检查是否已连接
+ * 需要基础库: `2.11.2`
*
- * 最低基础库: `2.11.2` */
+ * 在插件中使用:支持
+ *
+ * @warning **该接口已废弃,连接状态开发者自行维护即可**
+ *
+ * 检查是否已连接 */
isConnected(option?: IsConnectedOption): void
/** [NfcA.setTimeout(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.setTimeout.html)
*
- * 设置超时时间
+ * 需要基础库: `2.11.2`
*
- * 最低基础库: `2.11.2` */
+ * 在插件中使用:支持
+ *
+ * 设置超时时间 */
setTimeout(option: SetTimeoutOption): void
/** [NfcA.transceive(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.transceive.html)
*
- * 发送数据
+ * 需要基础库: `2.11.2`
*
- * 最低基础库: `2.11.2` */
+ * 在插件中使用:支持
+ *
+ * 发送数据 */
transceive(option: TransceiveOption): void
}
interface NfcB {
/** [NfcB.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcB.close.html)
*
- * 断开连接
+ * 需要基础库: `2.11.2`
*
- * 最低基础库: `2.11.2` */
+ * 在插件中使用:支持
+ *
+ * 断开连接 */
close(option?: NdefCloseOption): void
/** [NfcB.connect(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcB.connect.html)
*
- * 连接 NFC 标签
+ * 需要基础库: `2.11.2`
*
- * 最低基础库: `2.11.2` */
- connect(option?: ConnectOption): void
+ * 在插件中使用:支持
+ *
+ * 连接 NFC 标签 */
+ connect(option?: NdefConnectOption): void
/** [NfcB.getMaxTransceiveLength(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcB.getMaxTransceiveLength.html)
*
- * 获取最大传输长度
+ * 需要基础库: `2.11.2`
*
- * 最低基础库: `2.11.2` */
+ * 在插件中使用:支持
+ *
+ * 获取最大传输长度 */
getMaxTransceiveLength(option?: GetMaxTransceiveLengthOption): void
/** [NfcB.isConnected(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcB.isConnected.html)
*
- * 检查是否已连接
+ * 需要基础库: `2.11.2`
*
- * 最低基础库: `2.11.2` */
+ * 在插件中使用:支持
+ *
+ * @warning **该接口已废弃,连接状态开发者自行维护即可**
+ *
+ * 检查是否已连接 */
isConnected(option?: IsConnectedOption): void
/** [NfcB.setTimeout(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcB.setTimeout.html)
*
- * 设置超时时间
+ * 需要基础库: `2.11.2`
*
- * 最低基础库: `2.11.2` */
+ * 在插件中使用:支持
+ *
+ * 设置超时时间 */
setTimeout(option: SetTimeoutOption): void
/** [NfcB.transceive(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcB.transceive.html)
*
- * 发送数据
+ * 需要基础库: `2.11.2`
*
- * 最低基础库: `2.11.2` */
+ * 在插件中使用:支持
+ *
+ * 发送数据 */
transceive(option: TransceiveOption): void
}
interface NfcF {
/** [NfcF.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcF.close.html)
*
- * 断开连接
+ * 需要基础库: `2.11.2`
*
- * 最低基础库: `2.11.2` */
+ * 在插件中使用:支持
+ *
+ * 断开连接 */
close(option?: NdefCloseOption): void
/** [NfcF.connect(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcF.connect.html)
*
- * 连接 NFC 标签
+ * 需要基础库: `2.11.2`
*
- * 最低基础库: `2.11.2` */
- connect(option?: ConnectOption): void
+ * 在插件中使用:支持
+ *
+ * 连接 NFC 标签 */
+ connect(option?: NdefConnectOption): void
/** [NfcF.getMaxTransceiveLength(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcF.getMaxTransceiveLength.html)
*
- * 获取最大传输长度
+ * 需要基础库: `2.11.2`
*
- * 最低基础库: `2.11.2` */
+ * 在插件中使用:支持
+ *
+ * 获取最大传输长度 */
getMaxTransceiveLength(option?: GetMaxTransceiveLengthOption): void
/** [NfcF.isConnected(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcF.isConnected.html)
*
- * 检查是否已连接
+ * 需要基础库: `2.11.2`
*
- * 最低基础库: `2.11.2` */
+ * 在插件中使用:支持
+ *
+ * @warning **该接口已废弃,连接状态开发者自行维护即可**
+ *
+ * 检查是否已连接 */
isConnected(option?: IsConnectedOption): void
/** [NfcF.setTimeout(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcF.setTimeout.html)
*
- * 设置超时时间
+ * 需要基础库: `2.11.2`
*
- * 最低基础库: `2.11.2` */
+ * 在插件中使用:支持
+ *
+ * 设置超时时间 */
setTimeout(option: SetTimeoutOption): void
/** [NfcF.transceive(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcF.transceive.html)
*
- * 发送数据
+ * 需要基础库: `2.11.2`
*
- * 最低基础库: `2.11.2` */
+ * 在插件中使用:支持
+ *
+ * 发送数据 */
transceive(option: TransceiveOption): void
}
interface NfcV {
/** [NfcV.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcV.close.html)
*
- * 断开连接
+ * 需要基础库: `2.11.2`
*
- * 最低基础库: `2.11.2` */
+ * 在插件中使用:支持
+ *
+ * 断开连接 */
close(option?: NdefCloseOption): void
/** [NfcV.connect(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcV.connect.html)
*
- * 连接 NFC 标签
+ * 需要基础库: `2.11.2`
*
- * 最低基础库: `2.11.2` */
- connect(option?: ConnectOption): void
+ * 在插件中使用:支持
+ *
+ * 连接 NFC 标签 */
+ connect(option?: NdefConnectOption): void
/** [NfcV.getMaxTransceiveLength(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcV.getMaxTransceiveLength.html)
*
- * 获取最大传输长度
+ * 需要基础库: `2.11.2`
*
- * 最低基础库: `2.11.2` */
+ * 在插件中使用:支持
+ *
+ * 获取最大传输长度 */
getMaxTransceiveLength(option?: GetMaxTransceiveLengthOption): void
/** [NfcV.isConnected(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcV.isConnected.html)
*
- * 检查是否已连接
+ * 需要基础库: `2.11.2`
*
- * 最低基础库: `2.11.2` */
+ * 在插件中使用:支持
+ *
+ * @warning **该接口已废弃,连接状态开发者自行维护即可**
+ *
+ * 检查是否已连接 */
isConnected(option?: IsConnectedOption): void
/** [NfcV.setTimeout(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcV.setTimeout.html)
*
- * 设置超时时间
+ * 需要基础库: `2.11.2`
*
- * 最低基础库: `2.11.2` */
+ * 在插件中使用:支持
+ *
+ * 设置超时时间 */
setTimeout(option: SetTimeoutOption): void
/** [NfcV.transceive(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcV.transceive.html)
*
- * 发送数据
+ * 需要基础库: `2.11.2`
*
- * 最低基础库: `2.11.2` */
+ * 在插件中使用:支持
+ *
+ * 发送数据 */
transceive(option: TransceiveOption): void
}
interface Nfcrwerror {
@@ -10562,11 +19554,12 @@ Page({
interface NodesRef {
/** [[SelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html) NodesRef.boundingClientRect(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/NodesRef.boundingClientRect.html)
*
+* 在插件中使用:支持
+*
* 添加节点的布局位置的查询请求。相对于显示区域,以像素为单位。其功能类似于 DOM 的 `getBoundingClientRect`。返回 `NodesRef` 对应的 `SelectorQuery`。
*
* **示例代码**
*
-*
* ```js
Page({
getRect () {
@@ -10603,11 +19596,14 @@ Page({
): SelectorQuery
/** [[SelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html) NodesRef.context(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/NodesRef.context.html)
*
+* 需要基础库: `2.4.2`
+*
+* 在插件中使用:支持
+*
* 添加节点的 Context 对象查询请求。目前支持 [VideoContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.html)、[CanvasContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html)、[LivePlayerContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.html)、[EditorContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.html)和 [MapContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.html) 的获取。
*
* **示例代码**
*
-*
* ```js
Page({
getContext () {
@@ -10616,25 +19612,23 @@ Page({
}).exec()
}
})
-```
-*
-* 最低基础库: `2.4.2` */
+``` */
context(
/** 回调函数,在执行 `SelectorQuery.exec` 方法后,返回节点信息。 */
callback?: ContextCallback
): SelectorQuery
/** [[SelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html) NodesRef.fields(Object fields, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/NodesRef.fields.html)
*
+* 在插件中使用:支持
+*
* 获取节点的相关信息。需要获取的字段在fields中指定。返回值是 `nodesRef` 对应的 `selectorQuery`
*
* **注意**
*
-*
* computedStyle 的优先级高于 size,当同时在 computedStyle 里指定了 width/height 和传入了 size: true,则优先返回 computedStyle 获取到的 width/height。
*
* **示例代码**
*
-*
* ```js
Page({
getFields () {
@@ -10657,6 +19651,7 @@ Page({
res.margin
res.backgroundColor
res.context // 节点对应的 Context 对象
+ res.ref // 节点对应的 Ref 对象
}).exec()
}
})
@@ -10668,11 +19663,14 @@ Page({
): SelectorQuery
/** [[SelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html) NodesRef.node(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/NodesRef.node.html)
*
-* 获取 Node 节点实例。目前支持 [Canvas](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 的获取。
+* 需要基础库: `2.7.0`
+*
+* 在插件中使用:支持
+*
+* 获取 Node 节点实例。目前支持 [Canvas](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.html) 和 [ScrollViewContext](https://developers.weixin.qq.com/miniprogram/dev/api/ui/scroll/ScrollViewContext.html) 的获取。
*
* **示例代码**
*
-*
* ```js
Page({
getNode() {
@@ -10681,20 +19679,42 @@ Page({
}).exec()
}
})
-```
-*
-* 最低基础库: `2.7.0` */
+``` */
node(
/** 回调函数,在执行 `SelectorQuery.exec` 方法后,返回节点信息。 */
callback?: NodeCallback
): SelectorQuery
+ /** [[SelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html) NodesRef.ref(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/NodesRef.ref.html)
+*
+* 需要基础库: `3.3.0`
+*
+* 在插件中使用:支持
+*
+* 获取 `Node` 节点的 Ref 对象,可用于 `worklet` 函数内操作节点。仅 `Skyline` 下支持,`Node` 必须是非 `virtual` 类型。
+*
+* **示例代码**
+*
+* ```js
+Page({
+ getNode() {
+ this.createSelectorQuery().select('.scrollable').ref(function(res){
+ console.log(res.ref) // 节点对应的 Ref 对象
+ }).exec()
+ }
+})
+``` */
+ ref(
+ /** 回调函数,在执行 `SelectorQuery.exec` 方法后,返回节点 Ref 对象。 */
+ callback?: RefCallback
+ ): SelectorQuery
/** [[SelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html) NodesRef.scrollOffset(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/NodesRef.scrollOffset.html)
*
+* 在插件中使用:支持
+*
* 添加节点的滚动位置查询请求。以像素为单位。节点必须是 `scroll-view` 或者 `viewport`,返回 `NodesRef` 对应的 `SelectorQuery`。
*
* **示例代码**
*
-*
* ```js
Page({
getScrollOffset () {
@@ -10712,206 +19732,490 @@ Page({
callback?: ScrollOffsetCallback
): SelectorQuery
}
- interface OffscreenCanvas {
- /** [[RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) OffscreenCanvas.getContext(string contextType)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/OffscreenCanvas.getContext.html)
+ interface Path2D {
+ /** [Path2D.addPath([Path2D](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Path2D.html) path)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Path2D.addPath.html)
*
- * 该方法返回 OffscreenCanvas 的绘图上下文
+ * 需要基础库: `2.11.0`
*
- * ****
+ * 在插件中使用:不支持
*
- * 注意不允许混用 WebGL 和 2d 绘图上下文
- *
- * 最低基础库: `2.7.0` */
- getContext(
- /**
+ * 添加路径到当前路径。 */
+ addPath(
+ /** [Path2D](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Path2D.html)
*
- * 参数 contextType 可选值:
- * - 'webgl': 创建 WebGL 绘图上下文;
- * - '2d': 创建 2d 绘图上下文; */
- contextType: 'webgl' | '2d'
- ): any
+ * 添加的 Path2D 路径。 */
+ path: Path2D
+ ): void
+ /** [Path2D.arc(number x, number y, number radius, number startAngle, number endAngle, boolean counterclockwise)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Path2D.arc.html)
+ *
+ * 需要基础库: `2.11.0`
+ *
+ * 在插件中使用:不支持
+ *
+ * 添加一段圆弧路径。 */
+ arc(
+ /** 圆心横坐标。 */
+ x: number,
+ /** 圆心纵坐标。 */
+ y: number,
+ /** 圆形半径,必须为正数。 */
+ radius: number,
+ /** 圆弧开始角度。 */
+ startAngle: number,
+ /** 圆弧结束角度。 */
+ endAngle: number,
+ /** 是否逆时针绘制。如果传 true, 则会从 endAngle 开始绘制到 startAngle。 */
+ counterclockwise?: boolean
+ ): void
+ /** [Path2D.arcTo(number x1, number y1, number x2, number y2, number radius)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Path2D.arcTo.html)
+ *
+ * 需要基础库: `2.11.0`
+ *
+ * 在插件中使用:不支持
+ *
+ * 通过给定控制点添加一段圆弧路径。 */
+ arcTo(
+ /** 第一个控制点横坐标。 */
+ x1: number,
+ /** 第一个控制点纵坐标。 */
+ y1: number,
+ /** 第二个控制点横坐标。 */
+ x2: number,
+ /** 第二个控制点纵坐标。 */
+ y2: number,
+ /** 圆形半径,必须为非负数。 */
+ radius: number
+ ): void
+ /** [Path2D.bezierCurveTo(number cp1x, number cp1y, number cp2x, number cp2y, number x, number y)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Path2D.bezierCurveTo.html)
+ *
+ * 需要基础库: `2.11.0`
+ *
+ * 在插件中使用:不支持
+ *
+ * 添加三次贝塞尔曲线路径。 */
+ bezierCurveTo(
+ /** 第一个控制点横坐标。 */
+ cp1x: number,
+ /** 第一个控制点纵坐标。 */
+ cp1y: number,
+ /** 第二个控制点横坐标。 */
+ cp2x: number,
+ /** 第二个控制点纵坐标。 */
+ cp2y: number,
+ /** 结束点横坐标。 */
+ x: number,
+ /** 结束点纵坐标。 */
+ y: number
+ ): void
+ /** [Path2D.closePath()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Path2D.closePath.html)
+ *
+ * 需要基础库: `2.11.0`
+ *
+ * 在插件中使用:不支持
+ *
+ * 闭合路径到起点。 */
+ closePath(): void
+ /** [Path2D.ellipse(number x, number y, number radiusX, number radiusY, number rotation, number startAngle, number endAngle, boolean counterclockwise)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Path2D.ellipse.html)
+ *
+ * 需要基础库: `2.11.0`
+ *
+ * 在插件中使用:不支持
+ *
+ * 添加椭圆弧路径 */
+ ellipse(
+ /** 椭圆圆心横坐标。 */
+ x: number,
+ /** 椭圆圆心纵坐标。 */
+ y: number,
+ /** 椭圆长轴半径,必须为非负数。 */
+ radiusX: number,
+ /** 椭圆短轴半径,必须为非负数。 */
+ radiusY: number,
+ /** 椭圆旋转角度。 */
+ rotation: number,
+ /** 圆弧开始角度。 */
+ startAngle: number,
+ /** 圆弧结束角度。 */
+ endAngle: number,
+ /** 是否逆时针绘制。如果传 true, 则会从 endAngle 开始绘制到 startAngle。 */
+ counterclockwise?: boolean
+ ): void
+ /** [Path2D.lineTo(number x, number y)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Path2D.lineTo.html)
+ *
+ * 需要基础库: `2.11.0`
+ *
+ * 在插件中使用:不支持
+ *
+ * 添加直线路径 */
+ lineTo(
+ /** 结束点横坐标。 */
+ x: number,
+ /** 结束点纵坐标。 */
+ y: number
+ ): void
+ /** [Path2D.moveTo(number x, number y)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Path2D.moveTo.html)
+ *
+ * 需要基础库: `2.11.0`
+ *
+ * 在插件中使用:不支持
+ *
+ * 移动路径开始点 */
+ moveTo(
+ /** 横坐标。 */
+ x: number,
+ /** 纵坐标。 */
+ y: number
+ ): void
+ /** [Path2D.quadraticCurveTo(number cpx, number cpy, number x, number y)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Path2D.quadraticCurveTo.html)
+ *
+ * 需要基础库: `2.11.0`
+ *
+ * 在插件中使用:不支持
+ *
+ * 添加二次贝塞尔曲线路径。 */
+ quadraticCurveTo(
+ /** 控制点横坐标。 */
+ cpx: number,
+ /** 控制点纵坐标。 */
+ cpy: number,
+ /** 结束点横坐标。 */
+ x: number,
+ /** 结束点纵坐标。 */
+ y: number
+ ): void
+ /** [Path2D.rect(number x, number y, number width, number height)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Path2D.rect.html)
+ *
+ * 需要基础库: `2.11.0`
+ *
+ * 在插件中使用:不支持
+ *
+ * 添加方形路径。 */
+ rect(
+ /** 开始点横坐标。 */
+ x: number,
+ /** 开始点纵坐标。 */
+ y: number,
+ /** 方形宽度,正数向右,负数向左。 */
+ width: number,
+ /** 方形高度,正数向下,负数向上。 */
+ height: number
+ ): void
}
interface Performance {
- /** [Array Performance.getEntries()](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/Performance.getEntries.html)
+ /** [Array.<[PerformanceEntry](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/PerformanceEntry.html)> Performance.getEntries()](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/Performance.getEntries.html)
*
- * 该方法返回当前缓冲区中的所有性能数据
+ * 需要基础库: `2.11.0`
*
- * 最低基础库: `2.11.0` */
- getEntries(): any[]
- /** [Array Performance.getEntriesByName(string name, string entryType)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/Performance.getEntriesByName.html)
+ * 在插件中使用:不支持
*
- * 获取当前缓冲区中所有名称为 [name] 且类型为 [entryType] 的性能数据
+ * 该方法返回当前缓冲区中的所有性能数据 */
+ getEntries(): PerformanceEntry[]
+ /** [Array.<[PerformanceEntry](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/PerformanceEntry.html)> Performance.getEntriesByName(string name, string entryType)](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/Performance.getEntriesByName.html)
*
- * 最低基础库: `2.11.0` */
- getEntriesByName(name: string, entryType?: string): any[]
- /** [Array Performance.getEntriesByType(string entryType)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/Performance.getEntriesByType.html)
+ * 需要基础库: `2.11.0`
*
- * 获取当前缓冲区中所有类型为 [entryType] 的性能数据
+ * 在插件中使用:不支持
*
- * 最低基础库: `2.11.0` */
- getEntriesByType(entryType: string): any[]
- /** [Performance.setBufferSize(number size)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/Performance.setBufferSize.html)
+ * 获取当前缓冲区中所有名称为 [name] 且类型为 [entryType] 的性能数据 */
+ getEntriesByName(
+ /** 名称 */
+ name: string,
+ /** 类型 */
+ entryType?: string
+ ): PerformanceEntry[]
+ /** [Array.<[PerformanceEntry](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/PerformanceEntry.html)> Performance.getEntriesByType(string entryType)](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/Performance.getEntriesByType.html)
*
- * 设置缓冲区大小, 默认缓冲 30 条性能数据
+ * 需要基础库: `2.11.0`
*
- * 最低基础库: `2.11.0` */
+ * 在插件中使用:不支持
+ *
+ * 获取当前缓冲区中所有类型为 [entryType] 的性能数据 */
+ getEntriesByType(
+ /** 类型 */
+ entryType: string
+ ): PerformanceEntry[]
+ /** [Performance.setBufferSize(number size)](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/Performance.setBufferSize.html)
+ *
+ * 需要基础库: `2.11.0`
+ *
+ * 在插件中使用:不支持
+ *
+ * 设置缓冲区大小,默认缓冲 30 条性能数据 */
setBufferSize(size: number): void
- /** [[PerformanceObserver](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/PerformanceObserver.html) Performance.createObserver(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/Performance.createObserver.html)
+ /** [[PerformanceObserver](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/PerformanceObserver.html) Performance.createObserver(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/Performance.createObserver.html)
*
- * 创建全局性能事件监听器
+ * 需要基础库: `2.11.0`
*
- * 最低基础库: `2.11.0` */
- createObserver(callback: (...args: any[]) => any): PerformanceObserver
+ * 在插件中使用:不支持
+ *
+ * 创建全局性能事件监听器 */
+ createObserver(
+ /** 回调函数 */
+ callback: (...args: any[]) => any
+ ): PerformanceObserver
}
- interface PerformanceObserver {
- /** [PerformanceObserver.disconnect()](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/PerformanceObserver.disconnect.html)
+ interface PreDownloadSubpackageTask {
+ /** [PreDownloadSubpackageTask.onProgressUpdate(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/subpackage/PreDownloadSubpackageTask.onProgressUpdate.html)
*
- * 停止监听
+ * 需要基础库: `2.27.3`
*
- * 最低基础库: `2.11.0` */
- disconnect(): void
- /** [PerformanceObserver.observe(Object options)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/PerformanceObserver.observe.html)
+ * 在插件中使用:不支持
*
- * 开始监听
- *
- * 最低基础库: `2.11.0` */
- observe(
- /** 设置 type 监听单个类型的指标,设置 entryTypes 监听多个类型指标。 */
- options: IAnyObject
+ * 监听分包加载进度变化事件 */
+ onProgressUpdate(
+ /** 分包加载进度变化事件的监听函数 */
+ listener: PreDownloadSubpackageTaskOnProgressUpdateCallback
): void
}
interface RealtimeLogManager {
+ /** [Object RealtimeLogManager.getCurrentState()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeLogManager.getCurrentState.html)
+ *
+ * 需要基础库: `2.19.4`
+ *
+ * 在插件中使用:不支持
+ *
+ * 实时日志会将一定时间间隔内缓存的日志聚合上报,如果该时间内缓存的内容超出限制,则会被丢弃。此方法可以获取当前缓存剩余空间。
+ *
+ * > 注意:基础库内部在对日志进行上报时会补充一些结构化数据,如果遇到上报溢出的情况也会补充警告日志,所以此方法获取到的当前占用信息会比预期的大一些。 */
+ getCurrentState(): CurrentState
/** [RealtimeLogManager.addFilterMsg(string msg)](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeLogManager.addFilterMsg.html)
*
- * 添加过滤关键字
+ * 需要基础库: `2.8.1`
*
- * 最低基础库: `2.8.1` */
+ * 在插件中使用:不支持
+ *
+ * 添加过滤关键字,暂不支持在插件使用 */
addFilterMsg(
/** 是setFilterMsg的添加接口。用于设置多个过滤关键字。 */
msg: string
): void
/** [RealtimeLogManager.error()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeLogManager.error.html)
*
- * 写 error 日志
+ * 需要基础库: `2.7.1`
*
- * 最低基础库: `2.7.1` */
+ * 在插件中使用:不支持
+ *
+ * 写 error 日志,暂不支持在插件使用 */
error(
/** 日志内容,可以有任意多个。每次调用的参数的总大小不超过5Kb */
...args: any[]
): void
/** [RealtimeLogManager.in(Page pageInstance)](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeLogManager.in.html)
*
- * 设置实时日志page参数所在的页面
+ * 需要基础库: `2.9.1`
*
- * 最低基础库: `2.9.1` */
+ * 在插件中使用:不支持
+ *
+ * 设置实时日志page参数所在的页面,暂不支持在插件使用 */
in(
/** page实例 */
pageInstance: Page.TrivialInstance
): void
/** [RealtimeLogManager.info()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeLogManager.info.html)
*
- * 写 info 日志
+ * 需要基础库: `2.7.1`
*
- * 最低基础库: `2.7.1` */
+ * 在插件中使用:不支持
+ *
+ * 写 info 日志,暂不支持在插件使用 */
info(
/** 日志内容,可以有任意多个。每次调用的参数的总大小不超过5Kb */
...args: any[]
): void
/** [RealtimeLogManager.setFilterMsg(string msg)](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeLogManager.setFilterMsg.html)
*
- * 设置过滤关键字
+ * 需要基础库: `2.7.3`
*
- * 最低基础库: `2.7.3` */
+ * 在插件中使用:不支持
+ *
+ * 设置过滤关键字,暂不支持在插件使用 */
setFilterMsg(
/** 过滤关键字,最多不超过1Kb,可以在小程序管理后台根据设置的内容搜索得到对应的日志。 */
msg: string
): void
/** [RealtimeLogManager.warn()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeLogManager.warn.html)
*
- * 写 warn 日志
+ * 需要基础库: `2.7.1`
*
- * 最低基础库: `2.7.1` */
+ * 在插件中使用:不支持
+ *
+ * 写 warn 日志,暂不支持在插件使用 */
warn(
/** 日志内容,可以有任意多个。每次调用的参数的总大小不超过5Kb */
...args: any[]
): void
+ /** [[RealtimeTagLogManager](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeTagLogManager.html) RealtimeLogManager.tag(string tagName)](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeLogManager.tag.html)
+ *
+ * 需要基础库: `2.16.0`
+ *
+ * 在插件中使用:需要基础库 `2.16.0`
+ *
+ * 获取给定标签的日志管理器实例,目前只支持在插件使用 */
+ tag(
+ /** 标签名 */
+ tagName: string
+ ): RealtimeTagLogManager
+ }
+ interface RealtimeTagLogManager {
+ /** [RealtimeTagLogManager.addFilterMsg(string msg)](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeTagLogManager.addFilterMsg.html)
+ *
+ * 需要基础库: `2.16.0`
+ *
+ * 在插件中使用:需要基础库 `2.16.0`
+ *
+ * 添加过滤关键字 */
+ addFilterMsg(
+ /** 是setFilterMsg的添加接口。用于设置多个过滤关键字。 */
+ msg: string
+ ): void
+ /** [RealtimeTagLogManager.error(string key, Object|Array.<any>|number|string value)](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeTagLogManager.error.html)
+ *
+ * 需要基础库: `2.16.0`
+ *
+ * 在插件中使用:需要基础库 `2.16.0`
+ *
+ * 写 error 日志 */
+ error(
+ /** 日志的 key */
+ key: string,
+ /** 日志的值,每次调用的参数的总大小不超过5Kb */
+ value: IAnyObject | any[] | number | string
+ ): void
+ /** [RealtimeTagLogManager.info(string key, Object|Array.<any>|number|string value)](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeTagLogManager.info.html)
+ *
+ * 需要基础库: `2.16.0`
+ *
+ * 在插件中使用:需要基础库 `2.16.0`
+ *
+ * 写 info 日志 */
+ info(
+ /** 日志的 key */
+ key: string,
+ /** 日志的值,每次调用的参数的总大小不超过5Kb */
+ value: IAnyObject | any[] | number | string
+ ): void
+ /** [RealtimeTagLogManager.setFilterMsg(string msg)](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeTagLogManager.setFilterMsg.html)
+ *
+ * 需要基础库: `2.16.0`
+ *
+ * 在插件中使用:需要基础库 `2.16.0`
+ *
+ * 设置过滤关键字 */
+ setFilterMsg(
+ /** 过滤关键字,最多不超过1Kb,可以在小程序管理后台根据设置的内容搜索得到对应的日志。 */
+ msg: string
+ ): void
+ /** [RealtimeTagLogManager.warn(string key, Object|Array.<any>|number|string value)](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeTagLogManager.warn.html)
+ *
+ * 需要基础库: `2.16.0`
+ *
+ * 在插件中使用:需要基础库 `2.16.0`
+ *
+ * 写 warn 日志 */
+ warn(
+ /** 日志的 key */
+ key: string,
+ /** 日志的值,每次调用的参数的总大小不超过5Kb */
+ value: IAnyObject | any[] | number | string
+ ): void
}
interface RecorderManager {
- /** [RecorderManager.onError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.onError.html)
+ /** [RecorderManager.onError(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.onError.html)
+ *
+ * 在插件中使用:支持
*
* 监听录音错误事件 */
onError(
- /** 录音错误事件的回调函数 */
- callback: UDPSocketOnErrorCallback
+ /** 录音错误事件的监听函数 */
+ listener: UDPSocketOnErrorCallback
): void
- /** [RecorderManager.onFrameRecorded(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.onFrameRecorded.html)
+ /** [RecorderManager.onFrameRecorded(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.onFrameRecorded.html)
+ *
+ * 在插件中使用:支持
*
* 监听已录制完指定帧大小的文件事件。如果设置了 frameSize,则会回调此事件。 */
onFrameRecorded(
- /** 已录制完指定帧大小的文件事件的回调函数 */
- callback: OnFrameRecordedCallback
+ /** 已录制完指定帧大小的文件事件的监听函数 */
+ listener: OnFrameRecordedCallback
): void
- /** [RecorderManager.onInterruptionBegin(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.onInterruptionBegin.html)
+ /** [RecorderManager.onInterruptionBegin(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.onInterruptionBegin.html)
*
- * 监听录音因为受到系统占用而被中断开始事件。以下场景会触发此事件:微信语音聊天、微信视频聊天。此事件触发后,录音会被暂停。pause 事件在此事件后触发
+ * 需要基础库: `2.3.0`
*
- * 最低基础库: `2.3.0` */
+ * 在插件中使用:支持
+ *
+ * 监听录音因为受到系统占用而被中断开始事件。以下场景会触发此事件:微信语音聊天、微信视频聊天。此事件触发后,录音会被暂停。pause 事件在此事件后触发 */
onInterruptionBegin(
- /** 录音因为受到系统占用而被中断开始事件的回调函数 */
- callback: OnInterruptionBeginCallback
+ /** 录音因为受到系统占用而被中断开始事件的监听函数 */
+ listener: OnInterruptionBeginCallback
): void
- /** [RecorderManager.onInterruptionEnd(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.onInterruptionEnd.html)
+ /** [RecorderManager.onInterruptionEnd(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.onInterruptionEnd.html)
*
- * 监听录音中断结束事件。在收到 interruptionBegin 事件之后,小程序内所有录音会暂停,收到此事件之后才可再次录音成功。
+ * 需要基础库: `2.3.0`
*
- * 最低基础库: `2.3.0` */
+ * 在插件中使用:支持
+ *
+ * 监听录音中断结束事件。在收到 interruptionBegin 事件之后,小程序内所有录音会暂停,收到此事件之后才可再次录音成功。 */
onInterruptionEnd(
- /** 录音中断结束事件的回调函数 */
- callback: OnInterruptionEndCallback
+ /** 录音中断结束事件的监听函数 */
+ listener: OnInterruptionEndCallback
): void
- /** [RecorderManager.onPause(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.onPause.html)
+ /** [RecorderManager.onPause(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.onPause.html)
+ *
+ * 在插件中使用:支持
*
* 监听录音暂停事件 */
onPause(
- /** 录音暂停事件的回调函数 */
- callback: OnPauseCallback
+ /** 录音暂停事件的监听函数 */
+ listener: OnPauseCallback
): void
- /** [RecorderManager.onResume(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.onResume.html)
+ /** [RecorderManager.onResume(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.onResume.html)
+ *
+ * 在插件中使用:支持
*
* 监听录音继续事件 */
onResume(
- /** 录音继续事件的回调函数 */
- callback: OnResumeCallback
+ /** 录音继续事件的监听函数 */
+ listener: OnResumeCallback
): void
- /** [RecorderManager.onStart(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.onStart.html)
+ /** [RecorderManager.onStart(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.onStart.html)
+ *
+ * 在插件中使用:支持
*
* 监听录音开始事件 */
onStart(
- /** 录音开始事件的回调函数 */
- callback: OnStartCallback
+ /** 录音开始事件的监听函数 */
+ listener: OnStartCallback
): void
- /** [RecorderManager.onStop(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.onStop.html)
+ /** [RecorderManager.onStop(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.onStop.html)
+ *
+ * 在插件中使用:支持
*
* 监听录音结束事件 */
onStop(
- /** 录音结束事件的回调函数 */
- callback: RecorderManagerOnStopCallback
+ /** 录音结束事件的监听函数 */
+ listener: RecorderManagerOnStopCallback
): void
/** [RecorderManager.pause()](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.pause.html)
+ *
+ * 在插件中使用:支持
*
* 暂停录音 */
pause(): void
/** [RecorderManager.resume()](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.resume.html)
+ *
+ * 在插件中使用:支持
*
* 继续录音 */
resume(): void
/** [RecorderManager.start(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.start.html)
+ *
+ * 在插件中使用:支持
*
* 开始录音
*
* **采样率与编码码率限制**
*
- *
* 每种采样率有对应的编码码率范围有效值,设置不合法的采样率或编码码率会导致录音失败,具体对应关系如下表。
*
* | 采样率 | 编码码率 |
@@ -10927,6 +20231,8 @@ Page({
* | 48000 | 64000 ~ 320000 | */
start(option: RecorderManagerStartOption): void
/** [RecorderManager.stop()](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.stop.html)
+ *
+ * 在插件中使用:支持
*
* 停止录音 */
stop(): void
@@ -10934,81 +20240,168 @@ Page({
interface RequestTask {
/** [RequestTask.abort()](https://developers.weixin.qq.com/miniprogram/dev/api/network/request/RequestTask.abort.html)
*
- * 中断请求任务
+ * 需要基础库: `1.4.0`
*
- * 最低基础库: `1.4.0` */
+ * 在插件中使用:支持
+ *
+ * 中断请求任务 */
abort(): void
- /** [RequestTask.offHeadersReceived(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/request/RequestTask.offHeadersReceived.html)
- *
- * 取消监听 HTTP Response Header 事件
- *
- * 最低基础库: `2.1.0` */
- offHeadersReceived(
- /** HTTP Response Header 事件的回调函数 */
- callback?: OffHeadersReceivedCallback
+ /** [RequestTask.offChunkReceived(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/request/RequestTask.offChunkReceived.html)
+*
+* 需要基础库: `2.20.1`
+*
+* 在插件中使用:支持
+*
+* 移除 Transfer-Encoding Chunk Received 事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+RequestTask.onChunkReceived(listener)
+RequestTask.offChunkReceived(listener) // 需传入与监听时同一个的函数对象
+``` */
+ offChunkReceived(
+ /** onChunkReceived 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffChunkReceivedCallback
): void
- /** [RequestTask.onHeadersReceived(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/request/RequestTask.onHeadersReceived.html)
+ /** [RequestTask.offHeadersReceived(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/request/RequestTask.offHeadersReceived.html)
+*
+* 需要基础库: `2.1.0`
+*
+* 在插件中使用:支持
+*
+* 移除 HTTP Response Header 事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+RequestTask.onHeadersReceived(listener)
+RequestTask.offHeadersReceived(listener) // 需传入与监听时同一个的函数对象
+``` */
+ offHeadersReceived(
+ /** onHeadersReceived 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: RequestTaskOffHeadersReceivedCallback
+ ): void
+ /** [RequestTask.onChunkReceived(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/request/RequestTask.onChunkReceived.html)
*
- * 监听 HTTP Response Header 事件。会比请求完成事件更早
+ * 需要基础库: `2.20.1`
*
- * 最低基础库: `2.1.0` */
+ * 在插件中使用:支持
+ *
+ * 监听 Transfer-Encoding Chunk Received 事件。当接收到新的chunk时触发。 */
+ onChunkReceived(
+ /** Transfer-Encoding Chunk Received 事件的监听函数 */
+ listener: OnChunkReceivedCallback
+ ): void
+ /** [RequestTask.onHeadersReceived(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/request/RequestTask.onHeadersReceived.html)
+ *
+ * 需要基础库: `2.1.0`
+ *
+ * 在插件中使用:支持
+ *
+ * 监听 HTTP Response Header 事件。会比请求完成事件更早 */
onHeadersReceived(
- /** HTTP Response Header 事件的回调函数 */
- callback: OnHeadersReceivedCallback
+ /** HTTP Response Header 事件的监听函数 */
+ listener: RequestTaskOnHeadersReceivedCallback
): void
}
interface RewardedVideoAd {
/** [Promise RewardedVideoAd.load()](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.load.html)
+ *
+ * 在插件中使用:不支持
*
* 加载激励视频广告。 */
load(): Promise
/** [Promise RewardedVideoAd.show()](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.show.html)
+ *
+ * 在插件中使用:不支持
*
* 显示激励视频广告。激励视频广告将从屏幕下方推入。 */
show(): Promise
/** [RewardedVideoAd.destroy()](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.destroy.html)
*
- * 销毁激励视频广告实例。
+ * 需要基础库: `2.8.0`
*
- * 最低基础库: `2.8.0` */
+ * 在插件中使用:不支持
+ *
+ * 销毁激励视频广告实例。 */
destroy(): void
- /** [RewardedVideoAd.offClose(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.offClose.html)
- *
- * 取消监听用户点击 `关闭广告` 按钮的事件 */
+ /** [RewardedVideoAd.offClose(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.offClose.html)
+*
+* 在插件中使用:不支持
+*
+* 移除用户点击 `关闭广告` 按钮的事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+RewardedVideoAd.onClose(listener)
+RewardedVideoAd.offClose(listener) // 需传入与监听时同一个的函数对象
+``` */
offClose(
- /** 用户点击 `关闭广告` 按钮的事件的回调函数 */
- callback?: RewardedVideoAdOffCloseCallback
+ /** onClose 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: RewardedVideoAdOffCloseCallback
): void
- /** [RewardedVideoAd.offError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.offError.html)
- *
- * 取消监听激励视频错误事件 */
+ /** [RewardedVideoAd.offError(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.offError.html)
+*
+* 在插件中使用:不支持
+*
+* 移除激励视频错误事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+RewardedVideoAd.onError(listener)
+RewardedVideoAd.offError(listener) // 需传入与监听时同一个的函数对象
+``` */
offError(
- /** 激励视频错误事件的回调函数 */
- callback?: RewardedVideoAdOffErrorCallback
+ /** onError 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: RewardedVideoAdOffErrorCallback
): void
- /** [RewardedVideoAd.offLoad(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.offLoad.html)
- *
- * 取消监听激励视频广告加载事件 */
+ /** [RewardedVideoAd.offLoad(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.offLoad.html)
+*
+* 在插件中使用:不支持
+*
+* 移除激励视频广告加载事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+RewardedVideoAd.onLoad(listener)
+RewardedVideoAd.offLoad(listener) // 需传入与监听时同一个的函数对象
+``` */
offLoad(
- /** 激励视频广告加载事件的回调函数 */
- callback?: OffLoadCallback
+ /** onLoad 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffLoadCallback
): void
- /** [RewardedVideoAd.onClose(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.onClose.html)
+ /** [RewardedVideoAd.onClose(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.onClose.html)
+ *
+ * 在插件中使用:不支持
*
* 监听用户点击 `关闭广告` 按钮的事件。 */
onClose(
- /** 用户点击 `关闭广告` 按钮的事件的回调函数 */
- callback: RewardedVideoAdOnCloseCallback
+ /** 用户点击 `关闭广告` 按钮的事件的监听函数 */
+ listener: RewardedVideoAdOnCloseCallback
): void
- /** [RewardedVideoAd.onError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.onError.html)
+ /** [RewardedVideoAd.onError(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.onError.html)
+ *
+ * 在插件中使用:不支持
*
* 监听激励视频错误事件。
*
* **错误码信息与解决方案表**
*
- *
- * 错误码是通过onError获取到的错误信息。调试期间,可以通过异常返回来捕获信息。
- * 在小程序发布上线之后,如果遇到异常问题,可以在[“运维中心“](https://mp.weixin.qq.com/)里面搜寻错误日志,还可以针对异常返回加上适当的监控信息。
+ * 错误码是通过onError获取到的错误信息。调试期间,可以通过异常返回来捕获信息。可以针对异常返回加上适当的监控信息辅助排查现网情况。
*
* | 代码 | 异常情况 | 理由 | 解决方案 |
* | ------ | -------------- | --------------- | -------------------------- |
@@ -11019,39 +20412,86 @@ Page({
* | 1004 | 无适合的广告 | 广告不是每一次都会出现,这次没有出现可能是由于该用户不适合浏览广告 | 属于正常情况,且开发者需要针对这种情况做形态上的兼容。 |
* | 1005 | 广告组件审核中 | 你的广告正在被审核,无法展现广告 | 请前往mp.weixin.qq.com确认审核状态,且开发者需要针对这种情况做形态上的兼容。|
* | 1006 | 广告组件被驳回 | 你的广告审核失败,无法展现广告 | 请前往mp.weixin.qq.com确认审核状态,且开发者需要针对这种情况做形态上的兼容。|
- * | 1007 | 广告组件被驳回 | 你的广告能力已经被封禁,封禁期间无法展现广告 | 请前往mp.weixin.qq.com确认小程序广告封禁状态。 |
+ * | 1007 | 广告组件被封禁 | 你的广告能力已经被封禁,封禁期间无法展现广告 | 请前往mp.weixin.qq.com确认小程序广告封禁状态。 |
* | 1008 | 广告单元已关闭 | 该广告位的广告能力已经被关闭 | 请前往mp.weixin.qq.com重新打开对应广告位的展现。| */
onError(
- /** 激励视频错误事件的回调函数 */
- callback: RewardedVideoAdOnErrorCallback
+ /** 激励视频错误事件的监听函数 */
+ listener: RewardedVideoAdOnErrorCallback
): void
- /** [RewardedVideoAd.onLoad(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.onLoad.html)
+ /** [RewardedVideoAd.onLoad(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.onLoad.html)
+ *
+ * 在插件中使用:不支持
*
* 监听激励视频广告加载事件。 */
onLoad(
- /** 激励视频广告加载事件的回调函数 */
- callback: OnLoadCallback
+ /** 激励视频广告加载事件的监听函数 */
+ listener: OnLoadCallback
): void
}
- interface ScrollViewContext {
- /** [ScrollViewContext.scrollIntoView(string selector)](https://developers.weixin.qq.com/miniprogram/dev/api/media/scrollview/ScrollViewContext.scrollIntoView.html)
- *
- * 滚动至指定位置
- *
- * 最低基础库: `2.14.4` */
- scrollIntoView(
- /** 元素选择器 */
- selector: string
+ interface Router {
+ /** [router.addRouteBuilder(string routeType, function routeBuilder)](https://developers.weixin.qq.com/miniprogram/dev/api/route/router/base/router.addRouteBuilder.html)
+*
+* 在插件中使用:不支持
+*
+* 添加自定义路由配置
+*
+* **自定义路由示例**
+*
+* [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/y1IbQpmA7wGZ)
+*
+* ```js
+// 定义自定义效果,从右侧推入
+const slideRouteBuilder = (customRouteContext) => {
+ const { primaryAnimation } = customRouteContext
+ const handlePrimaryAnimation = () => {
+ 'worklet'
+ const transX = windowWidth * (1 - primaryAnimation.value)
+ return {
+ transform: `translateX(${transX}px)`,
+ }
+ }
+ return {
+ handlePrimaryAnimation
+ }
+}
+
+wx.router.addRouteBuilder('slide', slideRouteBuilder)
+
+// 使用自定义路由
+wx.navigateTo({
+ url: 'xxx',
+ routeType: 'slide'
+})
+``` */
+ addRouteBuilder(
+ /** 路由类型 */
+ routeType: string,
+ /** [路由动画定义函数](#) */
+ routeBuilder: CustomRouteBuilder
): void
- /** [ScrollViewContext.scrollTo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/scrollview/ScrollViewContext.scrollTo.html)
+ /** [router.getRouteContext(Object this)](https://developers.weixin.qq.com/miniprogram/dev/api/route/router/base/router.getRouteContext.html)
*
- * 滚动至指定位置
+ * 在插件中使用:不支持
*
- * 最低基础库: `2.14.4` */
- scrollTo(option: ScrollToOption): void
+ * 获取页面对应的自定义路由上下文对象 */
+ getRouteContext(
+ /** 页面/自定义组件实例 */
+ component: Component.TrivialInstance | Page.TrivialInstance
+ ): void
+ /** [router.removeRouteBuilder(string routeType)](https://developers.weixin.qq.com/miniprogram/dev/api/route/router/base/router.removeRouteBuilder.html)
+ *
+ * 在插件中使用:不支持
+ *
+ * 移除自定义路由配置 */
+ removeRouteBuilder(
+ /** 路由类型 */
+ routeType: string
+ ): void
}
interface SelectorQuery {
/** [[NodesRef](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/NodesRef.html) SelectorQuery.exec(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.exec.html)
+ *
+ * 在插件中使用:支持
*
* 执行所有的请求。请求结果按请求次序构成数组,在callback的第一个参数中返回。 */
exec(
@@ -11059,12 +20499,13 @@ Page({
callback?: (...args: any[]) => any
): NodesRef
/** [[NodesRef](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/NodesRef.html) SelectorQuery.select(string selector)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.select.html)
+ *
+ * 在插件中使用:支持
*
* 在当前页面下选择第一个匹配选择器 `selector` 的节点。返回一个 `NodesRef` 对象实例,可以用于获取节点信息。
*
* **selector 语法**
*
- *
* selector类似于 CSS 的选择器,但仅支持下列语法。
*
* - ID选择器:#the-id
@@ -11078,12 +20519,13 @@ Page({
selector: string
): NodesRef
/** [[NodesRef](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/NodesRef.html) SelectorQuery.selectAll(string selector)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.selectAll.html)
+ *
+ * 在插件中使用:支持
*
* 在当前页面下选择匹配选择器 selector 的所有节点。
*
* **selector 语法**
*
- *
* selector类似于 CSS 的选择器,但仅支持下列语法。
*
* - ID选择器:#the-id
@@ -11097,16 +20539,21 @@ Page({
selector: string
): NodesRef
/** [[NodesRef](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/NodesRef.html) SelectorQuery.selectViewport()](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.selectViewport.html)
+ *
+ * 在插件中使用:支持
*
* 选择显示区域。可用于获取显示区域的尺寸、滚动位置等信息。 */
selectViewport(): NodesRef
/** [[SelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html) SelectorQuery.in(Component component)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.in.html)
*
+* 需要基础库: `1.6.0`
+*
+* 在插件中使用:支持
+*
* 将选择器的选取范围更改为自定义组件 `component` 内。(初始时,选择器仅选取页面范围的节点,不会选取任何自定义组件中的节点)。
*
* **示例代码**
*
-*
* ```js
Component({
queryMultipleNodes (){
@@ -11116,9 +20563,7 @@ Component({
}).exec()
}
})
-```
-*
-* 最低基础库: `1.6.0` */
+``` */
in(
/** 自定义组件实例 */
component: Component.TrivialInstance | Page.TrivialInstance
@@ -11126,239 +20571,638 @@ Component({
}
interface SocketTask {
/** [SocketTask.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.close.html)
+ *
+ * 在插件中使用:支持
*
* 关闭 WebSocket 连接 */
close(option: SocketTaskCloseOption): void
- /** [SocketTask.onClose(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.onClose.html)
+ /** [SocketTask.onClose(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.onClose.html)
+ *
+ * 在插件中使用:支持
*
* 监听 WebSocket 连接关闭事件 */
onClose(
- /** WebSocket 连接关闭事件的回调函数 */
- callback: SocketTaskOnCloseCallback
+ /** WebSocket 连接关闭事件的监听函数 */
+ listener: SocketTaskOnCloseCallback
): void
- /** [SocketTask.onError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.onError.html)
+ /** [SocketTask.onError(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.onError.html)
+ *
+ * 在插件中使用:支持
*
* 监听 WebSocket 错误事件 */
onError(
- /** WebSocket 错误事件的回调函数 */
- callback: UDPSocketOnErrorCallback
+ /** WebSocket 错误事件的监听函数 */
+ listener: UDPSocketOnErrorCallback
): void
- /** [SocketTask.onMessage(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.onMessage.html)
+ /** [SocketTask.onMessage(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.onMessage.html)
*
- * 监听 WebSocket 接受到服务器的消息事件 */
+ * 在插件中使用:支持
+ *
+ * 监听 WebSocket 接收到服务器的消息事件 */
onMessage(
- /** WebSocket 接受到服务器的消息事件的回调函数 */
- callback: SocketTaskOnMessageCallback
+ /** WebSocket 接收到服务器的消息事件的监听函数 */
+ listener: SocketTaskOnMessageCallback
): void
- /** [SocketTask.onOpen(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.onOpen.html)
+ /** [SocketTask.onOpen(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.onOpen.html)
+ *
+ * 在插件中使用:支持
*
* 监听 WebSocket 连接打开事件 */
onOpen(
- /** WebSocket 连接打开事件的回调函数 */
- callback: OnOpenCallback
+ /** WebSocket 连接打开事件的监听函数 */
+ listener: OnOpenCallback
): void
/** [SocketTask.send(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.send.html)
+ *
+ * 在插件中使用:支持
*
* 通过 WebSocket 连接发送数据 */
send(option: SocketTaskSendOption): void
}
- interface Stats {
- /** [boolean Stats.isDirectory()](https://developers.weixin.qq.com/miniprogram/dev/api/file/Stats.isDirectory.html)
+ interface TCPSocket {
+ /** [TCPSocket.bindWifi(Object options)](https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.bindWifi.html)
*
- * 判断当前文件是否一个目录 */
- isDirectory(): boolean
- /** [boolean Stats.isFile()](https://developers.weixin.qq.com/miniprogram/dev/api/file/Stats.isFile.html)
+ * 需要基础库: `2.25.0`
*
- * 判断当前文件是否一个普通文件 */
- isFile(): boolean
+ * 在插件中使用:不支持
+ *
+ * 将 TCP Socket 绑定到当前 wifi 网络,成功后会触发 onBindWifi 事件(仅安卓支持) */
+ bindWifi(options: BindWifiOption): void
+ /** [TCPSocket.close()](https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.close.html)
+ *
+ * 在插件中使用:不支持
+ *
+ * 关闭连接 */
+ close(): void
+ /** [TCPSocket.connect(Object options)](https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.connect.html)
+ *
+ * 在插件中使用:不支持
+ *
+ * 在给定的套接字上启动连接 */
+ connect(options: TCPSocketConnectOption): void
+ /** [TCPSocket.offBindWifi(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.offBindWifi.html)
+*
+* 需要基础库: `2.25.0`
+*
+* 在插件中使用:不支持
+*
+* 移除当一个 socket 绑定当前 wifi 网络成功时触发该事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+TCPSocket.onBindWifi(listener)
+TCPSocket.offBindWifi(listener) // 需传入与监听时同一个的函数对象
+``` */
+ offBindWifi(
+ /** onBindWifi 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffBindWifiCallback
+ ): void
+ /** [TCPSocket.offClose(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.offClose.html)
+*
+* 在插件中使用:不支持
+*
+* 移除一旦 socket 完全关闭就发出该事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+TCPSocket.onClose(listener)
+TCPSocket.offClose(listener) // 需传入与监听时同一个的函数对象
+``` */
+ offClose(
+ /** onClose 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: UDPSocketOffCloseCallback
+ ): void
+ /** [TCPSocket.offConnect(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.offConnect.html)
+*
+* 在插件中使用:不支持
+*
+* 移除当一个 socket 连接成功建立的时候触发该事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+TCPSocket.onConnect(listener)
+TCPSocket.offConnect(listener) // 需传入与监听时同一个的函数对象
+``` */
+ offConnect(
+ /** onConnect 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffConnectCallback
+ ): void
+ /** [TCPSocket.offError(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.offError.html)
+*
+* 在插件中使用:不支持
+*
+* 移除当错误发生时触发的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+TCPSocket.onError(listener)
+TCPSocket.offError(listener) // 需传入与监听时同一个的函数对象
+``` */
+ offError(
+ /** onError 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: UDPSocketOffErrorCallback
+ ): void
+ /** [TCPSocket.offMessage(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.offMessage.html)
+*
+* 在插件中使用:不支持
+*
+* 移除当接收到数据的时触发该事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+TCPSocket.onMessage(listener)
+TCPSocket.offMessage(listener) // 需传入与监听时同一个的函数对象
+``` */
+ offMessage(
+ /** onMessage 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: TCPSocketOffMessageCallback
+ ): void
+ /** [TCPSocket.onBindWifi(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.onBindWifi.html)
+ *
+ * 需要基础库: `2.25.0`
+ *
+ * 在插件中使用:不支持
+ *
+ * 监听当一个 socket 绑定当前 wifi 网络成功时触发该事件 */
+ onBindWifi(
+ /** 当一个 socket 绑定当前 wifi 网络成功时触发该事件的监听函数 */
+ listener: OnBindWifiCallback
+ ): void
+ /** [TCPSocket.onClose(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.onClose.html)
+ *
+ * 在插件中使用:不支持
+ *
+ * 监听一旦 socket 完全关闭就发出该事件 */
+ onClose(
+ /** 一旦 socket 完全关闭就发出该事件的监听函数 */
+ listener: UDPSocketOnCloseCallback
+ ): void
+ /** [TCPSocket.onConnect(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.onConnect.html)
+ *
+ * 在插件中使用:不支持
+ *
+ * 监听当一个 socket 连接成功建立的时候触发该事件 */
+ onConnect(
+ /** 当一个 socket 连接成功建立的时候触发该事件的监听函数 */
+ listener: OnConnectCallback
+ ): void
+ /** [TCPSocket.onError(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.onError.html)
+ *
+ * 在插件中使用:不支持
+ *
+ * 监听当错误发生时触发 */
+ onError(
+ /** 的监听函数 */
+ listener: UDPSocketOnErrorCallback
+ ): void
+ /** [TCPSocket.onMessage(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.onMessage.html)
+ *
+ * 在插件中使用:不支持
+ *
+ * 监听当接收到数据的时触发该事件 */
+ onMessage(
+ /** 当接收到数据的时触发该事件的监听函数 */
+ listener: TCPSocketOnMessageCallback
+ ): void
+ /** [TCPSocket.write(string|ArrayBuffer data)](https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.write.html)
+ *
+ * 在插件中使用:不支持
+ *
+ * 在 socket 上发送数据 */
+ write(
+ /** 要发送的数据 */
+ data: string | ArrayBuffer
+ ): void
}
interface UDPSocket {
/** [UDPSocket.close()](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.close.html)
+ *
+ * 在插件中使用:需要基础库 `2.11.1`
*
* 关闭 UDP Socket 实例,相当于销毁。 在关闭之后,UDP Socket 实例不能再发送消息,每次调用 `UDPSocket.send` 将会触发错误事件,并且 message 事件回调函数也不会再也执行。在 `UDPSocket` 实例被创建后将被 Native 强引用,保证其不被 GC。在 `UDPSocket.close` 后将解除对其的强引用,让 UDPSocket 实例遵从 GC。 */
close(): void
- /** [UDPSocket.offClose(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.offClose.html)
+ /** [UDPSocket.connect(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.connect.html)
*
- * 取消监听关闭事件 */
+ * 需要基础库: `2.15.0`
+ *
+ * 在插件中使用:需要基础库 `2.11.1`
+ *
+ * 预先连接到指定的 IP 和 port,需要配合 write 方法一起使用 */
+ connect(option: UDPSocketConnectOption): void
+ /** [UDPSocket.offClose(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.offClose.html)
+*
+* 在插件中使用:需要基础库 `2.11.1`
+*
+* 移除关闭事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+UDPSocket.onClose(listener)
+UDPSocket.offClose(listener) // 需传入与监听时同一个的函数对象
+``` */
offClose(
- /** 关闭事件的回调函数 */
- callback?: UDPSocketOffCloseCallback
+ /** onClose 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: UDPSocketOffCloseCallback
): void
- /** [UDPSocket.offError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.offError.html)
- *
- * 取消监听错误事件 */
+ /** [UDPSocket.offError(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.offError.html)
+*
+* 在插件中使用:需要基础库 `2.11.1`
+*
+* 移除错误事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+UDPSocket.onError(listener)
+UDPSocket.offError(listener) // 需传入与监听时同一个的函数对象
+``` */
offError(
- /** 错误事件的回调函数 */
- callback?: UDPSocketOffErrorCallback
+ /** onError 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: UDPSocketOffErrorCallback
): void
- /** [UDPSocket.offListening(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.offListening.html)
- *
- * 取消监听开始监听数据包消息的事件 */
+ /** [UDPSocket.offListening(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.offListening.html)
+*
+* 在插件中使用:需要基础库 `2.11.1`
+*
+* 移除开始监听数据包消息的事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+UDPSocket.onListening(listener)
+UDPSocket.offListening(listener) // 需传入与监听时同一个的函数对象
+``` */
offListening(
- /** 开始监听数据包消息的事件的回调函数 */
- callback?: OffListeningCallback
+ /** onListening 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffListeningCallback
): void
- /** [UDPSocket.offMessage(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.offMessage.html)
- *
- * 取消监听收到消息的事件 */
+ /** [UDPSocket.offMessage(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.offMessage.html)
+*
+* 在插件中使用:需要基础库 `2.11.1`
+*
+* 移除收到消息的事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+UDPSocket.onMessage(listener)
+UDPSocket.offMessage(listener) // 需传入与监听时同一个的函数对象
+``` */
offMessage(
- /** 收到消息的事件的回调函数 */
- callback?: OffMessageCallback
+ /** onMessage 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: UDPSocketOffMessageCallback
): void
- /** [UDPSocket.onClose(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.onClose.html)
+ /** [UDPSocket.onClose(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.onClose.html)
+ *
+ * 在插件中使用:需要基础库 `2.11.1`
*
* 监听关闭事件 */
onClose(
- /** 关闭事件的回调函数 */
- callback: UDPSocketOnCloseCallback
+ /** 关闭事件的监听函数 */
+ listener: UDPSocketOnCloseCallback
): void
- /** [UDPSocket.onError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.onError.html)
+ /** [UDPSocket.onError(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.onError.html)
+ *
+ * 在插件中使用:需要基础库 `2.11.1`
*
* 监听错误事件 */
onError(
- /** 错误事件的回调函数 */
- callback: UDPSocketOnErrorCallback
+ /** 错误事件的监听函数 */
+ listener: UDPSocketOnErrorCallback
): void
- /** [UDPSocket.onListening(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.onListening.html)
+ /** [UDPSocket.onListening(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.onListening.html)
+ *
+ * 在插件中使用:需要基础库 `2.11.1`
*
* 监听开始监听数据包消息的事件 */
onListening(
- /** 开始监听数据包消息的事件的回调函数 */
- callback: OnListeningCallback
+ /** 开始监听数据包消息的事件的监听函数 */
+ listener: OnListeningCallback
): void
- /** [UDPSocket.onMessage(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.onMessage.html)
+ /** [UDPSocket.onMessage(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.onMessage.html)
+ *
+ * 在插件中使用:需要基础库 `2.11.1`
*
* 监听收到消息的事件 */
onMessage(
- /** 收到消息的事件的回调函数 */
- callback: UDPSocketOnMessageCallback
+ /** 收到消息的事件的监听函数 */
+ listener: UDPSocketOnMessageCallback
): void
/** [UDPSocket.send(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.send.html)
*
- * 向指定的 IP 和 port 发送消息 */
+ * 在插件中使用:需要基础库 `2.11.1`
+ *
+ * 向指定的 IP 和 port 发送消息。基础库 2.9.0 起支持广播 (指定地址为 255.255.255.255)。 */
send(option: UDPSocketSendOption): void
+ /** [UDPSocket.setTTL(number ttl)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.setTTL.html)
+ *
+ * 需要基础库: `2.18.0`
+ *
+ * 在插件中使用:支持
+ *
+ * 设置 IP_TTL 套接字选项,用于设置一个 IP 数据包传输时允许的最大跳步数 */
+ setTTL(
+ /** ttl 参数可以是 0 到 255 之间 */
+ ttl: number
+ ): void
+ /** [UDPSocket.write(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.write.html)
+ *
+ * 需要基础库: `2.15.0`
+ *
+ * 在插件中使用:需要基础库 `2.11.1`
+ *
+ * 用法与 send 方法相同,如果没有预先调用 connect 则与 send 无差异(注意即使调用了 connect 也需要在本接口填入地址和端口参数) */
+ write(option: UDPSocketSendOption): void
/** [number UDPSocket.bind(number port)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.bind.html)
+ *
+ * 在插件中使用:需要基础库 `2.11.1`
*
* 绑定一个系统随机分配的可用端口,或绑定一个指定的端口号 */
bind(
- /** 指定要绑定的端口号,不传则返回系统随机分配的可用端口
+ /** 需要基础库: `2.9.0`
*
- * 最低基础库: `2.9.0` */
+ * 指定要绑定的端口号,不传则返回系统随机分配的可用端口 */
port?: number
): number
}
interface UpdateManager {
/** [UpdateManager.applyUpdate()](https://developers.weixin.qq.com/miniprogram/dev/api/base/update/UpdateManager.applyUpdate.html)
*
- * 强制小程序重启并使用新版本。在小程序新版本下载完成后(即收到 `onUpdateReady` 回调)调用。 */
+ * 在插件中使用:不支持
+ *
+ * 强制小程序重启并使用新版本。在小程序新版本下载完成后(即收到 `onUpdateReady` 回调)调用。
+ *
+ * **示例代码**
+ *
+ * [示例代码](https://developers.weixin.qq.com/miniprogram/dev/api/base/update/UpdateManager.html#示例代码) */
applyUpdate(): void
- /** [UpdateManager.onCheckForUpdate(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/update/UpdateManager.onCheckForUpdate.html)
+ /** [UpdateManager.onCheckForUpdate(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/update/UpdateManager.onCheckForUpdate.html)
*
- * 监听向微信后台请求检查更新结果事件。微信在小程序冷启动时自动检查更新,不需由开发者主动触发。 */
+ * 在插件中使用:不支持
+ *
+ * 监听向微信后台请求检查更新结果事件。微信在小程序每次启动(包括热启动)时自动检查更新,不需由开发者主动触发。
+ *
+ * **示例代码**
+ *
+ * [示例代码](https://developers.weixin.qq.com/miniprogram/dev/api/base/update/UpdateManager.html#示例代码) */
onCheckForUpdate(
- /** 向微信后台请求检查更新结果事件的回调函数 */
- callback: OnCheckForUpdateCallback
+ /** 向微信后台请求检查更新结果事件的监听函数 */
+ listener: OnCheckForUpdateCallback
): void
- /** [UpdateManager.onUpdateFailed(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/update/UpdateManager.onUpdateFailed.html)
+ /** [UpdateManager.onUpdateFailed(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/update/UpdateManager.onUpdateFailed.html)
*
- * 监听小程序更新失败事件。小程序有新版本,客户端主动触发下载(无需开发者触发),下载失败(可能是网络原因等)后回调 */
+ * 在插件中使用:不支持
+ *
+ * 监听小程序更新失败事件。小程序有新版本,客户端主动触发下载(无需开发者触发),下载失败(可能是网络原因等)后回调
+ *
+ * **示例代码**
+ *
+ * [示例代码](https://developers.weixin.qq.com/miniprogram/dev/api/base/update/UpdateManager.html#示例代码) */
onUpdateFailed(
- /** 小程序更新失败事件的回调函数 */
- callback: OnUpdateFailedCallback
+ /** 小程序更新失败事件的监听函数 */
+ listener: OnUpdateFailedCallback
): void
- /** [UpdateManager.onUpdateReady(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/update/UpdateManager.onUpdateReady.html)
+ /** [UpdateManager.onUpdateReady(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/update/UpdateManager.onUpdateReady.html)
*
- * 监听小程序有版本更新事件。客户端主动触发下载(无需开发者触发),下载成功后回调 */
+ * 在插件中使用:不支持
+ *
+ * 监听小程序有版本更新事件。客户端主动触发下载(无需开发者触发),下载成功后回调
+ *
+ * **示例代码**
+ *
+ * [示例代码](https://developers.weixin.qq.com/miniprogram/dev/api/base/update/UpdateManager.html#示例代码) */
onUpdateReady(
- /** 小程序有版本更新事件的回调函数 */
- callback: OnUpdateReadyCallback
+ /** 小程序有版本更新事件的监听函数 */
+ listener: OnUpdateReadyCallback
): void
}
interface UploadTask {
/** [UploadTask.abort()](https://developers.weixin.qq.com/miniprogram/dev/api/network/upload/UploadTask.abort.html)
*
- * 中断上传任务
+ * 需要基础库: `1.4.0`
*
- * 最低基础库: `1.4.0` */
+ * 在插件中使用:支持
+ *
+ * 中断上传任务 */
abort(): void
- /** [UploadTask.offHeadersReceived(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/upload/UploadTask.offHeadersReceived.html)
- *
- * 取消监听 HTTP Response Header 事件
- *
- * 最低基础库: `2.1.0` */
+ /** [UploadTask.offHeadersReceived(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/upload/UploadTask.offHeadersReceived.html)
+*
+* 需要基础库: `2.1.0`
+*
+* 在插件中使用:支持
+*
+* 移除 HTTP Response Header 事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+UploadTask.onHeadersReceived(listener)
+UploadTask.offHeadersReceived(listener) // 需传入与监听时同一个的函数对象
+``` */
offHeadersReceived(
- /** HTTP Response Header 事件的回调函数 */
- callback?: OffHeadersReceivedCallback
+ /** onHeadersReceived 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: DownloadTaskOffHeadersReceivedCallback
): void
- /** [UploadTask.offProgressUpdate(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/upload/UploadTask.offProgressUpdate.html)
- *
- * 取消监听上传进度变化事件
- *
- * 最低基础库: `2.1.0` */
+ /** [UploadTask.offProgressUpdate(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/upload/UploadTask.offProgressUpdate.html)
+*
+* 需要基础库: `2.1.0`
+*
+* 在插件中使用:支持
+*
+* 移除上传进度变化事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+UploadTask.onProgressUpdate(listener)
+UploadTask.offProgressUpdate(listener) // 需传入与监听时同一个的函数对象
+``` */
offProgressUpdate(
- /** 上传进度变化事件的回调函数 */
- callback?: UploadTaskOffProgressUpdateCallback
+ /** onProgressUpdate 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: UploadTaskOffProgressUpdateCallback
): void
- /** [UploadTask.onHeadersReceived(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/upload/UploadTask.onHeadersReceived.html)
+ /** [UploadTask.onHeadersReceived(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/upload/UploadTask.onHeadersReceived.html)
*
- * 监听 HTTP Response Header 事件。会比请求完成事件更早
+ * 需要基础库: `2.1.0`
*
- * 最低基础库: `2.1.0` */
+ * 在插件中使用:支持
+ *
+ * 监听 HTTP Response Header 事件。会比请求完成事件更早 */
onHeadersReceived(
- /** HTTP Response Header 事件的回调函数 */
- callback: OnHeadersReceivedCallback
+ /** HTTP Response Header 事件的监听函数 */
+ listener: DownloadTaskOnHeadersReceivedCallback
): void
- /** [UploadTask.onProgressUpdate(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/upload/UploadTask.onProgressUpdate.html)
+ /** [UploadTask.onProgressUpdate(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/upload/UploadTask.onProgressUpdate.html)
*
- * 监听上传进度变化事件
+ * 需要基础库: `1.4.0`
*
- * 最低基础库: `1.4.0` */
+ * 在插件中使用:支持
+ *
+ * 监听上传进度变化事件 */
onProgressUpdate(
- /** 上传进度变化事件的回调函数 */
- callback: UploadTaskOnProgressUpdateCallback
+ /** 上传进度变化事件的监听函数 */
+ listener: UploadTaskOnProgressUpdateCallback
): void
}
+ interface UserCryptoManager {
+ /** [UserCryptoManager.getLatestUserKey(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/base/crypto/UserCryptoManager.getLatestUserKey.html)
+*
+* 需要基础库: `2.17.3`
+*
+* 在插件中使用:不支持
+*
+* 获取最新的用户加密密钥
+*
+* **示例代码**
+*
+* ```js
+const userCryptoManager = wx.getUserCryptoManager()
+userCryptoManager.getLatestUserKey({
+ success: res => {
+ const {encryptKey, iv, version, expireTime} = res
+ console.log(encryptKey, iv, version, expireTime)
+ }
+})
+``` */
+ getLatestUserKey(option?: GetLatestUserKeyOption): void
+ /** [UserCryptoManager.getRandomValues(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/base/crypto/UserCryptoManager.getRandomValues.html)
+*
+* 需要基础库: `2.17.3`
+*
+* 在插件中使用:不支持
+*
+* 获取密码学安全随机数
+*
+* **示例代码**
+*
+* ```js
+const userCryptoManager = wx.getUserCryptoManager()
+userCryptoManager.getRandomValues({
+ length: 6 // 生成 6 个字节长度的随机数,
+ success: res => {
+ // 转成 base64 字符串伪代码 arrayBufferToBase64(res.randomValues)
+ }
+})
+``` */
+ getRandomValues(option: GetRandomValuesOption): void
+ }
interface VideoContext {
+ /** [VideoContext.exitBackgroundPlayback()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.exitBackgroundPlayback.html)
+ *
+ * 需要基础库: `2.14.3`
+ *
+ * 在插件中使用:支持
+ *
+ * 退出后台音频播放模式。 */
+ exitBackgroundPlayback(): void
+ /** [VideoContext.exitCasting()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.exitCasting.html)
+ *
+ * 需要基础库: `2.32.0`
+ *
+ * 在插件中使用:支持
+ *
+ * 退出投屏。仅支持在 tap 事件回调内调用。 */
+ exitCasting(): void
/** [VideoContext.exitFullScreen()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.exitFullScreen.html)
*
- * 退出全屏
+ * 需要基础库: `1.4.0`
*
- * 最低基础库: `1.4.0` */
+ * 在插件中使用:支持
+ *
+ * 退出全屏 */
exitFullScreen(): void
/** [VideoContext.exitPictureInPicture(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.exitPictureInPicture.html)
+ *
+ * 在插件中使用:支持
*
* 退出小窗,该方法可在任意页面调用 */
exitPictureInPicture(option?: ExitPictureInPictureOption): void
/** [VideoContext.hideStatusBar()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.hideStatusBar.html)
*
- * 隐藏状态栏,仅在iOS全屏下有效
+ * 需要基础库: `2.1.0`
*
- * 最低基础库: `2.1.0` */
+ * 在插件中使用:支持
+ *
+ * 隐藏状态栏,仅在iOS全屏下有效 */
hideStatusBar(): void
/** [VideoContext.pause()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.pause.html)
+ *
+ * 在插件中使用:支持
*
* 暂停视频 */
pause(): void
/** [VideoContext.play()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.play.html)
+ *
+ * 在插件中使用:支持
*
* 播放视频 */
play(): void
/** [VideoContext.playbackRate(number rate)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.playbackRate.html)
*
- * 设置倍速播放
+ * 需要基础库: `1.4.0`
*
- * 最低基础库: `1.4.0` */
+ * 在插件中使用:支持
+ *
+ * 设置倍速播放 */
playbackRate(
- /** 倍率,支持 0.5/0.8/1.0/1.25/1.5,2.6.3 起支持 2.0 倍速 */
+ /** 倍率,支持 0.5/0.8/1.0/1.25/1.5,2.6.3 起支持 2.0 倍速,3.7.5 起支持 3.0/4.0 倍速 */
rate: number
): void
+ /** [VideoContext.reconnectCasting()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.reconnectCasting.html)
+ *
+ * 需要基础库: `2.32.0`
+ *
+ * 在插件中使用:支持
+ *
+ * 重连投屏设备。仅支持在 tap 事件回调内调用。 */
+ reconnectCasting(): void
+ /** [VideoContext.requestBackgroundPlayback()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.requestBackgroundPlayback.html)
+ *
+ * 需要基础库: `2.14.3`
+ *
+ * 在插件中使用:支持
+ *
+ * 进入后台音频播放模式。 */
+ requestBackgroundPlayback(): void
/** [VideoContext.requestFullScreen(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.requestFullScreen.html)
*
- * 进入全屏。若有自定义内容需在全屏时展示,需将内容节点放置到 video 节点内。
+ * 需要基础库: `1.4.0`
*
- * 最低基础库: `1.4.0` */
+ * 在插件中使用:支持
+ *
+ * 进入全屏。若有自定义内容需在全屏时展示,需将内容节点放置到 video 节点内。 */
requestFullScreen(option: VideoContextRequestFullScreenOption): void
/** [VideoContext.seek(number position)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.seek.html)
+ *
+ * 在插件中使用:支持
*
* 跳转到指定位置 */
seek(
@@ -11366,6 +21210,8 @@ Component({
position: number
): void
/** [VideoContext.sendDanmu(Object data)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.sendDanmu.html)
+ *
+ * 在插件中使用:支持
*
* 发送弹幕 */
sendDanmu(
@@ -11374,29 +21220,88 @@ Component({
): void
/** [VideoContext.showStatusBar()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.showStatusBar.html)
*
- * 显示状态栏,仅在iOS全屏下有效
+ * 需要基础库: `2.1.0`
*
- * 最低基础库: `2.1.0` */
+ * 在插件中使用:支持
+ *
+ * 显示状态栏,仅在iOS全屏下有效 */
showStatusBar(): void
+ /** [VideoContext.startCasting()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.startCasting.html)
+ *
+ * 需要基础库: `2.32.0`
+ *
+ * 在插件中使用:支持
+ *
+ * 开始投屏, 拉起半屏搜索设备。仅支持在 tap 事件回调内调用。 */
+ startCasting(): void
/** [VideoContext.stop()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.stop.html)
*
- * 停止视频
+ * 需要基础库: `1.7.0`
*
- * 最低基础库: `1.7.0` */
+ * 在插件中使用:支持
+ *
+ * 停止视频 */
stop(): void
+ /** [VideoContext.switchCasting()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.switchCasting.html)
+ *
+ * 需要基础库: `2.32.0`
+ *
+ * 在插件中使用:支持
+ *
+ * 切换投屏设备。仅支持在 tap 事件回调内调用。 */
+ switchCasting(): void
}
interface VideoDecoder {
/** [Object VideoDecoder.getFrameData()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.getFrameData.html)
*
- * 获取下一帧的解码数据
+ * 需要基础库: `2.11.0`
*
- * 最低基础库: `2.11.0` */
+ * 在插件中使用:支持
+ *
+ * 获取下一帧的解码数据 */
getFrameData(): FrameDataOptions
+ /** [Promise VideoDecoder.remove()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.remove.html)
+ *
+ * 需要基础库: `2.11.0`
+ *
+ * 在插件中使用:支持
+ *
+ * 移除解码器 */
+ remove(): Promise
+ /** [Promise VideoDecoder.seek(number position)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.seek.html)
+ *
+ * 需要基础库: `2.11.0`
+ *
+ * 在插件中使用:支持
+ *
+ * 跳到某个时间点解码 */
+ seek(
+ /** 跳转的解码位置,单位 ms */
+ position: number
+ ): Promise
+ /** [Promise VideoDecoder.start(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.start.html)
+ *
+ * 需要基础库: `2.11.0`
+ *
+ * 在插件中使用:支持
+ *
+ * 开始解码 */
+ start(option: VideoDecoderStartOption): Promise
+ /** [Promise VideoDecoder.stop()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.stop.html)
+ *
+ * 需要基础库: `2.11.0`
+ *
+ * 在插件中使用:支持
+ *
+ * 停止解码 */
+ stop(): Promise
/** [VideoDecoder.off(string eventName, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.off.html)
*
- * 取消监听录制事件。当对应事件触发时,该回调函数不再执行
+ * 需要基础库: `2.11.0`
*
- * 最低基础库: `2.11.0` */
+ * 在插件中使用:支持
+ *
+ * 取消监听录制事件。当对应事件触发时,该回调函数不再执行 */
off(
/** 事件名 */
eventName: string,
@@ -11405,9 +21310,11 @@ Component({
): void
/** [VideoDecoder.on(string eventName, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.on.html)
*
- * 注册监听录制事件的回调函数。当对应事件触发时,回调函数会被执行
+ * 需要基础库: `2.11.0`
*
- * 最低基础库: `2.11.0` */
+ * 在插件中使用:支持
+ *
+ * 注册监听录制事件的回调函数。当对应事件触发时,回调函数会被执行 */
on(
/** 事件名
*
@@ -11421,33 +21328,66 @@ Component({
/** 事件触发时执行的回调函数 */
callback: (...args: any[]) => any
): void
- /** [VideoDecoder.remove()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.remove.html)
+ }
+ interface VirtualPaymentError {
+ /** 错误信息
*
- * 移除解码器
+ * | 错误码 | 错误信息 | 说明 |
+ * | - | - | - |
+ * | 1001 | | 参数错误 |
+ * | -1 | | 支付失败 |
+ * | -2 | | 支付取消 |
+ * | -4 | | 风控拦截 |
+ * | -5 | | 开通签约结果未知 |
+ * | -15001 | | 参数错误,具体原因见err_msg |
+ * | -15002 | | outTradeNo重复使用,请换新单号重试 |
+ * | -15003 | | 系统错误 |
+ * | -15004 | | currencyType错误,目前只能填CNY |
+ * | -15005 | | 用户态签名signature错误 |
+ * | -15006 | | 支付签名paySig错误 |
+ * | -15007 | | session_key过期 |
+ * | -15008 | | 二级商户进件未完成 |
+ * | -15009 | | 代币未发布 |
+ * | -15010 | | 道具productId未发布 |
+ * | -15011 | | 现网版本的env只能是0,不能填1(沙盒环境) |
+ * | -15012 | | 调用米大师失败导致关单,请换新单号重试 |
+ * | -15013 | | goodsPrice道具价格错误 |
+ * | -15014 | | 道具/代币发布未生效,禁止下单,大概10分钟后生效 |
+ * | -15016 | | signData格式有问题 |
+ * | -15017 | | 此商家涉嫌违规,收款功能已被限制,暂无法支付。商家可以登录微信商户平台/微信支付商家助手小程序查看原因和解决方案 |
+ * | -15018 | | 代币或者道具productId审核不通过 |
+ * | -15019 | | 调微信报商户受限,商家可以登录微信商户平台/微信支付商家助手小程序查看原因和解决方案 |
+ * | -15020 | | 操作过快,请稍候再试 |
+ * | -15021 | | 小程序被限频交易 | */ errMsg: string
+ /** 错误码
*
- * 最低基础库: `2.11.0` */
- remove(): void
- /** [VideoDecoder.seek(number position)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.seek.html)
- *
- * 跳到某个时间点解码
- *
- * 最低基础库: `2.11.0` */
- seek(
- /** 跳转的解码位置,单位 ms */
- position: number
- ): void
- /** [VideoDecoder.start(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.start.html)
- *
- * 开始解码
- *
- * 最低基础库: `2.11.0` */
- start(option: VideoDecoderStartOption): void
- /** [VideoDecoder.stop()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.stop.html)
- *
- * 停止解码
- *
- * 最低基础库: `2.11.0` */
- stop(): void
+ * | 错误码 | 错误信息 | 说明 |
+ * | - | - | - |
+ * | 1001 | | 参数错误 |
+ * | -1 | | 支付失败 |
+ * | -2 | | 支付取消 |
+ * | -4 | | 风控拦截 |
+ * | -5 | | 开通签约结果未知 |
+ * | -15001 | | 参数错误,具体原因见err_msg |
+ * | -15002 | | outTradeNo重复使用,请换新单号重试 |
+ * | -15003 | | 系统错误 |
+ * | -15004 | | currencyType错误,目前只能填CNY |
+ * | -15005 | | 用户态签名signature错误 |
+ * | -15006 | | 支付签名paySig错误 |
+ * | -15007 | | session_key过期 |
+ * | -15008 | | 二级商户进件未完成 |
+ * | -15009 | | 代币未发布 |
+ * | -15010 | | 道具productId未发布 |
+ * | -15011 | | 现网版本的env只能是0,不能填1(沙盒环境) |
+ * | -15012 | | 调用米大师失败导致关单,请换新单号重试 |
+ * | -15013 | | goodsPrice道具价格错误 |
+ * | -15014 | | 道具/代币发布未生效,禁止下单,大概10分钟后生效 |
+ * | -15016 | | signData格式有问题 |
+ * | -15017 | | 此商家涉嫌违规,收款功能已被限制,暂无法支付。商家可以登录微信商户平台/微信支付商家助手小程序查看原因和解决方案 |
+ * | -15018 | | 代币或者道具productId审核不通过 |
+ * | -15019 | | 调微信报商户受限,商家可以登录微信商户平台/微信支付商家助手小程序查看原因和解决方案 |
+ * | -15020 | | 操作过快,请稍候再试 |
+ * | -15021 | | 小程序被限频交易 | */ errCode: number
}
interface WifiError {
/** 错误信息
@@ -11458,7 +21398,7 @@ Component({
* | 12000 | not init | 未先调用 `startWifi` 接口 |
* | 12001 | system not support | 当前系统不支持相关能力 |
* | 12002 | password error Wi-Fi | 密码错误 |
- * | 12003 | connection timeout | 连接超时 |
+ * | 12003 | connection timeout | 连接超时, 仅 Android 支持 |
* | 12004 | duplicate request | 重复连接 Wi-Fi |
* | 12005 | wifi not turned on | Android 特有,未打开 Wi-Fi 开关 |
* | 12006 | gps not turned on | Android 特有,未打开 GPS 定位开关 |
@@ -11467,7 +21407,8 @@ Component({
* | 12009 | system config err | 系统运营商配置拒绝连接 Wi-Fi |
* | 12010 | system internal error | 系统其他错误,需要在 errmsg 打印具体的错误原因 |
* | 12011 | weapp in background | 应用在后台无法配置 Wi-Fi |
- * | 12013 | wifi config may be expired | 系统保存的 Wi-Fi 配置过期,建议忘记 Wi-Fi 后重试 | */ errMsg: string
+ * | 12013 | wifi config may be expired | 系统保存的 Wi-Fi 配置过期,建议忘记 Wi-Fi 后重试,仅 Android 支持 |
+ * | 12014 | invalid WEP / WPA password | iOS 特有,无效的 WEP / WPA 密码 | */ errMsg: string
/** 错误码
*
* | 错误码 | 错误信息 | 说明 |
@@ -11476,7 +21417,7 @@ Component({
* | 12000 | not init | 未先调用 `startWifi` 接口 |
* | 12001 | system not support | 当前系统不支持相关能力 |
* | 12002 | password error Wi-Fi | 密码错误 |
- * | 12003 | connection timeout | 连接超时 |
+ * | 12003 | connection timeout | 连接超时, 仅 Android 支持 |
* | 12004 | duplicate request | 重复连接 Wi-Fi |
* | 12005 | wifi not turned on | Android 特有,未打开 Wi-Fi 开关 |
* | 12006 | gps not turned on | Android 特有,未打开 GPS 定位开关 |
@@ -11485,101 +21426,492 @@ Component({
* | 12009 | system config err | 系统运营商配置拒绝连接 Wi-Fi |
* | 12010 | system internal error | 系统其他错误,需要在 errmsg 打印具体的错误原因 |
* | 12011 | weapp in background | 应用在后台无法配置 Wi-Fi |
- * | 12013 | wifi config may be expired | 系统保存的 Wi-Fi 配置过期,建议忘记 Wi-Fi 后重试 | */ errCode: number
+ * | 12013 | wifi config may be expired | 系统保存的 Wi-Fi 配置过期,建议忘记 Wi-Fi 后重试,仅 Android 支持 |
+ * | 12014 | invalid WEP / WPA password | iOS 特有,无效的 WEP / WPA 密码 | */ errCode: number
}
- interface Worker {
- /** [Worker.onMessage(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/worker/Worker.onMessage.html)
- *
- * 监听主线程/Worker 线程向当前线程发送的消息的事件。 */
- onMessage(
- /** 主线程/Worker 线程向当前线程发送的消息的事件的回调函数 */
- callback: WorkerOnMessageCallback
- ): void
- /** [Worker.onProcessKilled(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/worker/Worker.onProcessKilled.html)
- *
- * 监听 worker进程被系统回收事件(当iOS系统资源紧张时,处于后台的小程序/小游戏的worker存在被系统回收的可能,开发者可监听此事件并重新创建一个worker) */
- onProcessKilled(
- /** worker进程被系统回收事件的回调函数 */
- callback: OnProcessKilledCallback
- ): void
- /** [Worker.postMessage(Object message)](https://developers.weixin.qq.com/miniprogram/dev/api/worker/Worker.postMessage.html)
+ interface Worklet {
+ /** Easing 模块实现了常见的动画缓动函数(动画效果参考 https://easings.net/ ),可从 [wx.worklet](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/wx.worklet.html) 对象中读取。
*
-* 向主线程/Worker 线程发送的消息。
+* ****
+*
+* ## 示例代码
+*
+* [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/f94TCOmg7JFH)
+*
+* ### 预置动画函数
+*
+* * [Easing.bounce](#Easing.bounce) 反弹动画
+* * [Easing.ease](#Easing.ease) 惯性动画
+* * [Easing.elastic](#Easing.elastic) 弹性动画
+*
+* ### 标准缓动函数
+*
+* * [Easing.linear](#Easing.linear) 线性
+* * [Easing.quad](#Easing.quad) 二次方
+* * [Easing.cubic](#Easing.cubic) 三次方
+* * [Easing.poly](#Easing.poly) 实现其它幂函数
+*
+* ### 其它数学函数
+*
+* * [Easing.bezier](#Easing.bezier) 三次贝塞尔曲线
+* * [Easing.circle](#Easing.circle) 圆形曲线
+* * [Easing.sin](#Easing.sin) 正弦函数
+* * [Easing.exp](#Easing.exp) 指数函数
+*
+* ### 缓动方式
+*
+* 以上效果均有三种缓动方式
+*
+* * [Easing.in](#in) 正向执行缓动函数
+* * [Easing.out](#out) 反向执行缓动函数
+* * [Easing.inOut](#inout) 前半程正向,后半程反向
+* 以 `sin` 函数为例,其中 `Easing.in(Easing.sin)` 和直接使用 `Easing.sin` 效果相同。
+*
+* 1. `Easing.in(Easing.sin)` 动画效果参考 https://easings.net/#easeInSine
+* 2. `Easing.out(Easing.sin)` 动画效果参考 https://easings.net/#easeOutSine
+* 3. `Easing.inOut(Easing.sin)` 动画效果参考 https://easings.net/#easeInOutSine
+*
+* ### Easing.bounce
+*
+* 简单的反弹效果,[动画效果参考](https://easings.net/#easeInBounce)
+*
+* ```js
+Easing.bounce(t)
+```
+*
+* ### Easing.ease
+*
+* 简单的惯性动画,[动画效果参考](https://cubic-bezier.com/#.42,0,1,1)
+*
+* ```js
+Easing.ease(t)
+```
+*
+* ### Easing.elastic
+*
+* 简单的弹性动画,类似弹簧来回摆动,高阶函数。默认弹性为 1,会稍微超出一次。弹性为 0 时 不会过冲。[动画效果参考](https://easings.net/#easeInElastic)
+*
+* ```js
+Easing.elastic(bounciness = 1)
+```
+*
+* ### Easing.linear
+*
+* 线性函数,f(t) = t,[动画效果参考](https://cubic-bezier.com/#0,0,1,1)
+*
+* ```js
+Easing.linear(t)
+```
+* ### Easing.quad
+*
+* 二次方函数,f(t) = t * t,[动画效果参考](https://easings.net/#easeInQuad)
+*
+* ```js
+Easing.quad(t)
+```
+*
+* ### Easing.cubic
+*
+* 立方函数,f(t) = t * t * t,[动画效果参考](https://easings.net/#easeInCubic)
+*
+* ```js
+Easing.cubic(t)
+```
+*
+* ### Easing.poly
+*
+* 高阶函数,返回幂函数
+*
+* poly(4): [动画效果参考](https://easings.net/#easeInQuart)
+*
+* poly(5): [动画效果参考](https://easings.net/#easeInQuint)
+*
+* ```js
+Easing.poly(n)
+```
+*
+* ### Easing.bezier
+*
+* 三次贝塞尔曲线,效果同 css `transition-timing-function`
+*
+* 调试参数可借助 [可视化工具](https://cubic-bezier.com/)
+*
+* ```js
+Easing.bezier(x1, y1, x2, y2)
+```
+*
+* ### Easing.circle
+*
+* 圆形曲线,[动画效果参考](https://easings.net/#easeInCirc)
+*
+* ```js
+Easing.circle(t)
+```
+*
+* ### Easing.sin
+*
+* 正弦函数,[动画效果参考](https://easings.net/#easeInSine)
+*
+* ```js
+Easing.sin(t)
+```
+*
+* ### Easing.exp
+*
+* 指数函数,[动画效果参考](https://easings.net/#easeInExpo)
+*
+* ```js
+Easing.exp(t)
+```
+*
+* ### Easing.in
+*
+* 正向运行 `easing function`,高阶函数。
+*
+* ```js
+Easing.in(easing)
+```
+*
+* ### Easing.out
+*
+* 反向运行 `easing function`,高阶函数。
+*
+* ```js
+Easing.out(easing)
+```
+*
+* ### Easing.inOut
+*
+* 前半程正向,后半程反向,高阶函数。
+*
+* ```js
+Easing.inOut(easing)
+``` */
+ Easing: WorkletEasing
+ /** [AnimationObject worklet.decay(Object options, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.decay.html)
+*
+* 在插件中使用:不支持
+*
+* 基于滚动衰减的动画。
*
* **示例代码**
*
+* [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/zaI8sgmw7lGW)
*
-* worker 线程中
-* ```js
-worker.postMessage({
- msg: 'hello from worker'
-})
-```
+* ```html
+*
+*
+*
+* ```
*
-* 主线程中
* ```js
-const worker = wx.createWorker('workers/request/index.js')
-
-worker.postMessage({
- msg: 'hello from main'
-})
+const { shared, decay } = wx.worklet
+Page({
+ onLoad() {
+ this._offset = shared(0);
+ this.applyAnimatedStyle('.circle', () => {
+ 'worklet';
+ return {
+ transform: `translateX(${this._offset.value}px)`
+ };
+ });
+ },
+ handlepan(evt) {
+ 'worklet';
+ if (evt.state === GestureState.ACTIVE) {
+ this._offset.value += evt.deltaX;
+ } else if (evt.state === GestureState.END) {
+ this._offset.value = decay({
+ velocity: evt.velocityX,
+ clamp: [-200, 200],
+ },
+ () => {
+ 'worklet'
+ console.info('@@@ decay finish')
+ }
+ );
+ }
+ }
+});
``` */
- postMessage(
- /** 需要发送的消息,必须是一个可序列化的 JavaScript key-value 形式的对象。 */
- message: IAnyObject
- ): void
- /** [Worker.terminate()](https://developers.weixin.qq.com/miniprogram/dev/api/worker/Worker.terminate.html)
+ decay(
+ /** 动画配置 */
+ options: DecayOption,
+ /** 动画完成回调。动画被取消时,返回 fasle,正常完成时返回 true。 */
+ callback: (...args: any[]) => any
+ ): AnimationObject
+ /** [AnimationObject worklet.delay(number delayMS, AnimationObject delayedAnimation)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/combine-animation/worklet.delay.html)
*
- * 结束当前 Worker 线程。仅限在主线程 worker 对象上调用。 */
- terminate(): void
+ * 在插件中使用:不支持
+ *
+ * 延迟执行动画。 */
+ delay(
+ /** 动画开始前等待的时间,单位:毫秒。 */
+ delayMS: number,
+ /** 动画对象。 */
+ delayedAnimation: AnimationObject
+ ): AnimationObject
+ /** [AnimationObject worklet.repeat(AnimationObject animation, number numberOfReps, boolean reverse, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/combine-animation/worklet.repeat.html)
+ *
+ * 在插件中使用:不支持
+ *
+ * 重复执行动画。 */
+ repeat(
+ /** 动画对象 */
+ animation: AnimationObject,
+ /** 重复次数。为负值时一直循环,直到被取消动画。 */
+ numberOfReps?: number,
+ /** 反向运行动画,每周期结束动画由尾到头运行。该字段仅对 timing 和 spring 返回的动画对象生效。 */
+ reverse?: boolean,
+ /** 动画完成回调。动画被取消时,返回 fasle,正常完成时返回 true。 */
+ callback?: (...args: any[]) => any
+ ): AnimationObject
+ /** [AnimationObject worklet.sequence(AnimationObject animationN)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/combine-animation/worklet.sequence.html)
+ *
+ * 在插件中使用:不支持
+ *
+ * 组合动画序列,依次执行传入的动画。 */
+ sequence(
+ /** 动画对象 */
+ animationN: AnimationObject
+ ): AnimationObject
+ /** [AnimationObject worklet.spring(number|string toValue, Object options, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.spring.html)
+ *
+ * 在插件中使用:不支持
+ *
+ * 基于物理的动画。 */
+ spring(
+ /** 目标值 */
+ toValue: number | string,
+ /** 动画配置 */
+ options: SpringOption,
+ /** 动画完成回调。动画被取消时,返回 fasle,正常完成时返回 true。 */
+ callback: (...args: any[]) => any
+ ): AnimationObject
+ /** [AnimationObject worklet.timing(number toValue, Object options, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.timing.html)
+ *
+ * 在插件中使用:不支持
+ *
+ * 基于时间的动画。 */
+ timing(
+ /** 目标值 */
+ toValue: number,
+ /** 动画配置 */
+ options: TimingOption,
+ /** 动画完成回调。动画被取消时,返回 fasle,正常完成时返回 true。 */
+ callback: (...args: any[]) => any
+ ): AnimationObject
+ /** [DerivedValue worklet.derived(WorkletFunction updaterWorklet)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/base/worklet.derived.html)
+ *
+ * 在插件中使用:不支持
+ *
+ * 衍生值 `DerivedValue`,可基于已有的 `SharedValue` 生成其它共享变量。 */
+ derived(
+ /** worklet 函数类型,该函数被立即执行,返回值作为 DerivedValue 的初始值。当函数内捕获的 SharedValue 类型值发生变化时,updaterWorklet 被驱动执行,返回值用于更新 DerivedValue。可类比 computed 计算属性进行理解。 */
+ updaterWorklet: WorkletFunction
+ ): DerivedValue
+ /** [SharedValue worklet.shared(any initialValue)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/base/worklet.shared.html)
+ *
+ * 在插件中使用:不支持
+ *
+ * 创建共享变量 `SharedValue`,用于跨线程共享数据和驱动动画。 */
+ shared(
+ /** 初始值,可通过 `.value` 属性进行读取和修改。类型可以是 `number | string | bool | null | undefined | Object | Array | Function`。 */
+ initialValue: any
+ ): SharedValue
+ /** [function worklet.runOnJS(function fn)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/tool-function/worklet.runOnJS.html)
+ *
+ * 在插件中使用:不支持
+ *
+ * `worklet` 函数运行在 `UI` 线程时,捕获的外部函数可能为 `worklet` 类型或普通函数,为了更明显的对其区分,要求必须使用 `runOnJS` 调回 `JS` 线程的普通函数。
+ * 有这样的要求是因为,调用其它 `worklet` 函数时是同步调用,但在 `UI` 线程执行 `JS` 线程的函数只能是异步,开发者容易混淆,试图同步获取 `JS` 线程的返回值。 */
+ runOnJS(
+ /** 未声明为 worklet 类型的普通函数。 */
+ fn: (...args: any[]) => any
+ ): (...args: any[]) => any
+ /** [function worklet.runOnUI(function fn)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/tool-function/worklet.runOnUI.html)
+ *
+ * 在插件中使用:不支持
+ *
+ * 在 UI 线程执行 worklet 函数。 */
+ runOnUI(
+ /** worklet 类型函数。 */
+ fn: (...args: any[]) => any
+ ): (...args: any[]) => any
+ /** [worklet.cancelAnimation(SharedValue SharedValue)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/base/worklet.cancelAnimation.html)
+ *
+ * 在插件中使用:不支持
+ *
+ * 取消由 `SharedValue` 驱动的动画。 */
+ cancelAnimation(
+ /** 共享变量。 */
+ SharedValue: SharedValue
+ ): void
+ /** [worklet.scrollViewContext.scrollTo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/base/worklet.scrollViewContext.scrollTo.html)
+ *
+ * 需要基础库: `3.3.0`
+ *
+ * 在插件中使用:不支持
+ *
+ * 滚动至指定位置
+ *
+ * **示例代码**
+ *
+ * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/iYlm76mv7uUg) */
+ scrollTo(option: WorkletScrollViewContextScrollToOption): void
+ /** 需要基础库: `3.3.0`
+ *
+ * `ScrollView` 实例,可在 `worklet` 函数内操作 `scroll-view` 组件。 */
+ scrollViewContext: WorkletScrollViewContext
}
interface Wx {
- /**
-小程序云开发
-*/
- cloud: WxCloud
- /**
-文件系统中的用户目录路径
-*/
- env: { USER_DATA_PATH: string }
+ /** [Array.<any> wx.batchGetStorageSync(Array.<string> keyList)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.batchGetStorageSync.html)
+*
+* 需要基础库: `2.25.0`
+*
+* 在插件中使用:不支持
+*
+* 从本地缓存中同步批量获取指定 key 的内容。
+*
+* **示例代码**
+*
+* ```js
+try {
+ var valueList = wx.batchGetStorageSync(['key'])
+ if (valueList) {
+ // Do something with return value
+ }
+} catch (e) {
+ // Do something when catch error
+}
+```
+*
+* ****
+*
+* 对于多个key的读取, 批量读取在性能上优于多次getStorageSync读取 */
+ batchGetStorageSync(
+ /** 本地缓存中指定的 key 数组 */
+ keyList: string[]
+ ): any[]
/** [ArrayBuffer wx.base64ToArrayBuffer(string base64)](https://developers.weixin.qq.com/miniprogram/dev/api/base/wx.base64ToArrayBuffer.html)
*
- * 将 Base64 字符串转成 ArrayBuffer 对象
+ * 需要基础库: `1.1.0`
*
- * 最低基础库: `1.1.0`
+ * 在插件中使用:支持
* @deprecated 基础库版本 [2.4.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃
- * */
+ *
+ * 将 Base64 字符串转成 ArrayBuffer 对象 */
base64ToArrayBuffer(
/** 要转化成 ArrayBuffer 对象的 Base64 字符串 */
base64: string
): ArrayBuffer
/** [Object wx.getAccountInfoSync()](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/account-info/wx.getAccountInfoSync.html)
*
-* 获取当前帐号信息。线上小程序版本号仅支持在正式版小程序中获取,开发版和体验版中无法获取。
+* 需要基础库: `2.2.2`
+*
+* 在插件中使用:需要基础库 `2.2.2`
+*
+* 获取当前账号信息。线上小程序版本号仅支持在正式版小程序中获取,开发版和体验版中无法获取。
*
* **示例代码**
*
-*
* ```js
const accountInfo = wx.getAccountInfoSync();
console.log(accountInfo.miniProgram.appId) // 小程序 appId
console.log(accountInfo.plugin.appId) // 插件 appId
console.log(accountInfo.plugin.version) // 插件版本号, 'a.b.c' 这样的形式
+``` */
+ getAccountInfoSync(): AccountInfo
+ /** [Object wx.getAppAuthorizeSetting()](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getAppAuthorizeSetting.html)
+*
+* 需要基础库: `2.20.1`
+*
+* 在插件中使用:需要基础库 `2.21.3`
+*
+* 获取微信APP授权设置
+*
+* **示例代码**
+*
+* ```js
+const appAuthorizeSetting = wx.getAppAuthorizeSetting()
+
+console.log(appAuthorizeSetting.albumAuthorized)
+console.log(appAuthorizeSetting.bluetoothAuthorized)
+console.log(appAuthorizeSetting.cameraAuthorized)
+console.log(appAuthorizeSetting.locationAuthorized)
+console.log(appAuthorizeSetting.locationReducedAccuracy)
+console.log(appAuthorizeSetting.microphoneAuthorized)
+console.log(appAuthorizeSetting.notificationAlertAuthorized)
+console.log(appAuthorizeSetting.notificationAuthorized)
+console.log(appAuthorizeSetting.notificationBadgeAuthorized)
+console.log(appAuthorizeSetting.notificationSoundAuthorized)
+console.log(appAuthorizeSetting.phoneCalendarAuthorized)
```
*
-* 最低基础库: `2.2.2` */
- getAccountInfoSync(): AccountInfo
+* **返回值说明**
+*
+* `'authorized'` 表示已经获得授权,无需再次请求授权;
+* `'denied'` 表示请求授权被拒绝,无法再次请求授权;(此情况需要引导用户[打开系统设置](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.openAppAuthorizeSetting.html),在设置页中打开权限)
+* `'non determined'` 表示尚未请求授权,会在微信下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关) */
+ getAppAuthorizeSetting(): AppAuthorizeSetting
+ /** [Object wx.getAppBaseInfo()](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getAppBaseInfo.html)
+*
+* 需要基础库: `2.20.1`
+*
+* 在插件中使用:需要基础库 `2.21.3`
+*
+* 获取微信APP基础信息
+*
+* **示例代码**
+*
+* ```js
+const appBaseInfo = wx.getAppBaseInfo()
+
+console.log(appBaseInfo.SDKVersion)
+console.log(appBaseInfo.enableDebug)
+console.log(appBaseInfo.host)
+console.log(appBaseInfo.language)
+console.log(appBaseInfo.version)
+console.log(appBaseInfo.theme)
+``` */
+ getAppBaseInfo(): AppBaseInfo
/** [Object wx.getBatteryInfoSync()](https://developers.weixin.qq.com/miniprogram/dev/api/device/battery/wx.getBatteryInfoSync.html)
+ *
+ * 在插件中使用:需要基础库 `2.15.0`
*
* [wx.getBatteryInfo](https://developers.weixin.qq.com/miniprogram/dev/api/device/battery/wx.getBatteryInfo.html) 的同步版本 */
getBatteryInfoSync(): GetBatteryInfoSyncResult
+ /** [Object wx.getDeviceInfo()](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getDeviceInfo.html)
+*
+* 需要基础库: `2.20.1`
+*
+* 在插件中使用:需要基础库 `2.21.3`
+*
+* 获取设备基础信息
+*
+* **示例代码**
+*
+* ```js
+const deviceInfo = wx.getDeviceInfo()
+
+console.log(deviceInfo.abi)
+console.log(deviceInfo.benchmarkLevel)
+console.log(deviceInfo.brand)
+console.log(deviceInfo.model)
+console.log(deviceInfo.platform)
+console.log(deviceInfo.system)
+``` */
+ getDeviceInfo(): DeviceInfo
/** [Object wx.getEnterOptionsSync()](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/life-cycle/wx.getEnterOptionsSync.html)
+ *
+ * 需要基础库: `2.9.4`
+ *
+ * 在插件中使用:需要基础库 `2.9.4`
*
* 获取本次小程序启动时的参数。如果当前是冷启动,则返回值与 [`App.onLaunch`](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onLaunch-Object-object) 的回调参数一致;如果当前是热启动,则返回值与 [`App.onShow`](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onShow-Object-object) 一致。
*
* **返回有效 referrerInfo 的场景**
*
- *
* | 场景值 | 场景 | appId含义 |
* | ------ | ------------------------------- | ---------- |
* | 1020 | 公众号 profile 页相关小程序列表 | 来源公众号 |
@@ -11589,29 +21921,55 @@ console.log(accountInfo.plugin.version) // 插件版本号, 'a.b.c' 这样的
* | 1038 | 从另一个小程序返回 | 来源小程序 |
* | 1043 | 公众号模板消息 | 来源公众号 |
*
+ * **不同 apiCategory 场景下的 API 限制**
+ *
+ * `X` 表示 API 被限制无法使用;不在表格中的 API 不限制。
+ *
+ * | | default | nativeFunctionalized | browseOnly | embedded | chatTool |
+ * |-|-|-|-|-|--|
+ * |openSetting | | | `X` | | |
+ * |<button open-type="share"> | | `X` | `X` | `X` | `X` |
+ * |<button open-type="feedback"> | | | `X` | | |
+ * |<button open-type="open-setting">| | | `X` | | |
+ * |navigateToMiniProgram | | `X` | `X` | | `X` |
+ * |openEmbeddedMiniProgram | | `X` | `X` | `X` | `X` |
+ * |openOfficialAccountArticle | | | | | `X` |
+ * |openChannelsUserProfile | | | | | `X` |
+ * |ad | | | | | `X` |
+ * |ad-custom | | | | | `X` |
+ * |小程序菜单分享 | | | | | `X` |
+ *
* **注意**
*
- *
- * 部分版本在无 `referrerInfo` 的时候会返回 `undefined`,建议使用 `options.referrerInfo && options.referrerInfo.appId` 进行判断。
- *
- * 最低基础库: `2.9.4` */
+ * 部分版本在无 `referrerInfo` 的时候会返回 `undefined`,建议使用 `options.referrerInfo && options.referrerInfo.appId` 进行判断。 */
getEnterOptionsSync(): LaunchOptionsApp
- /** [Object wx.getExptInfoSync(Array.<string> keys)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/report/wx.getExptInfoSync.html)
+ /** [Object wx.getExptInfoSync(Array.<string> keys)](https://developers.weixin.qq.com/miniprogram/dev/api/data-analysis/wx.getExptInfoSync.html)
+ *
+ * 需要基础库: `2.17.0`
+ *
+ * 在插件中使用:不支持
*
* 给定实验参数数组,获取对应的实验参数值
*
- * 最低基础库: `2.14.4` */
+ * **提示**
+ *
+ * 假设实验参数有 `color`, `size`
+ * 调用 wx.getExptInfoSync() 会返回 `{color:'#fff',size:20}` 类似的结果
+ * 而 wx.getExptInfoSync(['color']) 则只会返回 `{color:'#fff'}` */
getExptInfoSync(
/** 实验参数数组,不填则获取所有实验参数 */
keys?: string[]
): IAnyObject
/** [Object wx.getExtConfigSync()](https://developers.weixin.qq.com/miniprogram/dev/api/ext/wx.getExtConfigSync.html)
*
+* 需要基础库: `1.1.0`
+*
+* 在插件中使用:不支持
+*
* [wx.getExtConfig](https://developers.weixin.qq.com/miniprogram/dev/api/ext/wx.getExtConfig.html) 的同步版本。
*
* **Tips**
*
-*
* 1. 本接口暂时无法通过 [wx.canIUse](https://developers.weixin.qq.com/miniprogram/dev/api/base/wx.canIUse.html) 判断是否兼容,开发者需要自行判断 [wx.getExtConfigSync](https://developers.weixin.qq.com/miniprogram/dev/api/ext/wx.getExtConfigSync.html) 是否存在来兼容
*
* ****
@@ -11619,17 +21977,18 @@ console.log(accountInfo.plugin.version) // 插件版本号, 'a.b.c' 这样的
* ```js
let extConfig = wx.getExtConfigSync? wx.getExtConfigSync(): {}
console.log(extConfig)
-```
-*
-* 最低基础库: `1.1.0` */
+``` */
getExtConfigSync(): IAnyObject
/** [Object wx.getLaunchOptionsSync()](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/life-cycle/wx.getLaunchOptionsSync.html)
+ *
+ * 需要基础库: `2.1.2`
+ *
+ * 在插件中使用:需要基础库 `2.9.4`
*
* 获取小程序启动时的参数。与 [`App.onLaunch`](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onlaunchobject-object) 的回调参数一致。
*
* **返回有效 referrerInfo 的场景**
*
- *
* | 场景值 | 场景 | appId含义 |
* | ------ | ------------------------------- | ---------- |
* | 1020 | 公众号 profile 页相关小程序列表 | 来源公众号 |
@@ -11640,26 +21999,60 @@ console.log(extConfig)
* | 1043 | 公众号模板消息 | 来源公众号 |
* | 1069 | 移动应用 | 来源App |
*
+ * **不同 apiCategory 场景下的 API 限制**
+ *
+ * `X` 表示 API 被限制无法使用;不在表格中的 API 不限制。
+ *
+ * | | default | nativeFunctionalized | browseOnly | embedded |
+ * |-|-|-|-|-|
+ * |navigateToMiniProgram | | `X` | `X` | |
+ * |openSetting | | | `X` | |
+ * |<button open-type="share"> | | `X` | `X` | `X` |
+ * |<button open-type="feedback"> | | | `X` | |
+ * |<button open-type="open-setting">| | | `X` | |
+ * |openEmbeddedMiniProgram | | `X` | `X` | `X` |
+ *
* **注意**
*
- *
- * 部分版本在无`referrerInfo`的时候会返回 `undefined`,建议使用 `options.referrerInfo && options.referrerInfo.appId` 进行判断。
- *
- * 最低基础库: `2.1.2` */
+ * 部分版本在无`referrerInfo`的时候会返回 `undefined`,建议使用 `options.referrerInfo && options.referrerInfo.appId` 进行判断。 */
getLaunchOptionsSync(): LaunchOptionsApp
/** [Object wx.getMenuButtonBoundingClientRect()](https://developers.weixin.qq.com/miniprogram/dev/api/ui/menu/wx.getMenuButtonBoundingClientRect.html)
+*
+* 需要基础库: `2.1.0`
+*
+* 在插件中使用:需要基础库 `2.15.0`
+*
+* 获取菜单按钮(右上角胶囊按钮)的布局位置信息。坐标信息以屏幕左上角为原点。
+*
+* **示例代码**
+*
+* ```js
+const res = wx.getMenuButtonBoundingClientRect()
+
+console.log(res.width)
+console.log(res.height)
+console.log(res.top)
+console.log(res.right)
+console.log(res.bottom)
+console.log(res.left)
+``` */
+ getMenuButtonBoundingClientRect(): ClientRect
+ /** [Object wx.getSkylineInfoSync()](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getSkylineInfoSync.html)
*
- * 获取菜单按钮(右上角胶囊按钮)的布局位置信息。坐标信息以屏幕左上角为原点。
+ * 需要基础库: `2.26.2`
*
- * 最低基础库: `2.1.0` */
- getMenuButtonBoundingClientRect(): Rect
+ * 在插件中使用:需要基础库 `2.26.2`
+ *
+ * 获取当前运行环境对于 [Skyline 渲染引擎](https://developers.weixin.qq.com/miniprogram/dev/framework/runtime/skyline/introduction.html) 的支持情况 */
+ getSkylineInfoSync(): SkylineInfo
/** [Object wx.getStorageInfoSync()](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.getStorageInfoSync.html)
*
+* 在插件中使用:不支持
+*
* [wx.getStorageInfo](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.getStorageInfo.html) 的同步版本
*
* **示例代码**
*
-*
* ```js
wx.getStorageInfo({
success (res) {
@@ -11681,12 +22074,16 @@ try {
}
``` */
getStorageInfoSync(): GetStorageInfoSyncOption
- /** [Object wx.getSystemInfoSync()](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/system-info/wx.getSystemInfoSync.html)
+ /** [Object wx.getSystemInfoSync()](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getSystemInfoSync.html)
*
-* [wx.getSystemInfo](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/system-info/wx.getSystemInfo.html) 的同步版本
+* 在插件中使用:需要基础库 `1.9.6`
+* @deprecated 基础库版本 [2.20.1](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [wx.getSystemSetting](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getSystemSetting.html)、[wx.getAppAuthorizeSetting](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getAppAuthorizeSetting.html)、[wx.getDeviceInfo](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getDeviceInfo.html)、[wx.getWindowInfo](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getWindowInfo.html)、[wx.getAppBaseInfo](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getAppBaseInfo.html) 替换
+*
+* [wx.getSystemInfo](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getSystemInfo.html) 的同步版本
*
* **示例代码**
*
+* [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/WkUCgXmS7mqO)
*
* ```js
wx.getSystemInfo({
@@ -11715,17 +22112,89 @@ try {
} catch (e) {
// Do something when catch error
}
-``` */
+```
+*
+* ****
+*
+* ## 注意事项
+* - 当 wx.getSystemInfoSync() 接口发生错误时可能会返回空对象
+* - wx.getSystemInfo 接口由于会获取系统权限,可能触发授权弹窗,请使用 [wx.getSystemSetting](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getSystemSetting.html)、[wx.getAppAuthorizeSetting](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getAppAuthorizeSetting.html)、[wx.getDeviceInfo](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getDeviceInfo.html)、[wx.getWindowInfo](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getWindowInfo.html)、[wx.getAppBaseInfo](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getAppBaseInfo.html) 替代 */
getSystemInfoSync(): SystemInfo
+ /** [Object wx.getSystemSetting()](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getSystemSetting.html)
+*
+* 需要基础库: `2.20.1`
+*
+* 在插件中使用:需要基础库 `2.21.3`
+*
+* 获取设备设置
+*
+* **示例代码**
+*
+* ```js
+const systemSetting = wx.getSystemSetting()
+
+console.log(systemSetting.bluetoothEnabled)
+console.log(systemSetting.deviceOrientation)
+console.log(systemSetting.locationEnabled)
+console.log(systemSetting.wifiEnabled)
+``` */
+ getSystemSetting(): SystemSetting
+ /** [Object wx.getWindowInfo()](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getWindowInfo.html)
+*
+* 需要基础库: `2.20.1`
+*
+* 在插件中使用:需要基础库 `2.21.3`
+*
+* 获取窗口信息
+*
+* **示例代码**
+*
+* ```js
+const windowInfo = wx.getWindowInfo()
+
+console.log(windowInfo.pixelRatio)
+console.log(windowInfo.screenWidth)
+console.log(windowInfo.screenHeight)
+console.log(windowInfo.windowWidth)
+console.log(windowInfo.windowHeight)
+console.log(windowInfo.statusBarHeight)
+console.log(windowInfo.safeArea)
+console.log(windowInfo.screenTop)
+``` */
+ getWindowInfo(): WindowInfo
+ /** [Promise wx.getRendererUserAgent(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getRendererUserAgent.html)
+*
+* 需要基础库: `2.26.3`
+*
+* 在插件中使用:需要基础库 `3.11.2`
+*
+* 获取 Webview 小程序的 UserAgent
+*
+* **示例代码**
+*
+* ```js
+// v2.30.4 前,仅支持 promise 风格调用
+wx.getRendererUserAgent().then(userAgent => console.log(userAgent))
+// v2.30.4 起,除 promise 风格调用外,也支持 invoke 风格使用
+wx.getRendererUserAgent({
+ success(res) { console.log(res.userAgent) }
+})
+``` */
+ getRendererUserAgent(
+ option?: GetRendererUserAgentOption
+ ): Promise
/** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) wx.createAnimation(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/wx.createAnimation.html)
+ *
+ * 在插件中使用:需要基础库 `1.9.6`
*
* 创建一个动画实例 [animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html)。调用实例的方法来描述动画。最后通过动画实例的 export 方法导出动画数据传递给组件的 animation 属性。 */
createAnimation(option: StepOption): Animation
/** [[AudioContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioContext.html) wx.createAudioContext(string id, Object this)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.createAudioContext.html)
*
- * 创建 [audio](https://developers.weixin.qq.com/miniprogram/dev/component/audio.html) 上下文 [AudioContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioContext.html) 对象。
+ * 在插件中使用:需要基础库 `1.9.6`
* @deprecated 基础库版本 [1.6.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [wx.createInnerAudioContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.createInnerAudioContext.html) 替换
- * */
+ *
+ * 创建 [audio](https://developers.weixin.qq.com/miniprogram/dev/component/audio.html) 上下文 [AudioContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioContext.html) 对象。 */
createAudioContext(
/** [audio](https://developers.weixin.qq.com/miniprogram/dev/component/audio.html) 组件的 id */
id: string,
@@ -11733,25 +22202,61 @@ try {
component?: Component.TrivialInstance | Page.TrivialInstance
): AudioContext
/** [[BackgroundAudioManager](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.html) wx.getBackgroundAudioManager()](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.getBackgroundAudioManager.html)
+ *
+ * 需要基础库: `1.2.0`
+ *
+ * 在插件中使用:需要基础库 `1.9.6`
*
* 获取**全局唯一**的背景音频管理器。
* 小程序切入后台,如果音频处于播放状态,可以继续播放。但是后台状态不能通过调用API操纵音频的播放状态。
*
- * 从微信客户端6.7.2版本开始,若需要在小程序切后台后继续播放音频,需要在 [app.json](https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/app.html) 中配置 `requiredBackgroundModes` 属性。开发版和体验版上可以直接生效,正式版还需通过审核。
- *
- * 最低基础库: `1.2.0` */
+ * 从微信客户端6.7.2版本开始,若需要在小程序切后台后继续播放音频,需要在 [app.json](https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/app.html) 中配置 `requiredBackgroundModes` 属性。开发版和体验版上可以直接生效,正式版还需通过审核。 */
getBackgroundAudioManager(): BackgroundAudioManager
+ /** [[CacheManager](https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.html) wx.createCacheManager(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/wx.createCacheManager.html)
+*
+* 需要基础库: `2.24.0`
+*
+* 在插件中使用:不支持
+*
+* 创建缓存管理器
+*
+* **示例代码**
+*
+* 查看完整示例代码
+*
+* ```js
+const cacheManager = createCacheManager()
+cacheManager.addRule(/https:\/\/(?:.*)/ig) // 表示所有 https 请求都匹配
+
+cacheManager.on('request', evt => {
+ // 在弱网时接收到 wx.request 请求
+ return new Promise((resolve, reject) => {
+ const matchRes = cm.match(evt)
+ if (matchRes && matchRes.data) {
+ // 有缓存,返回
+ resolve(matchRes.data)
+ } else {
+ // 没缓存,抛错
+ reject({ errMsg: 'no cache' })
+ }
+ })
+})
+``` */
+ createCacheManager(option: CreateCacheManagerOption): CacheManager
/** [[CameraContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraContext.html) wx.createCameraContext()](https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/wx.createCameraContext.html)
*
- * 创建 [camera](https://developers.weixin.qq.com/miniprogram/dev/component/camera.html) 上下文 [CameraContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraContext.html) 对象。
+ * 需要基础库: `1.6.0`
*
- * 最低基础库: `1.6.0` */
+ * 在插件中使用:需要基础库 `1.9.6`
+ *
+ * 创建 [camera](https://developers.weixin.qq.com/miniprogram/dev/component/camera.html) 上下文 [CameraContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraContext.html) 对象。 */
createCameraContext(): CameraContext
/** [[CanvasContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html) wx.createCanvasContext(string canvasId, Object this)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/wx.createCanvasContext.html)
*
- * 创建 canvas 的绘图上下文 [CanvasContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html) 对象
+ * 在插件中使用:需要基础库 `1.9.6`
* @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [Canvas](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.html) 替换
- * */
+ *
+ * 创建 canvas 的绘图上下文 [CanvasContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html) 对象 */
createCanvasContext(
/** 要获取上下文的 [canvas](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 组件 canvas-id 属性 */
canvasId: string,
@@ -11760,13 +22265,14 @@ try {
): CanvasContext
/** [[DownloadTask](https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.html) wx.downloadFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/network/download/wx.downloadFile.html)
*
+* 在插件中使用:需要基础库 `1.9.6`
+*
* 下载文件资源到本地。客户端直接发起一个 HTTPS GET 请求,返回文件的本地临时路径 (本地路径),单次下载允许的最大文件为 200MB。使用前请注意阅读[相关说明](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/network.html)。
*
* 注意:请在服务端响应的 header 中指定合理的 `Content-Type` 字段,以保证客户端正确处理文件类型。
*
* **示例代码**
*
-*
* ```js
wx.downloadFile({
url: 'https://example.com/audio/123', //仅为示例,并非真实的资源
@@ -11783,26 +22289,130 @@ wx.downloadFile({
downloadFile(option: DownloadFileOption): DownloadTask
/** [[FileSystemManager](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.html) wx.getFileSystemManager()](https://developers.weixin.qq.com/miniprogram/dev/api/file/wx.getFileSystemManager.html)
*
- * 获取全局唯一的文件管理器
+ * 需要基础库: `1.9.9`
*
- * 最低基础库: `1.9.9` */
+ * 在插件中使用:需要基础库 `2.19.2`
+ *
+ * 获取全局唯一的文件管理器 */
getFileSystemManager(): FileSystemManager
- /** [[InnerAudioContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.html) wx.createInnerAudioContext()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.createInnerAudioContext.html)
+ /** [[GlobalPayment](https://developers.weixin.qq.com/miniprogram/dev/api/payment/GlobalPayment.html) wx.createGlobalPayment(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/payment/wx.createGlobalPayment.html)
*
- * 创建内部 [audio](https://developers.weixin.qq.com/miniprogram/dev/component/audio.html) 上下文 [InnerAudioContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.html) 对象。
+ * 需要基础库: `3.7.3`
*
- * 最低基础库: `1.6.0` */
- createInnerAudioContext(): InnerAudioContext
+ * 在插件中使用:不支持
+ *
+ * 创建全球支付方式的对象。一旦用户选定支付方式后,不可更改。如需重新选择支付方式,需创建新对象。 */
+ createGlobalPayment(option: CreateGlobalPaymentOption): GlobalPayment
+ /** [[InferenceSession](https://developers.weixin.qq.com/miniprogram/dev/api/ai/inference/InferenceSession.html) wx.createInferenceSession(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/inference/wx.createInferenceSession.html)
+*
+* 需要基础库: `2.30.0`
+*
+* 在插件中使用:需要基础库 `2.30.0`
+*
+* 创建 AI 推理 Session。使用前可参考[AI指南文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/inference/tutorial.html)
+*
+* **示例代码**
+*
+* ```js
+// 创建会话,加载模型
+const session = wx.createInferenceSession({
+ model: `${wx.env.USER_DATA_PATH}/MNIST.onnx`,
+ precisionLevel: 4,
+ typicalShape:{input1:[1, 3, 224, 224], input2:[1, 1, 224, 224]}, //除非使用动态轴,一般不用显式指定
+ allowNPU: false,
+ allowQuantize: false
+})
+
+// 监听error事件
+session.onError(err => {
+ console.error(err)
+})
+
+// 监听模型加载完成事件
+session.onLoad(() => {
+ // 运行推理
+ // 其中input1, input2, output0 必须与使用的onnx模型中实际的输入输出名字完全一致,不可随意填写。
+ // 模型输入输出信息可以通过Netron 打开onnx模型看到
+ session.run({
+ input1: {
+ type: 'float32',
+ data: new Float32Array(3 * 224 * 224).buffer,
+ shape: [1, 3, 224, 224] // NCHW 顺序
+ },
+ // 多个input的添加方法,假设第二个input需要数据类型为uint8
+ input2: {
+ type: 'uint8',
+ data: new Uint8Array(224 * 224).buffer,
+ shape: [1, 1, 224, 224]
+ },
+ }).then(res => {
+ console.log(res.output0)
+ })
+})
+
+// 销毁Session
+// session完成创建后可以多次调用run进行推理,直到调用`session.destroy()`释放相关内存。
+
+// 销毁会话
+session.destroy()
+``` */
+ createInferenceSession(
+ option: CreateInferenceSessionOption
+ ): InferenceSession
+ /** [[InnerAudioContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.html) wx.createInnerAudioContext(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.createInnerAudioContext.html)
+*
+* 需要基础库: `1.6.0`
+*
+* 在插件中使用:需要基础库 `1.9.6`
+*
+* 创建内部 [audio](https://developers.weixin.qq.com/miniprogram/dev/component/audio.html) 上下文 [InnerAudioContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.html) 对象。
+*
+* **示例代码**
+*
+* ```js
+const innerAudioContext = wx.createInnerAudioContext({
+ useWebAudioImplement: false // 是否使用 WebAudio 作为底层音频驱动,默认关闭。对于短音频、播放频繁的音频建议开启此选项,开启后将获得更优的性能表现。由于开启此选项后也会带来一定的内存增长,因此对于长音频建议关闭此选项
+})
+innerAudioContext.src = 'https://wx_test.mp3'
+
+innerAudioContext.play() // 播放
+
+innerAudioContext.pause() // 暂停
+
+innerAudioContext.stop() // 停止
+
+innerAudioContext.destroy() // 释放音频资源
+``` */
+ createInnerAudioContext(
+ option?: CreateInnerAudioContextOption
+ ): InnerAudioContext
/** [[IntersectionObserver](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/IntersectionObserver.html) wx.createIntersectionObserver(Object component, Object options)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/wx.createIntersectionObserver.html)
+ *
+ * 需要基础库: `1.9.3`
+ *
+ * 在插件中使用:需要基础库 `1.9.6`
*
* 创建并返回一个 IntersectionObserver 对象实例。在自定义组件或包含自定义组件的页面中,应使用 `this.createIntersectionObserver([options])` 来代替。
*
* **示例代码**
*
+ * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/ETQafJmu7BTm)
*
- * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/LAbMxkmI7F2A)
+ * **原生模式**
*
- * 最低基础库: `1.9.3` */
+ * 小程序的观察器默认使用非原生模式。非原生模式下,部分表现会与原生模式有差异,具体差异为:
+ *
+ * 1. 非原生观察器调用 `relativeTo` 设置的参照区域可以为任意节点;而原生模式只能相对祖先节点。
+ * 2. 非原生观察器调用 `relativeTo` 或 `relativeToViewport` 可以设置多个参照区域,参照区域之间会取交集;而原生模式只允许设置一个参照区域。
+ * 3. 非原生观察器计算区域相交时,直接计算节点区域和参照区域的交集;而原生模式会对节点的祖先节点进行遍历,计算节点的祖先节点到参照节点的路径中,所有节点区域的交集。
+ * 4. 原生观察器性能比非原生模式更高。
+ *
+ * 原生观察器相关信息可参考 [IntersectionObserver 文档](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API)。
+ *
+ * **Tips**
+ *
+ * 1. 若 `relativeTo` 设置的参照区域不是祖先节点,则无法开启原生模式。
+ * 2. 若调用多次 `relativeTo` 和 `relativeToViewport`,观察器性能会下降。 */
createIntersectionObserver(
/** 自定义组件实例 */
component: IAnyObject,
@@ -11811,15 +22421,19 @@ wx.downloadFile({
): IntersectionObserver
/** [[InterstitialAd](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.html) wx.createInterstitialAd(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/wx.createInterstitialAd.html)
*
- * 创建插屏广告组件。请通过 [wx.getSystemInfoSync()](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/system-info/wx.getSystemInfoSync.html) 返回对象的 SDKVersion 判断基础库版本号后再使用该 API。每次调用该方法创建插屏广告都会返回一个全新的实例(小程序端的插屏广告实例不允许跨页面使用)。
+ * 需要基础库: `2.6.0`
*
- * 最低基础库: `2.6.0` */
+ * 在插件中使用:需要基础库 `2.8.1`
+ *
+ * 创建插屏广告组件。请通过 [wx.getSystemInfoSync()](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getSystemInfoSync.html) 返回对象的 SDKVersion 判断基础库版本号后再使用该 API。每次调用该方法创建插屏广告都会返回一个全新的实例(小程序端的插屏广告实例不允许跨页面使用)。 */
createInterstitialAd(option: CreateInterstitialAdOption): InterstitialAd
/** [[LivePlayerContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.html) wx.createLivePlayerContext(string id, Object this)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/wx.createLivePlayerContext.html)
*
- * 创建 [live-player](https://developers.weixin.qq.com/miniprogram/dev/component/live-player.html) 上下文 [LivePlayerContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.html) 对象。建议使用 [wx.createSelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/wx.createSelectorQuery.html) 获取 context 对象。
+ * 需要基础库: `1.7.0`
*
- * 最低基础库: `1.7.0` */
+ * 在插件中使用:需要基础库 `1.9.6`
+ *
+ * 创建 [live-player](https://developers.weixin.qq.com/miniprogram/dev/component/live-player.html) 上下文 [LivePlayerContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.html) 对象。建议使用 [wx.createSelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/wx.createSelectorQuery.html) 获取 context 对象。 */
createLivePlayerContext(
/** [live-player](https://developers.weixin.qq.com/miniprogram/dev/component/live-player.html) 组件的 id */
id: string,
@@ -11828,28 +22442,33 @@ wx.downloadFile({
): LivePlayerContext
/** [[LivePusherContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.html) wx.createLivePusherContext()](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/wx.createLivePusherContext.html)
*
- * 创建 [live-pusher](https://developers.weixin.qq.com/miniprogram/dev/component/live-pusher.html) 上下文 [LivePusherContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.html) 对象。
+ * 需要基础库: `1.7.0`
*
- * 最低基础库: `1.7.0` */
+ * 在插件中使用:需要基础库 `1.9.6`
+ *
+ * 创建 [live-pusher](https://developers.weixin.qq.com/miniprogram/dev/component/live-pusher.html) 上下文 [LivePusherContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.html) 对象。 */
createLivePusherContext(): LivePusherContext
/** [[LogManager](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/LogManager.html) wx.getLogManager(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/wx.getLogManager.html)
*
+* 需要基础库: `2.1.0`
+*
+* 在插件中使用:不支持
+*
* 获取日志管理器对象。
*
* **示例代码**
*
-*
* ```js
const logger = wx.getLogManager({level: 1})
logger.log({str: 'hello world'}, 'basic log', 100, [1, 2, 3])
logger.info({str: 'hello world'}, 'info log', 100, [1, 2, 3])
logger.debug({str: 'hello world'}, 'debug log', 100, [1, 2, 3])
logger.warn({str: 'hello world'}, 'warn log', 100, [1, 2, 3])
-```
-*
-* 最低基础库: `2.1.0` */
+``` */
getLogManager(option: GetLogManagerOption): LogManager
/** [[MapContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.html) wx.createMapContext(string mapId, Object this)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/wx.createMapContext.html)
+ *
+ * 在插件中使用:需要基础库 `1.9.6`
*
* 创建 [map](https://developers.weixin.qq.com/miniprogram/dev/component/map.html) 上下文 [MapContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.html) 对象。建议使用 [wx.createSelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/wx.createSelectorQuery.html) 获取 context 对象。 */
createMapContext(
@@ -11860,11 +22479,14 @@ logger.warn({str: 'hello world'}, 'warn log', 100, [1, 2, 3])
): MapContext
/** [[MediaAudioPlayer](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/MediaAudioPlayer.html) wx.createMediaAudioPlayer()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.createMediaAudioPlayer.html)
*
+* 需要基础库: `2.13.0`
+*
+* 在插件中使用:支持
+*
* 创建媒体音频播放器对象 [MediaAudioPlayer](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/MediaAudioPlayer.html) 对象,可用于播放视频解码器 [VideoDecoder](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.html) 输出的音频。
*
* **示例代码**
*
-*
* ```js
// 创建视频解码器,具体参数见 createVideoDecoder 文档
const videoDecoder = wx.createVideoDecoder()
@@ -11881,11 +22503,11 @@ logger.warn({str: 'hello world'}, 'warn log', 100, [1, 2, 3])
})
// 移除播放器音频来源
- mediaAudioPlaye.removeAudioSource(videoDecoder).then()
+ mediaAudioPlayer.removeAudioSource(videoDecoder).then()
// 停止播放器
- mediaAudioPlaye.stop().then()
+ mediaAudioPlayer.stop().then()
// 销毁播放器
- mediaAudioPlaye.destroy().then()
+ mediaAudioPlayer.destroy().then()
// 设置播放器音量
mediaAudioPlayer.volume = 0.5
})
@@ -11893,123 +22515,269 @@ logger.warn({str: 'hello world'}, 'warn log', 100, [1, 2, 3])
*
* **完整demo(小游戏)**
*
-*
-* - https://developers.weixin.qq.com/s/SF2duHmb7MjI
-*
-* 最低基础库: `2.13.0` */
+* - https://developers.weixin.qq.com/s/SF2duHmb7MjI */
createMediaAudioPlayer(): MediaAudioPlayer
/** [[MediaContainer](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaContainer.html) wx.createMediaContainer()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/wx.createMediaContainer.html)
*
- * 创建音视频处理容器,最终可将容器中的轨道合成一个视频
+ * 需要基础库: `2.9.0`
*
- * 最低基础库: `2.9.0` */
+ * 在插件中使用:需要基础库 `2.10.0`
+ *
+ * 创建音视频处理容器,最终可将容器中的轨道合成一个视频 */
createMediaContainer(): MediaContainer
/** [[MediaRecorder](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.html) wx.createMediaRecorder(Object canvas, Object options)](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/wx.createMediaRecorder.html)
- *
- * 创建 WebGL 画面录制器,可逐帧录制在 WebGL 上渲染的画面并导出视频文件
- *
- * 最低基础库: `2.11.0` */
+*
+* 需要基础库: `2.11.0`
+*
+* 在插件中使用:需要基础库 `2.11.0`
+*
+* 创建 WebGL 画面录制器,可逐帧录制在 WebGL 上渲染的画面并导出视频文件
+*
+* **示例代码**
+*
+* [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/MCz3kPmC7zpa)
+*
+* **低版本异步接口兼容**
+*
+* 对基础库 2.16.1 版本前的 mediaRecorder,所有的接口都没有返回 Promise 对象,若需要兼容低版本,则可采用如下方式的写法:
+* ```javascript
+// 启动 mediaRecorder
+await new Promise(resolve => {
+ recorder.on('start', resolve)
+ recorder.start()
+})
+
+// 逐帧绘制
+while (frames--) {
+ await new Promise(resolve => recorder.requestFrame(resolve))
+ render()
+}
+
+// 绘制完成,生成视频
+const {tempFilePath} = await new Promise(resolve => {
+ recorder.on('stop', resolve)
+ recorder.stop()
+})
+``` */
createMediaRecorder(
- /** WebGL 对象,通过 [SelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html) 获取到的 node 对象 */
+ /** WebGL 对象,通过 [SelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html) 获取到的 node 对象或通过 [wx.createOffscreenCanvas](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/wx.createOffscreenCanvas.html) 创建的离屏 WebGL Canvas 对象 */
canvas: IAnyObject,
options: CreateMediaRecorderOption
): MediaRecorder
/** [[NFCAdapter](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.html) wx.getNFCAdapter()](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/wx.getNFCAdapter.html)
+ *
+ * 需要基础库: `2.11.2`
+ *
+ * 在插件中使用:需要基础库 `2.11.2`
*
* 获取 NFC 实例
*
* **示例代码**
*
- *
- * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/1WsbDwmb75ig)
- *
- * 最低基础库: `2.11.2` */
+ * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/1WsbDwmb75ig) */
getNFCAdapter(): NFCAdapter
- /** [[OffscreenCanvas](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/OffscreenCanvas.html) wx.createOffscreenCanvas()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/wx.createOffscreenCanvas.html)
+ /** [[OffscreenCanvas](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/OffscreenCanvas.html) wx.createOffscreenCanvas(object object, number width, number height, Object this)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/wx.createOffscreenCanvas.html)
+ *
+ * 需要基础库: `2.16.1`
+ *
+ * 在插件中使用:需要基础库 `2.16.1`
*
* 创建离屏 canvas 实例
*
- * 最低基础库: `2.7.0` */
- createOffscreenCanvas(): OffscreenCanvas
- /** [[Performance](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/Performance.html) wx.getPerformance()](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/wx.getPerformance.html)
+ * **离屏 Canvas 类型不可混用**
+ *
+ * 由于 webgl canvas 和 2d canvas 的底层实现方式不同,因此必须要在调用 `wx.createOffscreenCanvas` 时提前指定类型。
+ *
+ * 指定类型后,离屏 canvas `getContext(type)` 调用不允许混用,如不能对 webgl canvas 调用 `getContext('2d')`。
+ *
+ * 同样的,不同类型 canvas 调用 `createImage` 创建的图片对象也不支持混用,使用时请注意尽量使用 canvas 自身的 `createImage` 创建图片对象。
+ *
+ * **与 MediaRecorder 结合**
+ *
+ * 离屏 webgl canvas 支持作为参数传递给 [`wx.createMediaRecorder`](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/wx.createMediaRecorder.html), 离屏 2d canvas 暂不支持。
+ *
+ * **旧版 createOffscreenCanvas**
+ *
+ * 旧版函数签名为 `wx.createOffscreenCanvas(width: number, height: number, this: object): OffscreenCanvas`,从基础库 2.7.0 开始支持
+ *
+ * 从基础库 2.16.1 开始改为 `wx.createOffscreenCanvas(options: object): OffscreenCanvas`,向下兼容旧版入参。
+ * 但需注意旧版入参只能创建 webgl 类型,如需创建 2d 类型则必须使用新版。 */
+ createOffscreenCanvas(
+ /** 画布宽度 */
+ width: number,
+ /** 画布高度 */
+ height: number,
+ /** 在自定义组件下,当前组件实例的 this */
+ component?: Component.TrivialInstance | Page.TrivialInstance
+ ): OffscreenCanvas
+ /** [[OffscreenCanvas](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/OffscreenCanvas.html) wx.createOffscreenCanvas(object object, number width, number height, Object this)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/wx.createOffscreenCanvas.html)
+ *
+ * 需要基础库: `2.16.1`
+ *
+ * 在插件中使用:需要基础库 `2.16.1`
+ *
+ * 创建离屏 canvas 实例
+ *
+ * **离屏 Canvas 类型不可混用**
+ *
+ * 由于 webgl canvas 和 2d canvas 的底层实现方式不同,因此必须要在调用 `wx.createOffscreenCanvas` 时提前指定类型。
+ *
+ * 指定类型后,离屏 canvas `getContext(type)` 调用不允许混用,如不能对 webgl canvas 调用 `getContext('2d')`。
+ *
+ * 同样的,不同类型 canvas 调用 `createImage` 创建的图片对象也不支持混用,使用时请注意尽量使用 canvas 自身的 `createImage` 创建图片对象。
+ *
+ * **与 MediaRecorder 结合**
+ *
+ * 离屏 webgl canvas 支持作为参数传递给 [`wx.createMediaRecorder`](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/wx.createMediaRecorder.html), 离屏 2d canvas 暂不支持。
+ *
+ * **旧版 createOffscreenCanvas**
+ *
+ * 旧版函数签名为 `wx.createOffscreenCanvas(width: number, height: number, this: object): OffscreenCanvas`,从基础库 2.7.0 开始支持
+ *
+ * 从基础库 2.16.1 开始改为 `wx.createOffscreenCanvas(options: object): OffscreenCanvas`,向下兼容旧版入参。
+ * 但需注意旧版入参只能创建 webgl 类型,如需创建 2d 类型则必须使用新版。 */
+ createOffscreenCanvas(
+ option: CreateOffscreenCanvasOption
+ ): OffscreenCanvas
+ /** [[Performance](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/Performance.html) wx.getPerformance()](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/wx.getPerformance.html)
*
-* 获取当前小程序性能相关的信息。
+* 需要基础库: `2.11.0`
+*
+* 在插件中使用:支持
+*
+* 获取当前小程序性能相关的信息。关于小程序启动性能优化的更多内容,请参考[启动性能指南](https://developers.weixin.qq.com/miniprogram/dev/framework/performance/tips/start.html)。
*
* ****
*
-* 目前支持获取以下几类性能指标:
+* 目前支持获取以下几类性能指标,具体内容请参考 [PerformanceEntry](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/PerformanceEntry.html):
*
-* | 指标类型(entryType) | 指标名称 |
-* | ------------------- | ---------------- |
-* | 路由(navigation) | route: 路由性能;appLaunch: 小程序启动耗时 |
-* | 渲染(render) | firstRender: 页面首次渲染耗时 |
-* | 脚本(script) | evaluateScript: 注入脚本耗时 |
-*
-* 性能数据详情:
-*
-* | 属性 | 说明 |
-* | ---- | ----- |
-* | entryType | 指标类型 |
-* | name | 指标名称 |
-* | startTime | 指标调用开始时间 |
-* | duration | 耗时 |
-* | path | 路径 |
-* | navigationStart | 路由真正响应开始时间 |
-* | navigationType | 路由详细类型 |
+* | 指标类型(entryType) | 指标名称 | 最低版本 |
+* | ------------------- | ---------------- | ------ |
+* | 路由(navigation) | route: 路由性能 | |
+* | 路由(navigation) | appLaunch: 小程序启动耗时 | |
+* | 渲染(render) | firstRender: 页面首次渲染耗时 | |
+* | 渲染(render) | firstPaint: 页面首次绘制 | <2.21.2> |
+* | 渲染(render) | firstContentfulPaint: 页面首次内容绘制 | <2.21.2> |
+* | 渲染(render) | largestContentfulPaint: 页面最大内容绘制 | <2.23.1> |
+* | 脚本(script) | evaluateScript: 注入脚本耗时 | |
+* | 包加载(loadPackage)| downloadPackage: 代码包下载耗时 | <2.24.0> |
+* | 资源(resource) | resourceTiming: 视图层资源加载耗时 | <2.24.0> |
*
* **示例代码**
*
-*
* ```js
const performance = wx.getPerformance()
const observer = performance.createObserver((entryList) => {
console.log(entryList.getEntries())
})
-observer.observe({ entryTypes: ['render', 'script'] })
+observer.observe({ entryTypes: ['render', 'script', 'navigation'] })
```
*
-* 最低基础库: `2.11.0` */
+* **注意**
+*
+* - 目前,当开启代码 [按需注入](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/lazyload.html) 时,`evaluateScript` 将仅包含公有部分代码(2.21.2 开始会区分公共部分/页面和组件的部分),页面和组件的代码注入的时间会包含在 `firstRender` 中(因为页面和组件的代码注入过程成为了首次渲染过程的一部分)。因此开启按需注入后,脚本耗时降低,渲染时间提高属于正常现象,优化效果可以关注整体启动耗时(`appLaunch`)来评估。
+* - firstPaint 和 firstContentfulPaint 指标在开启 vConsole 的情况下,由于绘制 vConsole 面板,会导致数据提前。 */
getPerformance(): Performance
+ /** [[PreDownloadSubpackageTask](https://developers.weixin.qq.com/miniprogram/dev/api/base/subpackage/PreDownloadSubpackageTask.html) wx.preDownloadSubpackage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/base/subpackage/wx.preDownloadSubpackage.html)
+*
+* 需要基础库: `2.27.3`
+*
+* 在插件中使用:不支持
+*
+* 触发分包预下载。
+*
+* **示例代码**
+*
+* ```js
+// 首先要在 app.json / game.json 中配置workers作为分包
+{
+ "workers": {
+ "path": "myWorkersFolder",
+ "isSubpackage": true // true 表示把 worker 打包为分包。默认 false。填 false 时等同于 { "workers": "myWorkersFolder" }
+ }
+}
+```
+* ```js
+// 然后调用 wx.preDownloadSubpackage 下载 worker 分包,下载成功后才可以创建 worker
+var task = wx.preDownloadSubpackage({
+ packageType: "workers",
+ success(res) {
+ console.log("load worker success", res)
+ wx.createWorker("myWorkersFolder/request/index.js") // 创建 worker。 如果 worker 分包没下载完就调 createWorker 的话将报错
+ },
+ fail(res) {
+ console.log("load worker fail", res)
+ }
+})
+
+task.onProgressUpdate(res => {
+ console.log(res.progress) // 可通过 onProgressUpdate 接口监听下载进度
+ console.log(res.totalBytesWritten)
+ console.log(res.totalBytesExpectedToWrite)
+})
+``` */
+ preDownloadSubpackage(
+ option: PreDownloadSubpackageOption
+ ): PreDownloadSubpackageTask
/** [[RealtimeLogManager](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeLogManager.html) wx.getRealtimeLogManager()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/wx.getRealtimeLogManager.html)
*
+* 需要基础库: `2.7.1`
+*
+* 在插件中使用:需要基础库 `2.16.0`
+*
* 获取实时日志管理器对象。
*
* **示例代码**
*
-*
* ```js
+// 小程序端
const logger = wx.getRealtimeLogManager()
logger.info({str: 'hello world'}, 'info log', 100, [1, 2, 3])
logger.error({str: 'hello world'}, 'error log', 100, [1, 2, 3])
logger.warn({str: 'hello world'}, 'warn log', 100, [1, 2, 3])
-```
-*
-* 最低基础库: `2.7.1` */
+
+// 插件端,基础库 2.16.0 版本后支持,只允许采用 key-value 的新格式上报
+const logManager = wx.getRealtimeLogManager()
+const logger = logManager.tag('plugin-log1')
+logger.info('key1', 'value1')
+logger.error('key2', {str: 'value2'})
+logger.warn('key3', 'value3')
+``` */
getRealtimeLogManager(): RealtimeLogManager
/** [[RecorderManager](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.html) wx.getRecorderManager()](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/wx.getRecorderManager.html)
*
- * 获取**全局唯一**的录音管理器 RecorderManager
+ * 需要基础库: `1.6.0`
*
- * 最低基础库: `1.6.0` */
+ * 在插件中使用:需要基础库 `1.9.94`
+ *
+ * 获取**全局唯一**的录音管理器 RecorderManager */
getRecorderManager(): RecorderManager
/** [[RequestTask](https://developers.weixin.qq.com/miniprogram/dev/api/network/request/RequestTask.html) wx.request(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/network/request/wx.request.html)
*
+* 在插件中使用:需要基础库 `1.9.6`
+*
* 发起 HTTPS 网络请求。使用前请注意阅读[相关说明](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/network.html)。
*
* **data 参数说明**
*
-*
* 最终发送给服务器的数据是 String 类型,如果传入的 data 不是 String 类型,会被转换成 String 。转换规则如下:
* - 对于 `GET` 方法的数据,会将数据转换成 query string(`encodeURIComponent(k)=encodeURIComponent(v)&encodeURIComponent(k)=encodeURIComponent(v)...`)
* - 对于 `POST` 方法且 `header['content-type']` 为 `application/json` 的数据,会对数据进行 JSON 序列化
* - 对于 `POST` 方法且 `header['content-type']` 为 `application/x-www-form-urlencoded` 的数据,会将数据转换成 query string `(encodeURIComponent(k)=encodeURIComponent(v)&encodeURIComponent(k)=encodeURIComponent(v)...)`
*
-* **示例代码**
+* **useHighPerformanceMode 高性能模式说明**
*
+* 在该模式下,框架将会采用全新的网络请求模块,默认支持 HTTP3,可以提升小程序的网络请求性能。有以下注意事项:
+* - 除声明了 `enableChunked` 后会走 HTTP1 以外,均会自动开启 HTTP2/HTTP3 等优化能力,`enableQuic`、`enableHttp2` 参数将会强制开启。建议开发者在后台服务也开启对应能力以获得更好的效果。
+* - 暂仅支持 Android,iOS/PC 端设置该参数后会使用原 request 模块。iOS 会在后续支持该参数。
+* - 暂不支持 HttpDNS 能力。
+* - 开启 `enableProfile` 后,返回的 profile 字段部分信息缺失,会被缺省值代替。缺失部分包括 redirectStart、redirectEnd、rtt、estimate_nettype、httpRttEstimate、transportRttEstimate、downstreamThroughputKbpsEstimate、throughputKbps、peerIP、port。
+*
+* **示例代码**
*
* ```js
wx.request({
- url: 'test.php', //仅为示例,并非真实的接口地址
+ url: 'example.php', //仅为示例,并非真实的接口地址
data: {
x: '',
y: ''
@@ -12032,19 +22800,24 @@ wx.request({
): RequestTask
/** [[RewardedVideoAd](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.html) wx.createRewardedVideoAd(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/wx.createRewardedVideoAd.html)
*
- * 创建激励视频广告组件。请通过 [wx.getSystemInfoSync()](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/system-info/wx.getSystemInfoSync.html) 返回对象的 SDKVersion 判断基础库版本号后再使用该 API(小游戏端要求 >= 2.0.4, 小程序端要求 >= 2.6.0)。调用该方法创建的激励视频广告是一个单例(小游戏端是全局单例,小程序端是页面内单例,在小程序端的单例对象不允许跨页面使用)。
+ * 需要基础库: `2.0.4`
*
- * 最低基础库: `2.0.4` */
+ * 在插件中使用:需要基础库 `2.8.1`
+ *
+ * 创建激励视频广告组件。请通过 [wx.getSystemInfoSync()](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getSystemInfoSync.html) 返回对象的 SDKVersion 判断基础库版本号后再使用该 API(小游戏端要求 >= 2.0.4, 小程序端要求 >= 2.6.0)。调用该方法创建的激励视频广告是一个单例(小游戏端是全局单例,小程序端是页面内单例,在小程序端的单例对象不允许跨页面使用)。 */
createRewardedVideoAd(
option: CreateRewardedVideoAdOption
): RewardedVideoAd
/** [[SelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html) wx.createSelectorQuery()](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/wx.createSelectorQuery.html)
*
+* 需要基础库: `1.4.0`
+*
+* 在插件中使用:需要基础库 `1.9.6`
+*
* 返回一个 SelectorQuery 对象实例。在自定义组件或包含自定义组件的页面中,应使用 `this.createSelectorQuery()` 来代替。
*
* **示例代码**
*
-*
* ```js
const query = wx.createSelectorQuery()
query.select('#the-id').boundingClientRect()
@@ -12053,52 +22826,80 @@ query.exec(function(res){
res[0].top // #the-id节点的上边界坐标
res[1].scrollTop // 显示区域的竖直滚动位置
})
-```
-*
-* 最低基础库: `1.4.0` */
+``` */
createSelectorQuery(): SelectorQuery
/** [[SocketTask](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.html) wx.connectSocket(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/wx.connectSocket.html)
*
+* 在插件中使用:需要基础库 `1.9.6`
+*
+* @warning **推荐使用 [SocketTask](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.html) 的方式去管理 webSocket 链接,每一条链路的生命周期都更加可控,同时存在多个 webSocket 的链接的情况下使用 wx 前缀的方法可能会带来一些和预期不一致的情况。**
+*
* 创建一个 WebSocket 连接。使用前请注意阅读[相关说明](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/network.html)。
*
* **并发数**
*
-*
* - 1.7.0 及以上版本,最多可以同时存在 5 个 WebSocket 连接。
* - 1.7.0 以下版本,一个小程序同时只能有一个 WebSocket 连接,如果当前已存在一个 WebSocket 连接,会自动关闭该连接,并重新创建一个 WebSocket 连接。
*
* **示例代码**
*
-*
* ```js
wx.connectSocket({
url: 'wss://example.qq.com',
header:{
'content-type': 'application/json'
- },
- protocols: ['protocol1']
+ }
})
``` */
connectSocket(option: ConnectSocketOption): SocketTask
- /** [[UDPSocket](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.html) wx.createUDPSocket()](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/wx.createUDPSocket.html)
+ /** [[TCPSocket](https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.html) wx.createTCPSocket(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/wx.createTCPSocket.html)
*
- * 创建一个 UDP Socket 实例。使用前请注意阅读[相关说明](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/network.html)。
+ * 需要基础库: `2.18.0`
*
- * 最低基础库: `2.7.0` */
- createUDPSocket(): UDPSocket
+ * 在插件中使用:支持
+ *
+ * 创建一个 TCP Socket 实例。使用前请注意阅读[相关说明](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/network.html)。
+ *
+ * **连接限制**
+ *
+ * - 允许与局域网内的非本机 IP 通信
+ * - 允许与配置过的服务器域名通信,详见[相关说明](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/network.html)
+ * - 禁止与以下端口号连接:`1024 以下` `1099` `1433` `1521` `1719` `1720` `1723` `2049` `2375` `3128` `3306` `3389` `3659` `4045` `5060` `5061` `5432` `5984` `6379` `6000` `6566` `7001` `7002` `8000-8100` `8443` `8888` `9200` `9300` `10051` `10080` `11211` `27017` `27018` `27019`
+ * - 每 5 分钟内最多创建 20 个 TCPSocket */
+ createTCPSocket(option?: CreateTCPSocketOption): TCPSocket
+ /** [[UDPSocket](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.html) wx.createUDPSocket(string type)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/wx.createUDPSocket.html)
+ *
+ * 需要基础库: `2.7.0`
+ *
+ * 在插件中使用:需要基础库 `2.11.1`
+ *
+ * 创建一个 UDP Socket 实例。使用前请注意阅读[相关说明](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/network.html)。 */
+ createUDPSocket(
+ /** 需要基础库: `2.18.0`
+ *
+ * 套接字族,必须是 udp4 或 udp6,默认是 udp4 */
+ type?: string
+ ): UDPSocket
/** [[UpdateManager](https://developers.weixin.qq.com/miniprogram/dev/api/base/update/UpdateManager.html) wx.getUpdateManager()](https://developers.weixin.qq.com/miniprogram/dev/api/base/update/wx.getUpdateManager.html)
+ *
+ * 需要基础库: `1.9.90`
+ *
+ * 在插件中使用:不支持
*
* 获取**全局唯一**的版本更新管理器,用于管理小程序更新。关于小程序的更新机制,可以查看[运行机制](https://developers.weixin.qq.com/miniprogram/dev/framework/runtime/operating-mechanism.html)文档。
*
- * 最低基础库: `1.9.90` */
+ * **示例代码**
+ *
+ * [示例代码](https://developers.weixin.qq.com/miniprogram/dev/api/base/update/UpdateManager.html#示例代码) */
getUpdateManager(): UpdateManager
/** [[UploadTask](https://developers.weixin.qq.com/miniprogram/dev/api/network/upload/UploadTask.html) wx.uploadFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/network/upload/wx.uploadFile.html)
*
+* 在插件中使用:需要基础库 `1.9.6`
+*
* 将本地资源上传到服务器。客户端发起一个 HTTPS POST 请求,其中 `content-type` 为 `multipart/form-data`。使用前请注意阅读[相关说明](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/network.html)。
*
* **示例代码**
*
-*
* ```js
wx.chooseImage({
success (res) {
@@ -12119,7 +22920,61 @@ wx.chooseImage({
})
``` */
uploadFile(option: UploadFileOption): UploadTask
+ /** [[UserCryptoManager](https://developers.weixin.qq.com/miniprogram/dev/api/base/crypto/UserCryptoManager.html) wx.getUserCryptoManager()](https://developers.weixin.qq.com/miniprogram/dev/api/base/crypto/wx.getUserCryptoManager.html)
+ *
+ * 需要基础库: `2.17.3`
+ *
+ * 在插件中使用:不支持
+ *
+ * 获取用户加密模块 */
+ getUserCryptoManager(): UserCryptoManager
+ /** [[VKSession](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.html) wx.createVKSession(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/wx.createVKSession.html)
+*
+* 需要基础库: `2.20.0`
+*
+* 在插件中使用:需要基础库 `2.20.0`
+*
+* 创建 vision kit 会话对象。详见[指南](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/visionkit/base.html)
+*
+* **示例代码**
+*
+* v1 版本:[VisionKit基础能力使用参考](https://github.com/wechat-miniprogram/miniprogram-demo/tree/master/miniprogram/packageAPI/pages/ar/visionkit-basic)
+* v2 版本:[VisionKit-v2基础能力使用参考](https://github.com/wechat-miniprogram/miniprogram-demo/tree/master/miniprogram/packageAPI/pages/ar/visionkit-basic-v2)
+* ```js
+// 以下 demo 以 v2 为例
+// 创建 session 对象
+const ssession = wx.createVKSession({
+ track: {
+ plane: {mode: 3},
+ },
+ version: 'v2',
+ gl, // WebGLRenderingContext
+})
+
+// 逐帧分析
+const onFrame = timestamp => {
+ // 开发者可以自己控制帧率
+ const frame = session.getVKFrame(canvasWidth, canvasHeight)
+ if (frame) {
+ // 分析完毕,可以拿到帧对象
+ doRender(frame)
+ }
+
+ session.requestAnimationFrame(onFrame)
+}
+session.start(err => {
+ if (!err) session.requestAnimationFrame(onFrame)
+})
+
+// 渲染函数
+const doRender = frame => {
+ // ...
+}
+``` */
+ createVKSession(option: VKConfig): VKSession
/** [[VideoContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.html) wx.createVideoContext(string id, Object this)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.createVideoContext.html)
+ *
+ * 在插件中使用:需要基础库 `1.9.6`
*
* 创建 [video](https://developers.weixin.qq.com/miniprogram/dev/component/video.html) 上下文 [VideoContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.html) 对象。建议使用 [wx.createSelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/wx.createSelectorQuery.html) 获取 context 对象。 */
createVideoContext(
@@ -12130,29 +22985,48 @@ wx.chooseImage({
): VideoContext
/** [[VideoDecoder](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.html) wx.createVideoDecoder()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/wx.createVideoDecoder.html)
*
- * 创建视频解码器,可逐帧获取解码后的数据
+ * 需要基础库: `2.11.0`
*
- * 最低基础库: `2.11.0` */
+ * 在插件中使用:需要基础库 `2.11.0`
+ *
+ * 创建视频解码器,可逐帧获取解码后的数据 */
createVideoDecoder(): VideoDecoder
+ /** [[WebAudioContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.html) wx.createWebAudioContext()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.createWebAudioContext.html)
+ *
+ * 需要基础库: `2.19.0`
+ *
+ * 在插件中使用:不支持
+ *
+ * 创建 WebAudio 上下文。 */
+ createWebAudioContext(): WebAudioContext
/** [[Worker](https://developers.weixin.qq.com/miniprogram/dev/api/worker/Worker.html) wx.createWorker(string scriptPath, object options)](https://developers.weixin.qq.com/miniprogram/dev/api/worker/wx.createWorker.html)
*
-* 创建一个 [Worker 线程](https://developers.weixin.qq.com/miniprogram/dev/framework/workers.html)
+* 需要基础库: `1.9.90`
+*
+* 在插件中使用:需要基础库 `2.18.1`
+*
+* 创建一个 Worker 线程
*
* **示例代码**
*
-*
* ```js
// 创建普通worker
wx.createWorker('workers/index.js')
```
* ```js
+function createNewWorker() {
+ const worker = wx.createWorker('workers/index.js', {
+ useExperimentalWorker: true
+ })
+ // 监听worker被系统回收事件
+ worker.onProcessKilled(() => {
+ // 重新创建一个worker
+ createNewWorker()
+ })
+}
// 创建实验worker
-wx.createWorker('workers/index.js', {
- useExperimentalWorker: true
-})
-```
-*
-* 最低基础库: `1.9.90` */
+createNewWorker()
+``` */
createWorker(
/** worker 入口文件的**绝对路径** */
scriptPath: string,
@@ -12161,20 +23035,16 @@ wx.createWorker('workers/index.js', {
): Worker
/** [any wx.getStorageSync(string key)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.getStorageSync.html)
*
-* [wx.getStorage](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.getStorage.html) 的同步版本
+* 在插件中使用:需要基础库 `1.9.6`
+*
+* 从本地缓存中同步获取指定 key 的内容。
+*
+* **注意**
+*
+* storage 应只用来进行数据的持久化存储,不应用于运行时的数据传递或全局状态管理。启动过程中过多的同步读写存储,会显著影响启动耗时。
*
* **示例代码**
*
-*
-* ```js
-wx.getStorage({
- key: 'key',
- success (res) {
- console.log(res.data)
- }
-})
-```
-*
* ```js
try {
var value = wx.getStorageSync('key')
@@ -12191,11 +23061,14 @@ try {
): T
/** [boolean wx.canIUse(string schema)](https://developers.weixin.qq.com/miniprogram/dev/api/base/wx.canIUse.html)
*
+* 需要基础库: `1.1.1`
+*
+* 在插件中使用:不支持
+*
* 判断小程序的API,回调,参数,组件等是否在当前版本可用。
*
* **参数说明**
*
-*
* - `${API}` 代表 API 名字
* - `${method}` 代表调用方式,有效值为return, success, object, callback
* - `${param}` 代表参数或者返回值
@@ -12206,7 +23079,6 @@ try {
*
* **示例代码**
*
-*
* ```js
// 对象的属性或方法
wx.canIUse('console.log')
@@ -12226,36 +23098,111 @@ wx.canIUse('request.object.method.GET')
wx.canIUse('live-player')
wx.canIUse('text.selectable')
wx.canIUse('button.open-type.contact')
-```
-*
-* 最低基础库: `1.1.1` */
+``` */
canIUse(
/** 使用 `${API}.${method}.${param}.${option}` 或者 `${component}.${attribute}.${option}` 方式来调用 */
schema: string
): boolean
+ /** [boolean wx.checkIsPictureInPictureActive()](https://developers.weixin.qq.com/miniprogram/dev/api/ui/window/wx.checkIsPictureInPictureActive.html)
+ *
+ * 需要基础库: `2.29.2`
+ *
+ * 在插件中使用:不支持
+ *
+ * 返回当前是否存在小窗播放(小窗在 video/live-player/live-pusher 下可用) */
+ checkIsPictureInPictureActive(): boolean
+ /** [boolean wx.isVKSupport(string version)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/wx.isVKSupport.html)
+*
+* 需要基础库: `2.22.0`
+*
+* 在插件中使用:需要基础库 `2.22.0`
+*
+* 判断支持版本
+*
+* **示例代码**
+*
+* ```js
+const isSupportV2 = wx.isVKSupport('v2')
+``` */
+ isVKSupport(
+ /** 参数 version 可选值:
+ * - 'v1': 旧版本;
+ * - 'v2': v2 版本,目前只有 iOS 基础库 2.22.0 以上支持; */
+ version: 'v1' | 'v2'
+ ): boolean
/** [string wx.arrayBufferToBase64(ArrayBuffer arrayBuffer)](https://developers.weixin.qq.com/miniprogram/dev/api/base/wx.arrayBufferToBase64.html)
*
- * 将 ArrayBuffer 对象转成 Base64 字符串
+ * 需要基础库: `1.1.0`
*
- * 最低基础库: `1.1.0`
+ * 在插件中使用:支持
* @deprecated 基础库版本 [2.4.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃
- * */
+ *
+ * 将 ArrayBuffer 对象转成 Base64 字符串 */
arrayBufferToBase64(
/** 要转换成 Base64 字符串的 ArrayBuffer 对象 */
arrayBuffer: ArrayBuffer
): string
+ /** [string wx.createBufferURL(ArrayBuffer|TypedArray buffer)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.createBufferURL.html)
+ *
+ * 需要基础库: `2.14.0`
+ *
+ * 在插件中使用:不支持
+ *
+ * 根据传入的 buffer 创建一个唯一的 URL 存在内存中 */
+ createBufferURL(
+ /** 需要存入内存的二进制数据 */
+ buffer:
+ | ArrayBuffer
+ | Int8Array
+ | Uint8Array
+ | Uint8ClampedArray
+ | Int16Array
+ | Uint16Array
+ | Int32Array
+ | Uint32Array
+ | Float32Array
+ | Float64Array
+ ): string
+ /** [string wx.getApiCategory()](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/life-cycle/wx.getApiCategory.html)
+ *
+ * 需要基础库: `2.33.0`
+ *
+ * 在插件中使用:不支持
+ *
+ * 获取当前 API 类别
+ *
+ * **不同 apiCategory 场景下的 API 限制**
+ *
+ * `X` 表示 API 被限制无法使用;不在表格中的 API 不限制。
+ *
+ * | | default | nativeFunctionalized | browseOnly | embedded | chatTool |
+ * |-|-|-|-|-|--|
+ * |openSetting | | | `X` | | |
+ * |<button open-type="share"> | | `X` | `X` | `X` | `X` |
+ * |<button open-type="feedback"> | | | `X` | | |
+ * |<button open-type="open-setting">| | | `X` | | |
+ * |navigateToMiniProgram | | `X` | `X` | | `X` |
+ * |openEmbeddedMiniProgram | | `X` | `X` | `X` | `X` |
+ * |openOfficialAccountArticle | | | | | `X` |
+ * |openChannelsUserProfile | | | | | `X` |
+ * |ad | | | | | `X` |
+ * |ad-custom | | | | | `X` |
+ * |小程序菜单分享 | | | | | `X` | */
+ getApiCategory(): string
/** [wx.addCard(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/card/wx.addCard.html)
*
+* 需要基础库: `1.1.0`
+*
+* 在插件中使用:不支持
+*
* 批量添加卡券。只有通过 [认证](https://developers.weixin.qq.com/miniprogram/product/renzheng.html) 的小程序或文化互动类目的小游戏才能使用。更多文档请参考 [微信卡券接口文档](https://mp.weixin.qq.com/cgi-bin/announce?action=getannouncement&key=1490190158&version=1&lang=zh_CN&platform=2)。
*
* **cardExt 说明**
*
-*
* cardExt 是卡券的扩展参数,其值是一个 JSON 字符串。
*
* **示例代码**
*
-*
* ```js
wx.addCard({
cardList: [
@@ -12271,17 +23218,58 @@ wx.addCard({
console.log(res.cardList) // 卡券添加结果
}
})
-```
-*
-* 最低基础库: `1.1.0` */
+``` */
addCard(
option: T
): PromisifySuccessResult
+ /** [wx.addFileToFavorites(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/favorites/wx.addFileToFavorites.html)
+ *
+ * 需要基础库: `2.16.1`
+ *
+ * 在插件中使用:不支持
+ *
+ * 收藏文件 */
+ addFileToFavorites<
+ T extends AddFileToFavoritesOption = AddFileToFavoritesOption
+ >(
+ option: T
+ ): PromisifySuccessResult
+ /** [wx.addPaymentPassFinish(Object args)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/wx.addPaymentPassFinish.html)
+ *
+ * 需要基础库: `3.8.5`
+ *
+ * 在插件中使用:不支持
+ *
+ * 通知客户端开卡成功 */
+ addPaymentPassFinish(args: AddPaymentPassFinishOption): void
+ /** [wx.addPaymentPassGetCertificateData(Object args, String cardholderName, String primaryAccountSuffix, String title, Array.<Object> showContents, String encryptScheme, String panid)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/wx.addPaymentPassGetCertificateData.html)
+ *
+ * 需要基础库: `3.8.5`
+ *
+ * 在插件中使用:不支持
+ *
+ * 拉起ApplePay添加卡流程,从PassKit获取证书、nonce与nonce签名 */
+ addPaymentPassGetCertificateData(
+ args: AddPaymentPassGetCertificateDataOption,
+ /** 持卡人姓名 */
+ cardholderName: string,
+ /** 持卡人卡号 */
+ primaryAccountSuffix: string,
+ /** 开卡标题 */
+ title: string,
+ showContents: CardDesc[],
+ /** ECC加密"EV_ECC_v2" RSA加密 "EV_RSA_v2" 默认ECC加密 */
+ encryptScheme: string,
+ /** 唯一id */
+ panid: string
+ ): void
/** [wx.addPhoneCalendar(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/calendar/wx.addPhoneCalendar.html)
*
- * 向系统日历添加事件
+ * 需要基础库: `2.15.0`
*
- * 最低基础库: `2.15.0` */
+ * 在插件中使用:不支持
+ *
+ * 向系统日历添加事件 */
addPhoneCalendar<
T extends AddPhoneCalendarOption = AddPhoneCalendarOption
>(
@@ -12289,9 +23277,11 @@ wx.addCard({
): PromisifySuccessResult
/** [wx.addPhoneContact(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/contact/wx.addPhoneContact.html)
*
- * 添加手机通讯录联系人。用户可以选择将该表单以「新增联系人」或「添加到已有联系人」的方式,写入手机系统通讯录。
+ * 需要基础库: `1.2.0`
*
- * 最低基础库: `1.2.0` */
+ * 在插件中使用:需要基础库 `1.9.6`
+ *
+ * 添加手机通讯录联系人。用户可以选择将该表单以「新增联系人」或「添加到已有联系人」的方式,写入手机系统通讯录。 */
addPhoneContact<
T extends AddPhoneContactOption = AddPhoneContactOption
>(
@@ -12299,21 +23289,38 @@ wx.addCard({
): PromisifySuccessResult
/** [wx.addPhoneRepeatCalendar(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/calendar/wx.addPhoneRepeatCalendar.html)
*
- * 向系统日历添加重复事件
+ * 需要基础库: `2.15.0`
*
- * 最低基础库: `2.15.0` */
+ * 在插件中使用:不支持
+ *
+ * 向系统日历添加重复事件 */
addPhoneRepeatCalendar<
T extends AddPhoneRepeatCalendarOption = AddPhoneRepeatCalendarOption
>(
option: T
): PromisifySuccessResult
+ /** [wx.addVideoToFavorites(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/favorites/wx.addVideoToFavorites.html)
+ *
+ * 需要基础库: `2.16.1`
+ *
+ * 在插件中使用:不支持
+ *
+ * 收藏视频 */
+ addVideoToFavorites<
+ T extends AddVideoToFavoritesOption = AddVideoToFavoritesOption
+ >(
+ option: T
+ ): PromisifySuccessResult
/** [wx.authPrivateMessage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.authPrivateMessage.html)
*
+* 需要基础库: `2.13.0`
+*
+* 在插件中使用:不支持
+*
* 验证私密消息。用法详情见 [小程序私密消息使用指南](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share/private-message.html)
*
* **示例代码**
*
-*
* ```js
wx.authPrivateMessage({
shareTicket: 'xxxxxx',
@@ -12331,18 +23338,19 @@ wx.authPrivateMessage({
console.log('authPrivateMessage fail', res)
}
})
-```
-*
-* 最低基础库: `2.13.0` */
+``` */
authPrivateMessage(option?: AuthPrivateMessageOption): void
/** [wx.authorize(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/authorize/wx.authorize.html)
*
+* 需要基础库: `1.2.0`
+*
+* 在插件中使用:不支持
+*
* 提前向用户发起授权请求。调用后会立刻弹窗询问用户是否同意授权小程序使用某项功能或获取用户的某些数据,但不会实际调用对应接口。如果用户之前已经同意授权,则不会出现弹窗,直接返回成功。更多用法详见 [用户授权](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html)。
* > 小程序插件可以使用 [wx.authorizeForMiniProgram](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/authorize/wx.authorizeForMiniProgram.html)
*
* **示例代码**
*
-*
* ```js
// 可以通过 wx.getSetting 先查询一下用户是否授权了 "scope.record" 这个 scope
wx.getSetting({
@@ -12358,19 +23366,20 @@ wx.getSetting({
}
}
})
-```
-*
-* 最低基础库: `1.2.0` */
+``` */
authorize(
option: T
): PromisifySuccessResult
/** [wx.authorizeForMiniProgram(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/authorize/wx.authorizeForMiniProgram.html)
*
+* 需要基础库: `2.14.4`
+*
+* 在插件中使用:需要基础库 `2.14.4`
+*
* **仅小程序插件中能调用该接口**,用法同 [wx.authorize](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/authorize/wx.authorize.html)。目前仅支持三种 scope(见下)
*
* **示例代码**
*
-*
* ```js
wx.authorizeForMiniProgram({
scope: 'scope.record',
@@ -12379,17 +23388,128 @@ wx.authorizeForMiniProgram({
wx.startRecord()
}
})
+``` */
+ authorizeForMiniProgram(option: AuthorizeForMiniProgramOption): void
+ /** [wx.batchGetStorage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.batchGetStorage.html)
+*
+* 需要基础库: `2.25.0`
+*
+* 在插件中使用:不支持
+*
+* 从本地缓存中异步批量获取指定 key 的内容。
+*
+* **示例代码**
+*
+* ```js
+wx.batchGetStorage({
+ keyList: ['key'],
+ success (res) {
+ console.log(res)
+ }
+})
+``` */
+ batchGetStorage<
+ T extends BatchGetStorageOption = BatchGetStorageOption
+ >(
+ option: T
+ ): PromisifySuccessResult
+ /** [wx.batchSetStorage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.batchSetStorage.html)
+*
+* 需要基础库: `2.25.0`
+*
+* 在插件中使用:不支持
+*
+* 将数据批量存储在本地缓存中指定的 key 中。会覆盖掉原来该 key 对应的内容。除非用户主动删除或因存储空间原因被系统清理,否则数据都一直可用。单个 key 允许存储的最大数据长度为 1MB,所有数据存储上限为 10MB。
+*
+* **示例代码**
+*
+* ```js
+wx.setStorage({
+ key:"key",
+ data:"value"
+})
```
*
-* 最低基础库: `2.14.4` */
- authorizeForMiniProgram(option: AuthorizeForMiniProgramOption): void
+* ```js
+// 开启加密存储
+wx.batchSetStorage({
+ kvList: [{
+ key: 'key',
+ value: 'value',
+ }],
+})
+``` */
+ batchSetStorage<
+ T extends BatchSetStorageOption = BatchSetStorageOption
+ >(
+ option: T
+ ): PromisifySuccessResult
+ /** [wx.batchSetStorageSync(Array.<Object> kvList)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.batchSetStorageSync.html)
+*
+* 需要基础库: `2.25.0`
+*
+* 在插件中使用:不支持
+*
+* 将数据批量存储在本地缓存中指定的 key 中。会覆盖掉原来该 key 对应的内容。除非用户主动删除或因存储空间原因被系统清理,否则数据都一直可用。单个 key 允许存储的最大数据长度为 1MB,所有数据存储上限为 10MB。
+*
+* **示例代码**
+*
+* ```js
+try {
+ wx.batchSetStorageSync([{key: 'key', value: 'value'}])
+} catch (e) { }
+``` */
+ batchSetStorageSync(kvList: KvList[]): void
+ /** [wx.bindEmployeeRelation(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/employee-relation/wx.bindEmployeeRelation.html)
+*
+* 需要基础库: `3.10.0`
+*
+* 在插件中使用:不支持
+*
+* 拉起小程序[用工关系](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/laboruse/intro.html)功能绑定弹窗,用户允许后可同步拉起用户关系消息订阅列表
+*
+* **示例代码**
+*
+* ```js
+wx.bindEmployeeRelation({
+ success(res) {
+ console.log(res.bindingStatus)
+ },
+})
+``` */
+ bindEmployeeRelation(option: BindEmployeeRelationOption): void
+ /** [wx.canAddSecureElementPass(Object args)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/wx.canAddSecureElementPass.html)
+ *
+ * 需要基础库: `3.8.5`
+ *
+ * 在插件中使用:不支持
+ *
+ * 判断设备是否支持添加该支付卡 */
+ canAddSecureElementPass(args: CanAddSecureElementPassOption): void
+ /** [wx.cancelIdleCallback(number idleCallbackId)](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/wx.cancelIdleCallback.html)
+*
+* 需要基础库: `3.10.0`
+*
+* 在插件中使用:不支持
+*
+* 取消之前注册的指定回调函数
+*
+* **示例代码**
+*
+* ```js
+wx.cancelIdleCallback(idleCallbackId)
+``` */
+ cancelIdleCallback(idleCallbackId: number): void
/** [wx.canvasGetImageData(Object object, Object this)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/wx.canvasGetImageData.html)
*
+* 需要基础库: `1.9.0`
+*
+* 在插件中使用:需要基础库 `1.9.6`
+*
* 获取 canvas 区域隐含的像素数据。
*
* **示例代码**
*
-*
* [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/yufmRjmZ7W8f)
*
* ```js
@@ -12406,9 +23526,7 @@ wx.canvasGetImageData({
console.log(res.data.length) // 100 * 100 * 4
}
})
-```
-*
-* 最低基础库: `1.9.0` */
+``` */
canvasGetImageData<
T extends CanvasGetImageDataOption = CanvasGetImageDataOption
>(
@@ -12418,9 +23536,11 @@ wx.canvasGetImageData({
): PromisifySuccessResult
/** [wx.canvasPutImageData(Object object, Object this)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/wx.canvasPutImageData.html)
*
- * 将像素数据绘制到画布。在自定义组件下,第二个参数传入自定义组件实例 this,以操作组件内 组件
+ * 需要基础库: `1.9.0`
*
- * 最低基础库: `1.9.0` */
+ * 在插件中使用:需要基础库 `1.9.6`
+ *
+ * 将像素数据绘制到画布。在自定义组件下,第二个参数传入自定义组件实例 this,以操作组件内 组件 */
canvasPutImageData<
T extends CanvasPutImageDataOption = CanvasPutImageDataOption
>(
@@ -12429,6 +23549,8 @@ wx.canvasGetImageData({
component?: Component.TrivialInstance | Page.TrivialInstance
): PromisifySuccessResult
/** [wx.canvasToTempFilePath(Object object, Object this)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/wx.canvasToTempFilePath.html)
+ *
+ * 在插件中使用:需要基础库 `1.9.6`
*
* 把当前画布指定区域的内容导出生成指定大小的图片。在 `draw()` 回调里调用该方法才能保证图片导出成功。 */
canvasToTempFilePath<
@@ -12438,11 +23560,57 @@ wx.canvasGetImageData({
/** 在自定义组件下,当前组件实例的this,以操作组件内 [canvas](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 组件 */
component?: Component.TrivialInstance | Page.TrivialInstance
): PromisifySuccessResult
+ /** [wx.checkDeviceSupportHevc(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.checkDeviceSupportHevc.html)
+*
+* 在插件中使用:需要基础库 `3.8.11`
+*
+* 查询设备是否支持 H.265 编码
+*
+* **示例代码**
+*
+* ```js
+wx.checkDeviceSupportHevc({
+ success (res) {
+ const supportHevc = res.supportHevc
+ }
+})
+``` */
+ checkDeviceSupportHevc(option?: CheckDeviceSupportHevcOption): void
+ /** [wx.checkEmployeeRelation(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/employee-relation/wx.checkEmployeeRelation.html)
+*
+* 需要基础库: `3.10.0`
+*
+* 在插件中使用:不支持
+*
+* 检查小程序[用工关系](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/laboruse/intro.html)功能和用户之间的绑定关系
+*
+* **示例代码**
+*
+* ```js
+wx.checkEmployeeRelation({
+ success(res) {
+ console.log(res.bindingStatus)
+ },
+})
+``` */
+ checkEmployeeRelation(option?: CheckEmployeeRelationOption): void
+ /** [wx.checkIsAddedToMyMiniProgram(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/my-miniprogram/wx.checkIsAddedToMyMiniProgram.html)
+ *
+ * 需要基础库: `2.29.1`
+ *
+ * 在插件中使用:不支持
+ *
+ * 检查小程序是否被添加至 「我的小程序」 */
+ checkIsAddedToMyMiniProgram(
+ option: CheckIsAddedToMyMiniProgramOption
+ ): void
/** [wx.checkIsOpenAccessibility(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/accessibility/wx.checkIsOpenAccessibility.html)
*
- * 检测是否开启视觉无障碍功能。
+ * 需要基础库: `2.13.0`
*
- * 最低基础库: `2.13.0` */
+ * 在插件中使用:不支持
+ *
+ * 检测是否开启视觉无障碍功能。 */
checkIsOpenAccessibility<
T extends CheckIsOpenAccessibilityOption = CheckIsOpenAccessibilityOption
>(
@@ -12450,11 +23618,14 @@ wx.canvasGetImageData({
): PromisifySuccessResult
/** [wx.checkIsSoterEnrolledInDevice(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/soter/wx.checkIsSoterEnrolledInDevice.html)
*
+* 需要基础库: `1.6.0`
+*
+* 在插件中使用:不支持
+*
* 获取设备内是否录入如指纹等生物信息的接口
*
* **示例代码**
*
-*
* ```js
wx.checkIsSoterEnrolledInDevice({
checkAuthMode: 'fingerPrint',
@@ -12462,9 +23633,7 @@ wx.checkIsSoterEnrolledInDevice({
console.log(res.isEnrolled)
}
})
-```
-*
-* 最低基础库: `1.6.0` */
+``` */
checkIsSoterEnrolledInDevice<
T extends CheckIsSoterEnrolledInDeviceOption = CheckIsSoterEnrolledInDeviceOption
>(
@@ -12472,11 +23641,14 @@ wx.checkIsSoterEnrolledInDevice({
): PromisifySuccessResult
/** [wx.checkIsSupportSoterAuthentication(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/soter/wx.checkIsSupportSoterAuthentication.html)
*
+* 需要基础库: `1.5.0`
+*
+* 在插件中使用:不支持
+*
* 获取本机支持的 SOTER 生物认证方式
*
* **示例代码**
*
-*
* ```js
wx.checkIsSupportSoterAuthentication({
success(res) {
@@ -12485,9 +23657,7 @@ wx.checkIsSupportSoterAuthentication({
// res.supportMode = ['fingerPrint', 'facial'] 支持指纹识别和人脸识别
}
})
-```
-*
-* 最低基础库: `1.5.0` */
+``` */
checkIsSupportSoterAuthentication<
T extends CheckIsSupportSoterAuthenticationOption = CheckIsSupportSoterAuthenticationOption
>(
@@ -12495,15 +23665,20 @@ wx.checkIsSupportSoterAuthentication({
): PromisifySuccessResult
/** [wx.checkSession(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/login/wx.checkSession.html)
*
-* 检查登录态是否过期。
+* 在插件中使用:不支持
*
-* 通过 wx.login 接口获得的用户登录态拥有一定的时效性。用户越久未使用小程序,用户登录态越有可能失效。反之如果用户一直在使用小程序,则用户登录态一直保持有效。具体时效逻辑由微信维护,对开发者透明。开发者只需要调用 wx.checkSession 接口检测当前用户登录态是否有效。
+* 检查登录态 session_key 是否过期。
*
-* 登录态过期后开发者可以再调用 wx.login 获取新的用户登录态。调用成功说明当前 session_key 未过期,调用失败说明 session_key 已过期。更多使用方法详见 [小程序登录](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/login.html)。
+* session_key 具有唯一性,在使用小程序时,同一用户在同一时刻仅有一个有效的 session_key。
+*
+* 通过 wx.login 接口获得的用户登录态拥有一定的时效性。用户越久未使用小程序,用户登录态越有可能过期。反之如果用户一直在使用小程序,则用户登录态一直保持有效。具体时效逻辑由微信维护,对开发者透明。除了过期失效外,触发获取临时登录凭证 code 的操作([小程序登录](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/login.html) 和 [数据预拉取](#))可能会生成新的登录态session_key,从而使旧的 session_key 被顶替而失效。
+*
+* 开发者可以调用 wx.checkSession 接口检测用户登录态是否过期。**注意,wx.checkSession 的校验对象是最后一次获取 code 操作对应的登录态 session_key**,调用成功说明该 session_key 未过期,调用失败说明 session_key 已过期。如果要校验指定的 session_key 是否有效,可以在开发者服务器后台调用 [checkSessionKey](https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/user-login/checkSessionKey.html)。
+*
+* 登录态失效后开发者可以再调用 wx.login 获取新的用户登录态。
*
* **示例代码**
*
-*
* ```js
wx.checkSession({
success () {
@@ -12520,11 +23695,19 @@ wx.checkSession({
): PromisifySuccessResult
/** [wx.chooseAddress(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/address/wx.chooseAddress.html)
*
+* 需要基础库: `1.1.0`
+*
+* 在插件中使用:需要基础库 `2.16.1`
+*
* 获取用户收货地址。调起用户编辑收货地址原生界面,并在编辑完成后返回用户选择的地址。
+* ## 使用方法
+* 自 2022 年 7 月 14 日后发布的小程序,若使用该接口,需要在 app.json 中进行声明,否则将无法正常使用该接口,2022年7月14日前发布的小程序不受影响。[具体规则见公告](https://developers.weixin.qq.com/community/develop/doc/000a02f2c5026891650e7f40351c01)
+* ## 申请开通
+* 暂只针对具备与地理位置强相关的使用场景的小程序开放,在小程序管理后台,「开发」-「开发管理」-「接口设置」中自助开通该接口权限。
+* 接口权限申请入口将于2022年3月11日开始内测,于3月31日全量上线。并从4月18日开始,在代码审核环节将检测该接口是否已完成开通,如未开通,将在代码提审环节进行拦截。
*
* **示例代码**
*
-*
* [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/024hHnmd772y)
* ```js
wx.chooseAddress({
@@ -12539,14 +23722,23 @@ wx.chooseAddress({
console.log(res.telNumber)
}
})
-```
-*
-* 最低基础库: `1.1.0` */
+``` */
chooseAddress(
option?: T
): PromisifySuccessResult
+ /** [wx.chooseContact(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/contact/wx.chooseContact.html)
+ *
+ * 需要基础库: `2.8.0`
+ *
+ * 在插件中使用:不支持
+ *
+ * 拉起手机通讯录,选择联系人。 */
+ chooseContact(option?: ChooseContactOption): void
/** [wx.chooseImage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.chooseImage.html)
*
+* 在插件中使用:需要基础库 `1.9.6`
+* @deprecated 基础库版本 [2.21.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [wx.chooseMedia](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.chooseMedia.html) 替换
+*
* 从本地相册选择图片或使用相机拍照。
*
* ****
@@ -12566,53 +23758,83 @@ wx.chooseImage({
option?: T
): PromisifySuccessResult
/** [wx.chooseInvoice(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/invoice/wx.chooseInvoice.html)
+ *
+ * 需要基础库: `2.3.0`
+ *
+ * 在插件中使用:需要基础库 `2.16.1`
*
* 选择用户已有的发票。
*
* **通过 cardId 和 encryptCode 获得报销发票的信息**
*
- *
* 请参考[微信电子发票文档](https://mp.weixin.qq.com/wiki?t=resource/res_main&id=21517918939oae3U)中,「查询报销发票信息」部分。
- * 其中 `access_token` 的获取请参考[auth.getAccessToken](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/access-token/auth.getAccessToken.html)文档
- *
- * 最低基础库: `2.3.0` */
+ * 其中 `access_token` 的获取请参考[auth.getAccessToken](#)文档 */
chooseInvoice(
option?: T
): PromisifySuccessResult
/** [wx.chooseInvoiceTitle(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/invoice/wx.chooseInvoiceTitle.html)
*
+* 需要基础库: `1.5.0`
+*
+* 在插件中使用:需要基础库 `2.16.1`
+*
* 选择用户的发票抬头。当前小程序必须关联一个公众号,且这个公众号是完成了[微信认证](https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1496554031_RD4xe)的,才能调用 chooseInvoiceTitle。
*
* **示例代码**
*
-*
* [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/GJ4S9nmQ7x2E)
*
* ```js
wx.chooseInvoiceTitle({
success(res) {}
})
-```
-*
-* 最低基础库: `1.5.0` */
+``` */
chooseInvoiceTitle<
T extends ChooseInvoiceTitleOption = ChooseInvoiceTitleOption
>(
option?: T
): PromisifySuccessResult
+ /** [wx.chooseLicensePlate(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/license-plate/wx.chooseLicensePlate.html)
+ *
+ * 需要基础库: `2.19.0`
+ *
+ * 在插件中使用:不支持
+ *
+ * 选择车牌号 */
+ chooseLicensePlate<
+ T extends ChooseLicensePlateOption = ChooseLicensePlateOption
+ >(
+ option?: T
+ ): PromisifySuccessResult
/** [wx.chooseLocation(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.chooseLocation.html)
*
- * 打开地图选择位置。 */
+ * 在插件中使用:需要基础库 `1.9.6`
+ *
+ * @warning **为确保选择地理位置接口的合理使用,位置接口调整参考 [选择地理位置接口调整公告](https://developers.weixin.qq.com/community/develop/doc/0006e45df2cac030e6edf367c56001)**
+ *
+ * 打开地图选择位置。
+ * ## 使用方法
+ * 自 2022 年 7 月 14 日后发布的小程序,若使用该接口,需要在 app.json 中进行声明,否则将无法正常使用该接口,2022年7月14日前发布的小程序不受影响。[具体规则见公告](https://developers.weixin.qq.com/community/develop/doc/000a02f2c5026891650e7f40351c01)
+ * ## 申请开通
+ * 暂只针对具备与地理位置强相关的使用场景的小程序开放,在小程序管理后台,「开发」-「开发管理」-「接口设置」中自助开通该接口权限。
+ * 接口权限申请入口将于2022年3月11日开始内测,于3月31日全量上线。并从4月18日开始,在代码审核环节将检测该接口是否已完成开通,如未开通,将在代码提审环节进行拦截。
+ *
+ * **示例**
+ *
+ *  */
chooseLocation(
option: T
): PromisifySuccessResult
/** [wx.chooseMedia(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.chooseMedia.html)
*
+* 需要基础库: `2.10.0`
+*
+* 在插件中使用:需要基础库 `2.11.1`
+*
* 拍摄或从手机相册中选择图片或视频。
*
* **示例代码**
*
-*
* ```js
wx.chooseMedia({
count: 9,
@@ -12621,18 +23843,20 @@ wx.chooseMedia({
maxDuration: 30,
camera: 'back',
success(res) {
- console.log(res.tempFiles.tempFilePath)
- console.log(res.tempFiles.size)
+ console.log(res.tempFiles[0].tempFilePath)
+ console.log(res.tempFiles[0].size)
}
})
-```
-*
-* 最低基础库: `2.10.0` */
+``` */
chooseMedia(
option: T
): PromisifySuccessResult
/** [wx.chooseMessageFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.chooseMessageFile.html)
*
+* 需要基础库: `2.5.0`
+*
+* 在插件中使用:不支持
+*
* 从客户端会话选择文件。
*
* ****
@@ -12646,21 +23870,40 @@ wx.chooseMessageFile({
const tempFilePaths = res.tempFiles
}
})
-```
-*
-* 最低基础库: `2.5.0` */
+``` */
chooseMessageFile<
T extends ChooseMessageFileOption = ChooseMessageFileOption
>(
option: T
): PromisifySuccessResult
+ /** [wx.choosePoi(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.choosePoi.html)
+ *
+ * 在插件中使用:不支持
+ *
+ * @warning **为确保选择地理位置接口的合理使用,位置接口调整参考 [选择地理位置接口调整公告](https://developers.weixin.qq.com/community/develop/doc/0006e45df2cac030e6edf367c56001)**
+ *
+ * 打开POI列表选择位置,支持模糊定位(精确到市)和精确定位混选。
+ * ## 使用方法
+ * 自 2022 年 7 月 14 日后发布的小程序,若使用该接口,需要在 app.json 中进行声明,否则将无法正常使用该接口,2022年7月14日前发布的小程序不受影响。[具体规则见公告](https://developers.weixin.qq.com/community/develop/doc/000a02f2c5026891650e7f40351c01)
+ * ## 申请开通
+ * 暂只针对具备与地理位置强相关的使用场景的小程序开放,在小程序管理后台,「开发」-「开发管理」-「接口设置」中自助开通该接口权限。
+ * 接口权限申请入口将于2022年3月11日开始内测,于3月31日全量上线。并从4月18日开始,在代码审核环节将检测该接口是否已完成开通,如未开通,将在代码提审环节进行拦截。
+ *
+ * **示例**
+ *
+ *  */
+ choosePoi(
+ option: T
+ ): PromisifySuccessResult
/** [wx.chooseVideo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.chooseVideo.html)
*
+* 在插件中使用:需要基础库 `1.9.6`
+* @deprecated 基础库版本 [2.21.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [wx.chooseMedia](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.chooseMedia.html) 替换
+*
* 拍摄视频或从手机相册中选视频。
*
* **示例代码**
*
-*
* ```js
wx.chooseVideo({
sourceType: ['album','camera'],
@@ -12676,11 +23919,12 @@ wx.chooseVideo({
): PromisifySuccessResult
/** [wx.clearStorage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.clearStorage.html)
*
-* 清理本地数据缓存。缓存相关策略请查看 [存储](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/storage.html)。
+* 在插件中使用:不支持
+*
+* 清理本地数据缓存。
*
* **示例代码**
*
-*
* ```js
wx.clearStorage()
```
@@ -12697,11 +23941,12 @@ try {
): PromisifySuccessResult
/** [wx.clearStorageSync()](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.clearStorageSync.html)
*
+* 在插件中使用:不支持
+*
* [wx.clearStorage](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.clearStorage.html) 的同步版本
*
* **示例代码**
*
-*
* ```js
wx.clearStorage()
```
@@ -12716,11 +23961,14 @@ try {
clearStorageSync(): void
/** [wx.closeBLEConnection(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.closeBLEConnection.html)
*
-* 断开与低功耗蓝牙设备的连接。
+* 需要基础库: `1.1.0`
+*
+* 在插件中使用:需要基础库 `1.9.6`
+*
+* 断开与蓝牙低功耗设备的连接。
*
* **示例代码**
*
-*
* [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
* ```js
wx.closeBLEConnection({
@@ -12729,9 +23977,7 @@ wx.closeBLEConnection({
console.log(res)
}
})
-```
-*
-* 最低基础库: `1.1.0` */
+``` */
closeBLEConnection<
T extends CloseBLEConnectionOption = CloseBLEConnectionOption
>(
@@ -12739,11 +23985,14 @@ wx.closeBLEConnection({
): PromisifySuccessResult
/** [wx.closeBluetoothAdapter(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.closeBluetoothAdapter.html)
*
+* 需要基础库: `1.1.0`
+*
+* 在插件中使用:需要基础库 `1.9.6`
+*
* 关闭蓝牙模块。调用该方法将断开所有已建立的连接并释放系统资源。建议在使用蓝牙流程后,与 [wx.openBluetoothAdapter](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.openBluetoothAdapter.html) 成对调用。
*
* **示例代码**
*
-*
* [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
* ```js
wx.closeBluetoothAdapter({
@@ -12751,9 +24000,7 @@ wx.closeBluetoothAdapter({
console.log(res)
}
})
-```
-*
-* 最低基础库: `1.1.0` */
+``` */
closeBluetoothAdapter<
T extends CloseBluetoothAdapterOption = CloseBluetoothAdapterOption
>(
@@ -12761,11 +24008,14 @@ wx.closeBluetoothAdapter({
): PromisifySuccessResult
/** [wx.closeSocket(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/wx.closeSocket.html)
*
-* 关闭 WebSocket 连接
+* 在插件中使用:不支持
+*
+* @warning **推荐使用 [SocketTask](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.html) 的方式去管理 webSocket 链接,每一条链路的生命周期都更加可控,同时存在多个 webSocket 的链接的情况下使用 wx 前缀的方法可能会带来一些和预期不一致的情况。**
+*
+* 关闭 WebSocket 连接。
*
* **示例代码**
*
-*
* ```js
wx.connectSocket({
url: 'test.php'
@@ -12787,37 +24037,43 @@ wx.onSocketClose(function(res) {
): PromisifySuccessResult
/** [wx.compressImage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.compressImage.html)
*
-* 压缩图片接口,可选压缩质量
+* 需要基础库: `2.4.0`
+*
+* 在插件中使用:需要基础库 `2.12.0`
+*
+* 压缩图片接口,可选压缩质量。iOS 仅支持压缩 JPG 格式图片。
*
* **示例代码**
*
-*
* ```js
wx.compressImage({
src: '', // 图片路径
quality: 80 // 压缩质量
})
-```
-*
-* 最低基础库: `2.4.0` */
+``` */
compressImage(
option: T
): PromisifySuccessResult
/** [wx.compressVideo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.compressVideo.html)
*
- * 压缩视频接口。开发者可指定压缩质量 `quality` 进行压缩。当需要更精细的控制时,可指定 `bitrate`、`fps`、和 `resolution`,当 `quality` 传入时,这三个参数将被忽略。原视频的相关信息可通过 [getVideoInfo](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.getVideoInfo.html) 获取。
+ * 需要基础库: `2.11.0`
*
- * 最低基础库: `2.11.0` */
+ * 在插件中使用:需要基础库 `2.11.1`
+ *
+ * 压缩视频接口。开发者可指定压缩质量 `quality` 进行压缩。当需要更精细的控制时,可指定 `bitrate`、`fps`、和 `resolution`,当 `quality` 传入时,这三个参数将被忽略。原视频的相关信息可通过 [getVideoInfo](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.getVideoInfo.html) 获取。 */
compressVideo(
option: T
): PromisifySuccessResult
/** [wx.connectWifi(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.connectWifi.html)
*
+* 需要基础库: `1.6.0`
+*
+* 在插件中使用:需要基础库 `2.9.1`
+*
* 连接 Wi-Fi。若已知 Wi-Fi 信息,可以直接利用该接口连接。仅 Android 与 iOS 11 以上版本支持。
*
* **示例代码**
*
-*
* ```js
wx.connectWifi({
SSID: '',
@@ -12828,38 +24084,42 @@ wx.connectWifi({
})
```
*
-* 最低基础库: `1.6.0` */
+* **注意**
+*
+* - Android 微信客户端 7.0.22 以上版本,connectWifi 的实现在 Android 10 及以上的手机无法生效,对于 Android 10 及以上版本,设备连接 wifi 之后,(受系统能力限制)其他进程无法使用当前连接的 wifi ;即连接上的 wifi 只对当前小程序有效,如果想要对整个系统生效,需要配置 maunal 来连接 wifi。
+* - iOS 系统底层没有给开发者提供因 wifi 密码错误而连接失败的事件,但用户可以收到密码错误的系统弹窗。建议开发者通过 onWifiConnected 事件来判断 wifi 是否连接成功;即设置定时器,若超时后仍没有 onWifiConnected 事件,则认定此次 wifi 连接无效。
+* - Android / iOS 在系统已经连上目标 wifi 的情况下,小程序再次连接目标 wifi,此时无论输入的密码是否正确,系统都会默认此次连接成功,且没有 onWifiConnected 事件。
+* - onWifiConnected 事件可能会返回空对象,此时代表 wifi 断开连接,开发者可忽略这种情况。 */
connectWifi(
option: T
): PromisifySuccessResult
/** [wx.createBLEConnection(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.createBLEConnection.html)
*
-* 连接低功耗蓝牙设备。
+* 需要基础库: `1.1.0`
*
-* 若小程序在之前已有搜索过某个蓝牙设备,并成功建立连接,可直接传入之前搜索获取的 deviceId 直接尝试连接该设备,无需进行搜索操作。
+* 在插件中使用:需要基础库 `1.9.6`
+*
+* 连接蓝牙低功耗设备。
+*
+* 若小程序在之前已有搜索过某个蓝牙设备,并成功建立连接,可直接传入之前搜索获取的 deviceId 直接尝试连接该设备,无需再次进行搜索操作。
*
* **注意**
*
-*
-* - 请保证尽量成对的调用 `createBLEConnection` 和 `closeBLEConnection` 接口。安卓如果多次调用 `createBLEConnection` 创建连接,有可能导致系统持有同一设备多个连接的实例,导致调用 `closeBLEConnection` 的时候并不能真正的断开与设备的连接。
+* - 请保证尽量成对的调用 [wx.createBLEConnection](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.createBLEConnection.html) 和 [wx.closeBLEConnection](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.closeBLEConnection.html) 接口。安卓如果重复调用 [wx.createBLEConnection](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.createBLEConnection.html) 创建连接,有可能导致系统持有同一设备多个连接的实例,导致调用 `closeBLEConnection` 的时候并不能真正的断开与设备的连接。
* - 蓝牙连接随时可能断开,建议监听 [wx.onBLEConnectionStateChange](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.onBLEConnectionStateChange.html) 回调事件,当蓝牙设备断开时按需执行重连操作
* - 若对未连接的设备或已断开连接的设备调用数据读写操作的接口,会返回 10006 错误,建议进行重连操作。
*
* **示例代码**
*
-*
* [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
* ```js
wx.createBLEConnection({
- // 这里的 deviceId 需要已经通过 createBLEConnection 与对应设备建立链接
deviceId,
success (res) {
console.log(res)
}
})
-```
-*
-* 最低基础库: `1.1.0` */
+``` */
createBLEConnection<
T extends CreateBLEConnectionOption = CreateBLEConnectionOption
>(
@@ -12867,39 +24127,123 @@ wx.createBLEConnection({
): PromisifySuccessResult
/** [wx.createBLEPeripheralServer(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/wx.createBLEPeripheralServer.html)
*
- * 建立本地作为外围设备的服务端,可创建多个。
+ * 需要基础库: `2.10.3`
*
- * 最低基础库: `2.10.3` */
+ * 在插件中使用:需要基础库 `2.22.1`
+ *
+ * 建立本地作为蓝牙低功耗外围设备的服务端,可创建多个。 */
createBLEPeripheralServer<
T extends CreateBLEPeripheralServerOption = CreateBLEPeripheralServerOption
>(
option?: T
): PromisifySuccessResult
+ /** [wx.cropImage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.cropImage.html)
+*
+* 需要基础库: `2.26.0`
+*
+* 在插件中使用:不支持
+*
+* 裁剪图片接口
+*
+* **示例代码**
+*
+* ```js
+wx.cropImage({
+ src: '', // 图片路径
+ cropScale: '16:9', // 裁剪比例
+})
+``` */
+ cropImage(option: CropImageOption): void
/** [wx.disableAlertBeforeUnload(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.disableAlertBeforeUnload.html)
*
- * 关闭小程序页面返回询问对话框
+ * 需要基础库: `2.12.0`
*
- * 最低基础库: `2.12.0` */
+ * 在插件中使用:不支持
+ *
+ * 关闭小程序页面返回询问对话框。 */
disableAlertBeforeUnload(option?: DisableAlertBeforeUnloadOption): void
+ /** [wx.editImage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.editImage.html)
+*
+* 需要基础库: `2.22.0`
+*
+* 在插件中使用:不支持
+*
+* 编辑图片接口
+*
+* **示例代码**
+*
+* ```js
+wx.editImage({
+ src: '', // 图片路径
+})
+``` */
+ editImage(option: EditImageOption): void
/** [wx.enableAlertBeforeUnload(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.enableAlertBeforeUnload.html)
*
- * 开启小程序页面返回询问对话框
+ * 需要基础库: `2.12.0`
*
- * 最低基础库: `2.12.0` */
+ * 在插件中使用:不支持
+ *
+ * 开启小程序页面返回询问对话框。
+ *
+ * ## 弹窗条件
+ * * 当用户在小程序内非首页页面/最底层页
+ * * 官方导航栏上的的返回
+ * * 全屏模式下自绘返回键
+ * * android 系统 back 键时
+ *
+ * ## 注意事项
+ * * 手势滑动返回时不做拦截
+ * * 在任何场景下,此功能都不应拦住用户退出小程序的行为
+ *
+ * **示例代码**
+ *
+ * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/MTPm9Cmh7VfT) */
enableAlertBeforeUnload(option: EnableAlertBeforeUnloadOption): void
+ /** [wx.exitMiniProgram(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/navigate/wx.exitMiniProgram.html)
+ *
+ * 需要基础库: `2.17.3`
+ *
+ * 在插件中使用:需要基础库 `2.30.1`
+ *
+ * 退出当前小程序 */
+ exitMiniProgram<
+ T extends ExitMiniProgramOption = ExitMiniProgramOption
+ >(
+ option?: T
+ ): PromisifySuccessResult
/** [wx.exitVoIPChat(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.exitVoIPChat.html)
*
- * 退出(销毁)实时语音通话
+ * 需要基础库: `2.7.0`
*
- * 最低基础库: `2.7.0` */
+ * 在插件中使用:需要基础库 `2.9.0`
+ *
+ * 退出(销毁)实时语音通话 */
exitVoIPChat(
option?: T
): PromisifySuccessResult
+ /** [wx.faceDetect(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/face/wx.faceDetect.html)
+ *
+ * 需要基础库: `2.18.0`
+ *
+ * 在插件中使用:需要基础库 `2.21.3`
+ *
+ * @warning **该接口已停止维护,推荐使用 [wx.createVKSession](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/wx.createVKSession.html) 代替**
+ *
+ * 人脸检测,使用前需要通过 wx.initFaceDetect 进行一次初始化,推荐使用相机接口返回的帧数据。本接口不再维护,请使用 [wx.createVKSession](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/wx.createVKSession.html) 接口代替。详情参考[人脸检测指南文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/visionkit/face.html)
+ *
+ * ****
+ *
+ * ### 特别说明
+ * 若小程序人脸识别功能涉及采集、存储用户生物特征(如人脸照片或视频、身份证和手持身份证、身份证照和免冠照等),此类型服务需使用[微信原生人脸识别接口](https://developers.weixin.qq.com/community/develop/doc/000442d352c1202bd498ecb105c00d?highline=%E4%BA%BA%E8%84%B8%E6%A0%B8%E8%BA%AB)。 */
+ faceDetect(option: FaceDetectOption): void
/** [wx.getAvailableAudioSources(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.getAvailableAudioSources.html)
*
- * 获取当前支持的音频输入源
+ * 需要基础库: `2.1.0`
*
- * 最低基础库: `2.1.0` */
+ * 在插件中使用:需要基础库 `2.15.0`
+ *
+ * 获取当前支持的音频输入源 */
getAvailableAudioSources<
T extends GetAvailableAudioSourcesOption = GetAvailableAudioSourcesOption
>(
@@ -12907,25 +24251,26 @@ wx.createBLEConnection({
): PromisifySuccessResult
/** [wx.getBLEDeviceCharacteristics(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.getBLEDeviceCharacteristics.html)
*
-* 获取蓝牙设备某个服务中所有特征值(characteristic)。
+* 需要基础库: `1.1.0`
+*
+* 在插件中使用:需要基础库 `1.9.6`
+*
+* 获取蓝牙低功耗设备某个服务中所有特征 (characteristic)。
*
* **示例代码**
*
-*
* [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
* ```js
wx.getBLEDeviceCharacteristics({
- // 这里的 deviceId 需要已经通过 createBLEConnection 与对应设备建立链接
+ // 这里的 deviceId 需要已经通过 wx.createBLEConnection 与对应设备建立链接
deviceId,
- // 这里的 serviceId 需要在 getBLEDeviceServices 接口中获取
+ // 这里的 serviceId 需要在 wx.getBLEDeviceServices 接口中获取
serviceId,
success (res) {
console.log('device getBLEDeviceCharacteristics:', res.characteristics)
}
})
-```
-*
-* 最低基础库: `1.1.0` */
+``` */
getBLEDeviceCharacteristics<
T extends GetBLEDeviceCharacteristicsOption = GetBLEDeviceCharacteristicsOption
>(
@@ -12933,9 +24278,11 @@ wx.getBLEDeviceCharacteristics({
): PromisifySuccessResult
/** [wx.getBLEDeviceRSSI(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.getBLEDeviceRSSI.html)
*
- * 获取蓝牙设备的信号强度。
+ * 需要基础库: `2.11.0`
*
- * 最低基础库: `2.11.0` */
+ * 在插件中使用:需要基础库 `2.11.0`
+ *
+ * 获取蓝牙低功耗设备的信号强度 (Received Signal Strength Indication, RSSI)。 */
getBLEDeviceRSSI<
T extends GetBLEDeviceRSSIOption = GetBLEDeviceRSSIOption
>(
@@ -12943,35 +24290,66 @@ wx.getBLEDeviceCharacteristics({
): PromisifySuccessResult
/** [wx.getBLEDeviceServices(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.getBLEDeviceServices.html)
*
-* 获取蓝牙设备所有服务(service)。
+* 需要基础库: `1.1.0`
+*
+* 在插件中使用:需要基础库 `1.9.6`
+*
+* 获取蓝牙低功耗设备所有服务 (service)。
*
* **示例代码**
*
-*
* [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
* ```js
wx.getBLEDeviceServices({
- // 这里的 deviceId 需要已经通过 createBLEConnection 与对应设备建立链接
+ // 这里的 deviceId 需要已经通过 wx.createBLEConnection 与对应设备建立连接
deviceId,
success (res) {
console.log('device services:', res.services)
}
})
-```
-*
-* 最低基础库: `1.1.0` */
+``` */
getBLEDeviceServices<
T extends GetBLEDeviceServicesOption = GetBLEDeviceServicesOption
>(
option: T
): PromisifySuccessResult
+ /** [wx.getBLEMTU(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.getBLEMTU.html)
+*
+* 需要基础库: `2.20.1`
+*
+* 在插件中使用:需要基础库 `2.20.1`
+*
+* 获取蓝牙低功耗的最大传输单元。需在 [wx.createBLEConnection](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.createBLEConnection.html) 调用成功后调用。
+*
+* **注意**
+*
+* - 小程序中 MTU 为 ATT_MTU,包含 Op-Code 和 Attribute Handle 的长度,实际可以传输的数据长度为 `ATT_MTU - 3`
+* - iOS 系统中 MTU 为固定值;安卓系统中,MTU 会在系统协商成功之后发生改变,建议使用 [wx.onBLEMTUChange](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.onBLEMTUChange.html) 监听。
+*
+* **示例代码**
+*
+* [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
+* ```js
+wx.getBLEMTU({
+ deviceId: '',
+ writeType: 'write',
+ success (res) {
+ console.log(res)
+ }
+})
+``` */
+ getBLEMTU(
+ option: T
+ ): PromisifySuccessResult
/** [wx.getBackgroundAudioPlayerState(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.getBackgroundAudioPlayerState.html)
*
+* 在插件中使用:需要基础库 `1.9.6`
+* @deprecated 基础库版本 [1.2.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [wx.getBackgroundAudioManager](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.getBackgroundAudioManager.html) 替换
+*
* 获取后台音乐播放状态。
*
* **示例代码**
*
-*
* ```js
wx.getBackgroundAudioPlayerState({
success (res) {
@@ -12982,9 +24360,7 @@ wx.getBackgroundAudioPlayerState({
const downloadPercent = res.downloadPercent
}
})
-```
-* @deprecated 基础库版本 [1.2.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [wx.getBackgroundAudioManager](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.getBackgroundAudioManager.html) 替换
-* */
+``` */
getBackgroundAudioPlayerState<
T extends GetBackgroundAudioPlayerStateOption = GetBackgroundAudioPlayerStateOption
>(
@@ -12992,9 +24368,12 @@ wx.getBackgroundAudioPlayerState({
): PromisifySuccessResult
/** [wx.getBackgroundFetchData(object object)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/background-fetch/wx.getBackgroundFetchData.html)
*
- * 拉取 backgroundFetch 客户端缓存数据
+ * 需要基础库: `2.8.0`
*
- * 最低基础库: `2.8.0` */
+ * 在插件中使用:不支持
+ *
+ * 拉取 backgroundFetch 客户端缓存数据。
+ * 当调用接口时,若当次请求未结束,会先返回本地的旧数据(之前打开小程序时请求的),如果本地没有旧数据,安卓上会返回fail,不会等待请求完成,iOS上会返回success但fetchedData为空,也不会等待请求完成。建议和 [wx.onBackgroundFetchData](https://developers.weixin.qq.com/miniprogram/dev/api/storage/background-fetch/wx.onBackgroundFetchData.html) 配合使用。 */
getBackgroundFetchData<
T extends GetBackgroundFetchDataOption = GetBackgroundFetchDataOption
>(
@@ -13002,9 +24381,11 @@ wx.getBackgroundAudioPlayerState({
): PromisifySuccessResult
/** [wx.getBackgroundFetchToken(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/background-fetch/wx.getBackgroundFetchToken.html)
*
- * 获取设置过的自定义登录态。若无,则返回 fail。
+ * 需要基础库: `2.8.0`
*
- * 最低基础库: `2.8.0` */
+ * 在插件中使用:不支持
+ *
+ * 获取设置过的自定义登录态。若无,则返回 fail。 */
getBackgroundFetchToken<
T extends GetBackgroundFetchTokenOption = GetBackgroundFetchTokenOption
>(
@@ -13012,25 +24393,32 @@ wx.getBackgroundAudioPlayerState({
): PromisifySuccessResult
/** [wx.getBatteryInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/battery/wx.getBatteryInfo.html)
*
- * 获取设备电量。同步 API [wx.getBatteryInfoSync](https://developers.weixin.qq.com/miniprogram/dev/api/device/battery/wx.getBatteryInfoSync.html) 在 iOS 上不可用。 */
+ * 在插件中使用:需要基础库 `2.15.0`
+ *
+ * 获取设备电池信息。同步 API [wx.getBatteryInfoSync](https://developers.weixin.qq.com/miniprogram/dev/api/device/battery/wx.getBatteryInfoSync.html) 在 iOS 上不可用。 */
getBatteryInfo(
option?: T
): PromisifySuccessResult
/** [wx.getBeacons(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.getBeacons.html)
*
- * 获取所有已搜索到的 iBeacon 设备
+ * 需要基础库: `1.2.0`
*
- * 最低基础库: `1.2.0` */
+ * 在插件中使用:需要基础库 `1.9.6`
+ *
+ * 获取所有已搜索到的 Beacon 设备 */
getBeacons(
option?: T
): PromisifySuccessResult
/** [wx.getBluetoothAdapterState(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.getBluetoothAdapterState.html)
*
+* 需要基础库: `1.1.0`
+*
+* 在插件中使用:需要基础库 `1.9.6`
+*
* 获取本机蓝牙适配器状态。
*
* **示例代码**
*
-*
* [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
* ```js
wx.getBluetoothAdapterState({
@@ -13038,9 +24426,7 @@ wx.getBluetoothAdapterState({
console.log(res)
}
})
-```
-*
-* 最低基础库: `1.1.0` */
+``` */
getBluetoothAdapterState<
T extends GetBluetoothAdapterStateOption = GetBluetoothAdapterStateOption
>(
@@ -13048,11 +24434,14 @@ wx.getBluetoothAdapterState({
): PromisifySuccessResult
/** [wx.getBluetoothDevices(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.getBluetoothDevices.html)
*
-* 获取在蓝牙模块生效期间所有已发现的蓝牙设备。包括已经和本机处于连接状态的设备。
+* 需要基础库: `1.1.0`
+*
+* 在插件中使用:需要基础库 `1.9.6`
+*
+* 获取在蓝牙模块生效期间所有搜索到的蓝牙设备。包括已经和本机处于连接状态的设备。
*
* **示例代码**
*
-*
* [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
*
* ```js
@@ -13076,56 +24465,158 @@ wx.getBluetoothDevices({
})
```
*
-* **注意事项**
+* **注意**
*
-*
-* - 该接口获取到的设备列表为**蓝牙模块生效期间所有搜索到的蓝牙设备**,若在蓝牙模块使用流程结束后未及时调用 [wx.closeBluetoothAdapter](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.closeBluetoothAdapter.html) 释放资源,会存在调用该接口会返回之前的蓝牙使用流程中搜索到的蓝牙设备,可能设备已经不在用户身边,无法连接。
-* - 蓝牙设备在被搜索到时,系统返回的 name 字段一般为广播包中的 LocalName 字段中的设备名称,而如果与蓝牙设备建立连接,系统返回的 name 字段会改为从蓝牙设备上获取到的 `GattName`。若需要动态改变设备名称并展示,建议使用 `localName` 字段。
-*
-* 最低基础库: `1.1.0` */
+* - 该接口获取到的设备列表为**蓝牙模块生效期间所有搜索到的蓝牙设备**,若在蓝牙模块使用流程结束后未及时调用 [wx.closeBluetoothAdapter](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.closeBluetoothAdapter.html) 释放资源,会存在调用该接口会返回之前的蓝牙使用流程中搜索到的蓝牙设备,可能设备已经不在用户身边,无法连接。 */
getBluetoothDevices<
T extends GetBluetoothDevicesOption = GetBluetoothDevicesOption
>(
option?: T
): PromisifySuccessResult
+ /** [wx.getChannelsLiveInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/channels/wx.getChannelsLiveInfo.html)
+ *
+ * 需要基础库: `2.15.0`
+ *
+ * 在插件中使用:不支持
+ *
+ * 获取视频号直播信息
+ *
+ * **常见错误码说明**
+ *
+ * 100008 视频号需要认证
+ * 40097 入参异常
+ * 1416104 视频号获取到的数据为空
+ * 1416100 非法的视频号id */
+ getChannelsLiveInfo(option: GetChannelsLiveInfoOption): void
+ /** [wx.getChannelsLiveNoticeInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/channels/wx.getChannelsLiveNoticeInfo.html)
+ *
+ * 需要基础库: `2.19.0`
+ *
+ * 在插件中使用:不支持
+ *
+ * 获取视频号直播预告信息 */
+ getChannelsLiveNoticeInfo(option: GetChannelsLiveNoticeInfoOption): void
+ /** [wx.getChannelsShareKey(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/channels/wx.getChannelsShareKey.html)
+ *
+ * 需要基础库: `2.22.1`
+ *
+ * 在插件中使用:不支持
+ *
+ * 获取视频号直播卡片/视频卡片的分享来源,仅当卡片携带了分享信息、同时用户已授权该小程序获取视频号分享信息且启动场景值为 1177、1184、1195、1208 时可用。 */
+ getChannelsShareKey(option?: GetChannelsShareKeyOption): void
+ /** [wx.getChatToolInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/chattool/wx.getChatToolInfo.html)
+*
+* 需要基础库: `3.7.8`
+*
+* 在插件中使用:不支持
+*
+* 获取聊天工具模式下的群聊信息。
+*
+* 需要注意的是,单聊群和多聊群下返回的群唯一标识是不同的。
+* 1. 多聊群下返回 opengid
+* 2. 单聊群下返回 open_single_roomid
+*
+* 同时将返回用户在群(含单聊)下的唯一标识 group_openid。
+*
+* **示例代码**
+*
+* ```js
+wx.getChatToolInfo({
+ success(res) {
+ // res
+ {
+ errMsg: 'getChatToolInfo:ok',
+ encryptedData: '',
+ iv: ''
+ }
+ },
+ fail() {
+
+ }
+})
+```
+*
+* 敏感数据有两种获取方式,一是使用 [加密数据解密算法](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#加密数据解密算法) 。
+* 获取得到的开放数据为以下 json 结构(其中 opengid 为当前群的唯一标识):
+*
+* ```json
+{
+ "opengid": "OPENGID", // 多聊群下返回的群唯一标识
+ "open_single_roomid": "", // 单聊群下返回的群唯一标识
+ "group_openid": "", // 用户在当前群的唯一标识
+ "chat_type": 3, // 聊天室类型
+}
+``` */
+ getChatToolInfo<
+ T extends GetChatToolInfoOption = GetChatToolInfoOption
+ >(
+ option: T
+ ): PromisifySuccessResult
/** [wx.getClipboardData(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/clipboard/wx.getClipboardData.html)
*
+* 需要基础库: `1.1.0`
+*
+* 在插件中使用:需要基础库 `1.9.6`
+*
* 获取系统剪贴板的内容
*
* **示例代码**
*
-*
* ```js
wx.getClipboardData({
success (res){
console.log(res.data)
}
})
-```
-*
-* 最低基础库: `1.1.0` */
+``` */
getClipboardData<
T extends GetClipboardDataOption = GetClipboardDataOption
>(
option?: T
): PromisifySuccessResult
- /** [wx.getConnectedBluetoothDevices(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.getConnectedBluetoothDevices.html)
+ /** [wx.getCommonConfig(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/data-analysis/wx.getCommonConfig.html)
*
-* 根据 uuid 获取处于已连接状态的设备。
+* 需要基础库: `2.33.0`
+*
+* 在插件中使用:不支持
+*
+* 给定实验参数数组,获取对应的实验参数值。
*
* **示例代码**
*
+* ```js
+ wx.getCommonConfig({
+ keys:["key1", "key2"],
+ mode: 0,
+ success: (res)=>{
+ console.log("success")
+ console.log(res)
+ },
+ fail: (res)=>{
+ console.log("fail")
+ console.log(res)
+ }})
+``` */
+ getCommonConfig(option: GetCommonConfigOption): void
+ /** [wx.getConnectedBluetoothDevices(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.getConnectedBluetoothDevices.html)
+*
+* 需要基础库: `1.1.0`
+*
+* 在插件中使用:需要基础库 `1.9.6`
+*
+* 根据主服务 UUID 获取已连接的蓝牙设备。
+*
+* **示例代码**
*
* [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
* ```js
wx.getConnectedBluetoothDevices({
+ services: ['FEE7'],
success (res) {
console.log(res)
}
})
-```
-*
-* 最低基础库: `1.1.0` */
+``` */
getConnectedBluetoothDevices<
T extends GetConnectedBluetoothDevicesOption = GetConnectedBluetoothDevicesOption
>(
@@ -13133,21 +24624,66 @@ wx.getConnectedBluetoothDevices({
): PromisifySuccessResult
/** [wx.getConnectedWifi(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.getConnectedWifi.html)
*
- * 获取已连接中的 Wi-Fi 信息。
+ * 需要基础库: `1.6.0`
*
- * 最低基础库: `1.6.0` */
+ * 在插件中使用:需要基础库 `2.9.1`
+ *
+ * 获取已连接中的 Wi-Fi 信息。 */
getConnectedWifi<
T extends GetConnectedWifiOption = GetConnectedWifiOption
>(
- option?: T
+ option: T
): PromisifySuccessResult
+ /** [wx.getDeviceBenchmarkInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getDeviceBenchmarkInfo.html)
+*
+* 需要基础库: `3.4.5`
+*
+* 在插件中使用:不支持
+*
+* 获取设备性能得分和机型档位数据
+*
+* **示例代码**
+*
+* ```js
+wx.getDeviceBenchmarkInfo({
+ success (res) {
+ console.log(res.benchmarkLevel)
+ console.log(res.modelLevel)
+ }
+})
+``` */
+ getDeviceBenchmarkInfo(option?: GetDeviceBenchmarkInfoOption): void
+ /** [wx.getDeviceVoIPList(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/device-voip/wx.getDeviceVoIPList.html)
+*
+* 需要基础库: `2.30.3`
+*
+* 在插件中使用:不支持
+*
+* 查询当前用户授权的音视频通话设备(组)信息
+*
+* **示例代码**
+*
+* ```js
+wx.getDeviceVoIPList({
+ success(res) {
+ console.log(res)
+ },
+ fail(res) {
+ console.log(res)
+ }
+})
+``` */
+ getDeviceVoIPList(option?: GetDeviceVoIPListOption): void
/** [wx.getExtConfig(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ext/wx.getExtConfig.html)
*
+* 需要基础库: `1.1.0`
+*
+* 在插件中使用:不支持
+*
* 获取[第三方平台](https://developers.weixin.qq.com/miniprogram/dev/devtools/ext.html)自定义的数据字段。
*
* **Tips**
*
-*
* 1. 本接口暂时无法通过 [wx.canIUse](https://developers.weixin.qq.com/miniprogram/dev/api/base/wx.canIUse.html) 判断是否兼容,开发者需要自行判断 [wx.getExtConfig](https://developers.weixin.qq.com/miniprogram/dev/api/ext/wx.getExtConfig.html) 是否存在来兼容
*
* ****
@@ -13160,39 +24696,48 @@ if (wx.getExtConfig) {
}
})
}
-```
-*
-* 最低基础库: `1.1.0` */
+``` */
getExtConfig(
option?: T
): PromisifySuccessResult
- /** [wx.getFileInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/wx.getFileInfo.html)
+ /** [wx.getFuzzyLocation(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.getFuzzyLocation.html)
*
-* 获取文件信息
+* 需要基础库: `2.25.0`
+*
+* 在插件中使用:支持
+*
+* 获取当前的模糊地理位置。
+* ## 使用方法
+* 自 2022 年 7 月 14 日后发布的小程序,若使用该接口,需要在 app.json 中进行声明,否则将无法正常使用该接口,2022年7月14日前发布的小程序不受影响。[具体规则见公告](https://developers.weixin.qq.com/community/develop/doc/000a02f2c5026891650e7f40351c01)
+* ## 申请开通
+* 暂只针对具备与地理位置强相关的使用场景的小程序开放,在小程序管理后台,「开发」-「开发管理」-「接口设置」中自助开通该接口权限。 从2022年7月14日开始在代码审核环节将检测该接口是否已完成开通,如未开通,将在代码提审环节进行拦截。
*
* **示例代码**
*
-*
-* ```js
-wx.getFileInfo({
+* ```js
+ wx.getFuzzyLocation({
+ type: 'wgs84',
success (res) {
- console.log(res.size)
- console.log(res.digest)
+ const latitude = res.latitude
+ const longitude = res.longitude
}
})
-```
-*
-* 最低基础库: `1.4.0` */
- getFileInfo(
- option: T
- ): PromisifySuccessResult
+ ``` */
+ getFuzzyLocation(option: GetFuzzyLocationOption): void
/** [wx.getGroupEnterInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/group/wx.getGroupEnterInfo.html)
*
-* 获取群工具小程序启动信息
+* 需要基础库: `2.10.4`
+*
+* 在插件中使用:不支持
+*
+* 获取微信群聊场景下的小程序启动信息。群聊场景包括群聊小程序消息卡片、群待办、群工具。可用于获取当前群的 opengid。
+* ## 注意事项
+* - 基础库 v2.10.4 开始支持获取群工具小程序启动信息
+* - 基础库 v2.17.3 开始支持获取群聊小程序消息卡片、群待办小程序启动信息
+* - 基础库 v3.7.8 支持获取单聊群启动信息,获取的群(含单聊)唯一标识,可用于[聊天工具模式](https://developers.weixin.qq.com/miniprogram/dev/api/chattool/wx.openChatTool.html)。
*
* **示例代码**
*
-*
* ```js
wx.getGroupEnterInfo({
success(res) {
@@ -13209,49 +24754,51 @@ wx.getGroupEnterInfo({
})
```
*
-* 敏感数据有两种获取方式,一是使用 [加密数据解密算法]((open-ability/signature#加密数据解密算法)) 。
+* 敏感数据有两种获取方式,一是使用 [加密数据解密算法](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#加密数据解密算法) 。
* 获取得到的开放数据为以下 json 结构(其中 opengid 为当前群的唯一标识):
*
* ```json
{
- "opengid": "OPENGID"
+ "opengid": "OPENGID", // 多聊群下返回的群唯一标识
+ "open_single_roomid": "", // 单聊群下返回的群唯一标识
+ "group_openid": "", // 用户在当前群的唯一标识
+ "chat_type": 3, // 聊天室类型
}
```
*
* **Tips**
*
-*
* - 如需要展示群名称,小程序可以使用[开放数据组件](https://developers.weixin.qq.com/miniprogram/dev/component/open-data.html)
-* - 小游戏可以通过 `wx.getGroupInfo` 接口获取群名称
-*
-* 最低基础库: `2.10.4` */
+* - 小游戏可以通过 `wx.getGroupInfo` 接口获取群名称 */
getGroupEnterInfo(option: GetGroupEnterInfoOption): void
- /** [wx.getHCEState(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/wx.getHCEState.html)
+ /** [wx.getHCEState(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc-hce/wx.getHCEState.html)
+*
+* 需要基础库: `1.7.0`
+*
+* 在插件中使用:需要基础库 `2.1.0`
*
* 判断当前设备是否支持 HCE 能力。
*
* **示例代码**
*
-*
* ```js
wx.getHCEState({
success (res) {
console.log(res.errCode)
}
})
-```
-*
-* 最低基础库: `1.7.0` */
+``` */
getHCEState(
option?: T
): PromisifySuccessResult
/** [wx.getImageInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.getImageInfo.html)
*
+* 在插件中使用:需要基础库 `1.9.6`
+*
* 获取图片信息。网络图片需先配置download域名才能生效。
*
* **示例代码**
*
-*
* [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/Kd47Sbmr6yYu)
*
* ```js
@@ -13278,12 +24825,92 @@ wx.chooseImage({
getImageInfo(
option: T
): PromisifySuccessResult
- /** [wx.getLocation(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.getLocation.html)
+ /** [wx.getInferenceEnvInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/inference/wx.getInferenceEnvInfo.html)
*
-* 获取当前的地理位置、速度。当用户离开小程序后,此接口无法调用。开启高精度定位,接口耗时会增加,可指定 highAccuracyExpireTime 作为超时时间。地图相关使用的坐标格式应为 gcj02。
+* 需要基础库: `2.30.1`
+*
+* 在插件中使用:需要基础库 `2.30.1`
+*
+* 获取通用AI推理引擎版本。使用前可参考[AI指南文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/inference/tutorial.html)
*
* **示例代码**
*
+* ```js
+// 获取通用AI推理引擎版本
+wx.getInferenceEnvInfo({
+ complete: (res) => {
+ console.log(res.ver)
+ console.log(res.errMsg)
+ },
+})
+``` */
+ getInferenceEnvInfo(option?: GetInferenceEnvInfoOption): void
+ /** [wx.getLocalIPAddress(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/network/wx.getLocalIPAddress.html)
+*
+* 需要基础库: `2.20.1`
+*
+* 在插件中使用:需要基础库 `2.21.3`
+*
+* 获取局域网IP地址
+*
+* **示例代码**
+*
+* ```js
+wx.getLocalIPAddress({
+ success (res) {
+ const localip = res.localip
+ }
+})
+``` */
+ getLocalIPAddress(option: GetLocalIPAddressOption): void
+ /** [wx.getLocation(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.getLocation.html)
+*
+* 在插件中使用:需要基础库 `1.9.6`
+*
+* 获取当前的地理位置、速度。当用户离开小程序后,此接口无法调用。开启高精度定位,接口耗时会增加,可指定 highAccuracyExpireTime 作为超时时间。地图相关使用的坐标格式应为 gcj02。
+* 高频率调用会导致耗电,如有需要可使用持续定位接口 `wx.onLocationChange`。
+* 基础库 `2.17.0` 版本起 `wx.getLocation` 增加调用频率限制,[相关公告](https://developers.weixin.qq.com/community/develop/doc/000aee91a98d206bc6dbe722b51801)。
+*
+* ## 使用方法
+* 自 2022 年 7 月 14 日后发布的小程序,若使用该接口,需要在 app.json 中进行声明,否则将无法正常使用该接口,2022年7月14日前发布的小程序不受影响。[具体规则见公告](https://developers.weixin.qq.com/community/develop/doc/000a02f2c5026891650e7f40351c01)
+*
+* ## 申请开通
+* 暂只针对如下类目的小程序开放,需要先通过类目审核,再在小程序管理后台,「开发」-「开发管理」-「接口设置」中自助开通该接口权限。
+* 接口权限申请入口将于2022年3月11日开始内测,于3月31日全量上线。并从4月18日开始,在代码审核环节将检测该接口是否已完成开通,如未开通,将在代码提审环节进行拦截。
+*
+* ### 国内主体开放类目
+*
+* | 一级类目/主体类型 | 二级类目 | 应用场景 |
+* | -------------- | -------| -------- |
+* | 电商平台 | / | 售卖商品线下发货、线下收货服务 |
+* | 商家自营 | / | 提供售卖商品线下发货、线下收货服务、线下商超导览、导航服务 |
+* | 医疗服务 | 公立医疗机构、三级私立医疗机构、其他私立医疗机构、就医服务、其他医学健康服务、药品(非处方药)销售、非处方药销售平台、医疗器械生产企业、医疗器械自营、医疗器械经营销售平台、互联网医院血液、干细胞服务、临床试验 | 1、实际物品/药品接收服务 2、基于地理位置取号并现场报到、附近医院导航等服务 |
+* | 交通服务 | / | 代驾服务、租车网点导航等相关服务 |
+* | 生活服务 | / | 上门服务作业等线下场景 |
+* | 物流服务 | 收件/派件、查件、邮政、装卸搬运、快递柜、货物运输 | 快递/货物收发服务 |
+* | 餐饮服务 | 点餐平台、外卖平台、餐饮服务场所/餐饮服务管理企业 | 线下送餐服务 |
+* | 工具 | 天气、信息查询、办公、设备管理 | 与地理位置相关的服务,比如潮汐查询、海拔查询、天气查询、智能穿戴、智能门禁、与地理位置相关的打卡服务等 |
+* | 金融 | 银行、非金融机构自营小额贷款/融资担保/商业保理、保险 | 提供线下网点预约、基于地理位置取号并现场报到、附近网点导航等服务 |
+* | 旅游 | 景区服务、住宿服务 | 提供景区导航、导览服务、酒店导航服务 |
+* | 汽车服务 | 维修保养、汽车用品、汽车经销商/4S店、汽车厂商、汽车预售、二手车 | 提供汽车售卖、维保洗美服务、查找附近的维修点/洗车网点等导航服务 |
+* | IT科技 | 基础电信运营商、电信业务代理商 | 提供运营商线下网点的预约、基于地理位置取号并现场报到、网点导航等服务 |
+* | 房地产服务 | 物业管理、房屋中介、房屋装修 | 提供房地产开发商及物业公司门店导览导航服务 |
+* | 政务民生 | / | 提供政务单位相关业务 |
+* | 政府主体账号 | / | 提供政务单位相关业务 |
+*
+* ### 海外主体开放类目
+*
+* | 一级类目/主体类型 | 二级类目 | 应用场景 |
+* | -------------- | -------| -------- |
+* | 出行与交通 | / | 代驾服务、租车网点导航等相关服务 |
+* | 快递业与邮政 | / | 快递/货物收发服务 |
+* | 餐饮 | 外卖点餐 | 线下送餐服务 |
+* | 出行与交通 | / | 代驾服务、租车网点导航等相关服务 |
+* | 跨境电商 | / | 提供售卖商品线下发货、收货服务、线下商超导览、导航服务 |
+* | 本地服务 | 电商平台、服装/鞋/箱包、玩具、家电/数码/手机、美妆/洗护、珠宝/饰品/眼镜/钟表、运动/户外/乐器、鲜花/园艺/工艺品、家居/家饰/家纺、办公/文具、机械/电子器件、酒、食品、百货、超市/便利店、宠物食品/用品 | 提供售卖商品线下发货、线下收货服务、线下商超导览、导航服务 |
+* | 生活服务 | 家政、外送 | 上门服务作业等线下场景 |
+*
+* **示例代码**
*
* ```js
wx.getLocation({
@@ -13299,7 +24926,7 @@ wx.chooseImage({
*
* **注意**
*
-*
+* - `2.17.0 起 `wx.getLocation` 增加调用频率限制,[相关公告](https://developers.weixin.qq.com/community/develop/doc/000aee91a98d206bc6dbe722b51801)
* - 工具中定位模拟使用IP定位,可能会有一定误差。且工具目前仅支持 gcj02 坐标。
* - 使用第三方服务进行逆地址解析时,请确认第三方服务默认的坐标系,正确进行坐标转换。 */
getLocation(
@@ -13307,28 +24934,105 @@ wx.chooseImage({
): PromisifySuccessResult
/** [wx.getNetworkType(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/network/wx.getNetworkType.html)
*
+* 在插件中使用:需要基础库 `1.9.6`
+*
* 获取网络类型
*
* **示例代码**
*
-*
* ```js
wx.getNetworkType({
success (res) {
const networkType = res.networkType
+ const weakNet = res.weakNet
}
})
``` */
getNetworkType(
option?: T
): PromisifySuccessResult
+ /** [wx.getPrivacySetting(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/privacy/wx.getPrivacySetting.html)
+*
+* 需要基础库: `2.32.3`
+*
+* 在插件中使用:不支持
+*
+* 查询隐私授权情况。隐私合规开发指南详情可见[《小程序隐私协议开发指南》](https://developers.weixin.qq.com/miniprogram/dev/framework/user-privacy/PrivacyAuthorize.html)
+*
+* ****
+*
+* ## 具体说明:
+*
+* 1. 一定要调用 wx.getPrivacySetting 接口吗?
+*
+* - 不是,wx.getPrivacySetting 只是一个辅助接口,可以根据实际情况选择使用。
+*
+* **示例代码**
+*
+* ```html
+* // page.wxml
+*
+* 隐私弹窗内容....
+* 同意
+*
+* ```
+* ```js
+Page({
+ data: {
+ showPrivacy: false
+ },
+ onLoad() {
+ wx.getPrivacySetting({
+ success: res => {
+ console.log(res) // 返回结果为: res = { needAuthorization: true/false, privacyContractName: '《xxx隐私保护指引》' }
+ if (res.needAuthorization) {
+ // 需要弹出隐私协议
+ this.setData({
+ showPrivacy: true
+ })
+ } else {
+ // 用户已经同意过隐私协议,所以不需要再弹出隐私协议,也能调用隐私接口
+ }
+ },
+ fail: () => {},
+ complete: () => {}
+ })
+ },
+ handleAgreePrivacyAuthorization() {
+ // 用户同意隐私协议事件回调
+ // 用户点击了同意,之后所有隐私接口和组件都可以调用了
+ // wx.getUserProfile()
+ // wx.chooseMedia()
+ // wx.getClipboardData()
+ // wx.startRecord()
+ }
+})
+```
+*
+* **完整示例demo**
+*
+* demo1: 演示使用 `wx.getPrivacySetting` 和 `` 在首页处理隐私弹窗逻辑
+* [https://developers.weixin.qq.com/s/gi71sGm67hK0](https://developers.weixin.qq.com/s/gi71sGm67hK0)
+*
+* demo2: 演示使用 `wx.onNeedPrivacyAuthorization` 和 `` 在多个页面处理隐私弹窗逻辑,同时演示了如何处理多个隐私接口同时调用。
+* [https://developers.weixin.qq.com/s/hndZUOmA7gKn](https://developers.weixin.qq.com/s/hndZUOmA7gKn)
+*
+* demo3: 演示 `wx.onNeedPrivacyAuthorization`、`wx.requirePrivacyAuthorize`、`` 和 ` ` 组件如何结合使用
+* [https://developers.weixin.qq.com/s/jX7xWGmA7UKa](https://developers.weixin.qq.com/s/jX7xWGmA7UKa)
+*
+* demo4: 演示使用 `wx.onNeedPrivacyAuthorization` 和 `` 在多个 tabBar 页面处理隐私弹窗逻辑。
+* [https://developers.weixin.qq.com/s/g6BWZGmt7XK9](https://developers.weixin.qq.com/s/g6BWZGmt7XK9) */
+ getPrivacySetting(option: GetPrivacySettingOption): void
/** [wx.getRandomValues(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/crypto/wx.getRandomValues.html)
*
+* 需要基础库: `2.15.0`
+*
+* 在插件中使用:不支持
+*
* 获取密码学安全随机数
*
* **示例代码**
*
-*
* ```js
wx.getRandomValues({
length: 6 // 生成 6 个字节长度的随机数,
@@ -13336,83 +25040,71 @@ wx.getRandomValues({
console.log(wx.arrayBufferToBase64(res.randomValues)) // 转换为 base64 字符串后打印
}
})
-```
-*
-* 最低基础库: `2.15.0` */
+``` */
getRandomValues<
T extends GetRandomValuesOption = GetRandomValuesOption
>(
option: T
): PromisifySuccessResult
- /** [wx.getSavedFileInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/wx.getSavedFileInfo.html)
-*
-* 获取本地文件的文件信息。此接口只能用于获取已保存到本地的文件,若需要获取临时文件信息,请使用 [wx.getFileInfo()](https://developers.weixin.qq.com/miniprogram/dev/api/file/wx.getFileInfo.html) 接口。
-*
-* **示例代码**
-*
-*
-* ```js
-wx.getSavedFileList({
- success (res) {
- console.log(res.fileList)
- }
-})
-``` */
- getSavedFileInfo<
- T extends GetSavedFileInfoOption = GetSavedFileInfoOption
- >(
- option: T
- ): PromisifySuccessResult
- /** [wx.getSavedFileList(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/wx.getSavedFileList.html)
-*
-* 获取该小程序下已保存的本地缓存文件列表
-*
-* **示例代码**
-*
-*
-* ```js
-wx.getSavedFileList({
- success (res) {
- console.log(res.fileList)
- }
-})
-``` */
- getSavedFileList<
- T extends WxGetSavedFileListOption = WxGetSavedFileListOption
- >(
- option?: T
- ): PromisifySuccessResult
/** [wx.getScreenBrightness(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.getScreenBrightness.html)
+ *
+ * 需要基础库: `1.2.0`
+ *
+ * 在插件中使用:需要基础库 `1.9.6`
*
* 获取屏幕亮度
*
* **说明**
*
- *
- * - 若安卓系统设置中开启了自动调节亮度功能,则屏幕亮度会根据光线自动调整,该接口仅能获取自动调节亮度之前的值,而非实时的亮度值。
- *
- * 最低基础库: `1.2.0` */
+ * - 若安卓系统设置中开启了自动调节亮度功能,则屏幕亮度会根据光线自动调整,该接口仅能获取自动调节亮度之前的值,而非实时的亮度值。 */
getScreenBrightness<
T extends GetScreenBrightnessOption = GetScreenBrightnessOption
>(
option?: T
): PromisifySuccessResult
- /** [wx.getSelectedTextRange(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/keyboard/wx.getSelectedTextRange.html)
+ /** [wx.getScreenRecordingState(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.getScreenRecordingState.html)
+*
+* 需要基础库: `2.24.0`
+*
+* 在插件中使用:不支持
+*
+* 查询用户是否在录屏。
+*
+* **示例代码**
+*
+* ```js
+wx.getScreenRecordingState({
+ success: function (res) {
+ console.log(res.state)
+ },
+})
+``` */
+ getScreenRecordingState(option?: GetScreenRecordingStateOption): void
+ /** [wx.getSecureElementPasses(Object args)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/wx.getSecureElementPasses.html)
+ *
+ * 需要基础库: `3.8.5`
+ *
+ * 在插件中使用:不支持
+ *
+ * 获取设备中的所有卡信息 */
+ getSecureElementPasses(args: GetSecureElementPassesOption): void
+ /** [wx.getSelectedTextRange(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/keyboard/wx.getSelectedTextRange.html)
+*
+* 需要基础库: `2.7.0`
+*
+* 在插件中使用:不支持
*
* 在input、textarea等focus之后,获取输入框的光标位置。注意:只有在focus的时候调用此接口才有效。
*
* **示例代码**
*
-*
* ```js
wx.getSelectedTextRange({
complete: res => {
console.log('getSelectedTextRange res', res.start, res.end)
}
})
-```
-*
-* 最低基础库: `2.7.0` */
+``` */
getSelectedTextRange<
T extends GetSelectedTextRangeOption = GetSelectedTextRangeOption
>(
@@ -13420,11 +25112,19 @@ wx.getSelectedTextRange({
): PromisifySuccessResult
/** [wx.getSetting(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/setting/wx.getSetting.html)
*
+* 需要基础库: `1.2.0`
+*
+* 在插件中使用:需要基础库 `2.6.3`
+*
+* 在插件中使用时,接口有以下不同:
+* - `withSubscriptions` 无效(插件暂无订阅消息)
+* - 返回值中的 `authSetting` 字段中是插件的权限(如用户信息功能页授权)
+* - [2.14.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起返回值中有 `miniprogramAuthSetting` 字段,内容等于当前小程序 `getSetting` 的结果(不含订阅状态)
+*
* 获取用户的当前设置。**返回值中只会出现小程序已经向用户请求过的[权限](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html)**。
*
* **示例代码**
*
-*
* ```js
wx.getSetting({
success (res) {
@@ -13458,20 +25158,24 @@ wx.getSetting({
// }
}
})
-```
-*
-* 最低基础库: `1.2.0` */
+``` */
getSetting(
option?: T
): PromisifySuccessResult
/** [wx.getShareInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.getShareInfo.html)
*
-* 获取转发详细信息
+* 需要基础库: `1.1.0`
+*
+* 在插件中使用:需要基础库 `2.1.0`
+*
+* 在插件中使用时,只能在当前插件的页面中调用
+* @deprecated 基础库版本 [2.17.3](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [wx.getGroupEnterInfo](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/group/wx.getGroupEnterInfo.html) 替换
+*
+* 获取转发详细信息(主要是获取群ID)。 从群聊内的小程序消息卡片打开小程序时,调用此接口才有效。从基础库 v2.17.3 开始,推荐用 [wx.getGroupEnterInfo](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/group/wx.getGroupEnterInfo.html) 替代此接口。
*
* **示例代码**
*
-*
-* 敏感数据有两种获取方式,一是使用 [加密数据解密算法]((open-ability/signature#加密数据解密算法)) 。
+* 敏感数据获取方式 [加密数据解密算法](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#加密数据解密算法) 。
* 获取得到的开放数据为以下 json 结构(其中 openGId 为当前群的唯一标识):
*
* ```json
@@ -13482,20 +25186,45 @@ wx.getSetting({
*
* **Tips**
*
-*
-* - 如需要展示群名称,小程序可以使用[开放数据组件](https://developers.weixin.qq.com/miniprogram/dev/component/open-data.html)
-* - 小游戏可以通过 `wx.getGroupInfo` 接口获取群名称
-*
-* 最低基础库: `1.1.0` */
+* - 如需要展示群名称,小程序可以使用 [开放数据组件](https://developers.weixin.qq.com/miniprogram/dev/component/open-data.html)
+* - 小游戏可以通过 [`wx.getGroupInfo`](#) 接口获取群名称 */
getShareInfo(
option: T
): PromisifySuccessResult
- /** [wx.getStorage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.getStorage.html)
+ /** [wx.getShowSplashAdStatus(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/wx.getShowSplashAdStatus.html)
*
-* 从本地缓存中异步获取指定 key 的内容。缓存相关策略请查看 [存储](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/storage.html)。
+* 需要基础库: `3.7.8`
+*
+* 在插件中使用:不支持
+*
+* 获取封面广告组件展示状态。请通过 [wx.getSystemInfoSync()](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getSystemInfoSync.html) 返回对象的 SDKVersion 判断基础库版本号后再使用该 API(小游戏端要求 >= 3.7.8, 小程序端要求 >= 3.7.8)。
*
* **示例代码**
*
+* ```js
+// 获取封面广告展示状态
+wx.getShowSplashAdStatus({
+ success: res => {
+ console.log('getShowSplashAdStatus res', res.status, res.code)
+ },
+})
+``` */
+ getShowSplashAdStatus(option?: GetShowSplashAdStatusOption): void
+ /** [wx.getSkylineInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getSkylineInfo.html)
+ *
+ * 需要基础库: `2.26.2`
+ *
+ * 在插件中使用:需要基础库 `2.26.2`
+ *
+ * 获取当前运行环境对于 [Skyline 渲染引擎](https://developers.weixin.qq.com/miniprogram/dev/framework/runtime/skyline/introduction.html) 的支持情况 */
+ getSkylineInfo(option?: GetSkylineInfoOption): void
+ /** [wx.getStorage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.getStorage.html)
+*
+* 在插件中使用:需要基础库 `1.9.6`
+*
+* 从本地缓存中异步获取指定 key 的内容。
+*
+* **示例代码**
*
* ```js
wx.getStorage({
@@ -13507,14 +25236,21 @@ wx.getStorage({
```
*
* ```js
-try {
- var value = wx.getStorageSync('key')
- if (value) {
- // Do something with return value
+// 开启加密存储
+wx.setStorage({
+ key: "key",
+ data: "value",
+ encrypt: true, // 若开启加密存储,setStorage 和 getStorage 需要同时声明 encrypt 的值为 true
+ success() {
+ wx.getStorage({
+ key: "key",
+ encrypt: true, // 若开启加密存储,setStorage 和 getStorage 需要同时声明 encrypt 的值为 true
+ success(res) {
+ console.log(res.data)
+ }
+ })
}
-} catch (e) {
- // Do something when catch error
-}
+})
``` */
getStorage<
T = any,
@@ -13524,11 +25260,12 @@ try {
): PromisifySuccessResult>
/** [wx.getStorageInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.getStorageInfo.html)
*
-* 异步获取当前storage的相关信息。缓存相关策略请查看 [存储](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/storage.html)。
+* 在插件中使用:不支持
+*
+* 异步获取当前storage的相关信息。
*
* **示例代码**
*
-*
* ```js
wx.getStorageInfo({
success (res) {
@@ -13552,12 +25289,16 @@ try {
getStorageInfo(
option?: T
): PromisifySuccessResult
- /** [wx.getSystemInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/system-info/wx.getSystemInfo.html)
+ /** [wx.getSystemInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getSystemInfo.html)
*
-* 获取系统信息
+* 在插件中使用:需要基础库 `1.9.6`
+* @deprecated 基础库版本 [2.20.1](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [wx.getSystemSetting](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getSystemSetting.html)、[wx.getAppAuthorizeSetting](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getAppAuthorizeSetting.html)、[wx.getDeviceInfo](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getDeviceInfo.html)、[wx.getWindowInfo](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getWindowInfo.html)、[wx.getAppBaseInfo](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getAppBaseInfo.html) 替换
+*
+* 获取系统信息。**由于历史原因,wx.getSystemInfo 是异步的调用格式,但是是同步返回,需要异步获取系统信息请使用 [wx.getSystemInfoAsync](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getSystemInfoAsync.html)。**
*
* **示例代码**
*
+* [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/WkUCgXmS7mqO)
*
* ```js
wx.getSystemInfo({
@@ -13586,16 +25327,28 @@ try {
} catch (e) {
// Do something when catch error
}
-``` */
+```
+*
+* ****
+*
+* ## 注意事项
+* - 当 wx.getSystemInfoSync() 接口发生错误时可能会返回空对象
+* - wx.getSystemInfo 接口由于会获取系统权限,可能触发授权弹窗,请使用 [wx.getSystemSetting](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getSystemSetting.html)、[wx.getAppAuthorizeSetting](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getAppAuthorizeSetting.html)、[wx.getDeviceInfo](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getDeviceInfo.html)、[wx.getWindowInfo](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getWindowInfo.html)、[wx.getAppBaseInfo](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getAppBaseInfo.html) 替代 */
getSystemInfo(
option?: T
): PromisifySuccessResult
- /** [wx.getSystemInfoAsync(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/system-info/wx.getSystemInfoAsync.html)
+ /** [wx.getSystemInfoAsync(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getSystemInfoAsync.html)
+*
+* 需要基础库: `2.14.1`
+*
+* 在插件中使用:不支持
+* @deprecated 基础库版本 [2.20.1](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [wx.getSystemSetting](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getSystemSetting.html)、[wx.getAppAuthorizeSetting](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getAppAuthorizeSetting.html)、[wx.getDeviceInfo](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getDeviceInfo.html)、[wx.getWindowInfo](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getWindowInfo.html)、[wx.getAppBaseInfo](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getAppBaseInfo.html) 替换
*
* 异步获取系统信息。需要一定的微信客户端版本支持,在不支持的客户端上,会使用同步实现来返回。
*
* **示例代码**
*
+* [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/WkUCgXmS7mqO)
*
* ```js
wx.getSystemInfoAsync({
@@ -13609,23 +25362,20 @@ wx.getSystemInfoAsync({
console.log(res.platform)
}
})
-```
-*
-* 最低基础库: `2.14.1` */
+``` */
getSystemInfoAsync(option?: GetSystemInfoAsyncOption): void
/** [wx.getUserInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/user-info/wx.getUserInfo.html)
*
+* 在插件中使用:需要基础库 `2.3.1`
+*
+* 在插件中使用时,需要在用户信息功能页中获得用户授权或满足一定条件后调用。否则将返回 fail。详见 [用户信息功能页](https://developers.weixin.qq.com/miniprogram/dev/framework/plugin/functional-pages/user-info.html)
+*
+* @warning **用户头像昵称获取规则已调整,参考 [用户信息接口调整说明](https://developers.weixin.qq.com/community/develop/doc/000cacfa20ce88df04cb468bc52801)、[小程序用户头像昵称获取规则调整公告](https://developers.weixin.qq.com/community/develop/doc/00022c683e8a80b29bed2142b56c01)**
+*
* 获取用户信息。
*
-* **接口调整说明**
-*
-*
-* 为优化用户登录体验,该接口将进行调整,详见 [用户信息接口调整说明](https://developers.weixin.qq.com/community/develop/doc/000cacfa20ce88df04cb468bc52801)
-*
* **示例代码**
*
-*
-*
* ```js
// 必须是在用户已经授权的情况下调用
wx.getUserInfo({
@@ -13641,7 +25391,9 @@ wx.getUserInfo({
})
```
*
-* 敏感数据有两种获取方式,一是使用 [加密数据解密算法]((open-ability/signature#加密数据解密算法)) 。
+* 敏感数据有两种获取方式:
+* 1. 使用 [加密数据解密算法](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#加密数据解密算法)
+* 2. 使用 [云调用直接获取开放数据](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#云调用直接获取开放数据)
* 获取得到的开放数据为以下 json 结构:
*
* ```json
@@ -13663,7 +25415,6 @@ wx.getUserInfo({
*
* **小程序用户信息组件示例代码**
*
-*
* ```html
*
*
@@ -13702,28 +25453,100 @@ Page({
option: T
): PromisifySuccessResult
/** [wx.getUserProfile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/user-info/wx.getUserProfile.html)
- *
- * 获取用户信息。每次请求都会弹出授权窗口,用户同意后返回 `userInfo`。
- *
- * 最低基础库: `2.10.4` */
+*
+* 需要基础库: `2.10.4`
+*
+* 在插件中使用:不支持
+*
+* @warning **用户头像昵称获取规则已调整,参考 [小程序用户头像昵称获取规则调整公告](https://developers.weixin.qq.com/community/develop/doc/00022c683e8a80b29bed2142b56c01)**
+*
+* 获取用户信息。页面产生点击事件(例如 `button` 上 `bindtap` 的回调中)后才可调用,每次请求都会弹出授权窗口,用户同意后返回 `userInfo`。该接口用于替换 `wx.getUserInfo`,详见 [用户信息接口调整说明](https://developers.weixin.qq.com/community/develop/doc/000cacfa20ce88df04cb468bc52801?highLine=login)。
+*
+* **示例代码**
+*
+* [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/tsJaq2mP7Mp4)
+*
+* **Bug & Tip**
+*
+* 1. `tip`:仅小程序中 `wx.getUserInfo` 接口进行调整,小游戏中不受影响;
+* 2. `tip`:开发者工具中仅 2.10.4 及以上版本可访问 `wx.getUserProfile` 接口,在真机上可参考示例代码进行判断,无需根据版本号或者 `canIUse` 进行条件。
+* 3. `tip`:`wx.getUserProfile` 返回的加密数据中不包含 `openId` 和 `unionId` 字段。
+* 4. `bug`:开发者工具中 `2.10.4`~`2.16.1` 基础库版本通过 `` 会返回真实数据,真机上此区间会按照公告返回匿名数据。
+*
+* ```html
+*
+*
+*
+* 获取头像昵称
+* 获取头像昵称
+*
+*
+*
+* {{userInfo.nickName}}
+*
+*
+*
+* ```
+*
+* ```js
+Page({
+ data: {
+ userInfo: {},
+ hasUserInfo: false,
+ canIUseGetUserProfile: false,
+ },
+ onLoad() {
+ if (wx.getUserProfile) {
+ this.setData({
+ canIUseGetUserProfile: true
+ })
+ }
+ },
+ getUserProfile(e) {
+ // 推荐使用wx.getUserProfile获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认
+ // 开发者妥善保管用户快速填写的头像昵称,避免重复弹窗
+ wx.getUserProfile({
+ desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
+ success: (res) => {
+ this.setData({
+ userInfo: res.userInfo,
+ hasUserInfo: true
+ })
+ }
+ })
+ },
+ getUserInfo(e) {
+ // 不推荐使用getUserInfo获取用户信息,预计自2021年4月13日起,getUserInfo将不再弹出弹窗,并直接返回匿名的用户个人信息
+ this.setData({
+ userInfo: e.detail.userInfo,
+ hasUserInfo: true
+ })
+ },
+})
+``` */
getUserProfile(
option: T
): PromisifySuccessResult
/** [wx.getVideoInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.getVideoInfo.html)
*
- * 获取视频详细信息。
+ * 需要基础库: `2.11.0`
*
- * 最低基础库: `2.11.0` */
+ * 在插件中使用:支持
+ *
+ * 获取视频详细信息。 */
getVideoInfo(
option: T
): PromisifySuccessResult
/** [wx.getWeRunData(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/werun/wx.getWeRunData.html)
*
-* 获取用户过去三十天微信运动步数。需要先调用 [wx.login](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/login/wx.login.html) 接口。步数信息会在用户主动进入小程序时更新。
+* 需要基础库: `1.2.0`
+*
+* 在插件中使用:不支持
+*
+* 获取用户过去三十一天微信运动步数。需要先调用 [wx.login](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/login/wx.login.html) 接口。步数信息会在用户主动进入小程序时更新。
*
* **示例代码**
*
-*
* ```js
wx.getWeRunData({
success (res) {
@@ -13737,9 +25560,7 @@ wx.getWeRunData({
*
* **开放数据 JSON 结构**
*
-*
-*
-* 敏感数据有两种获取方式,一是使用 [加密数据解密算法]((open-ability/signature#加密数据解密算法)) 。
+* 敏感数据有两种获取方式,一是使用 [加密数据解密算法](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#加密数据解密算法) 。
* 获取得到的开放数据为以下 json 结构:
*
* ```json
@@ -13762,58 +25583,71 @@ wx.getWeRunData({
* | 属性 | 类型 | 说明 |
* | --- | ---- | --- |
* | timestamp | number | 时间戳,表示数据对应的时间 |
-* | step | number | 微信运动步数 |
-*
-* 最低基础库: `1.2.0` */
+* | step | number | 微信运动步数 | */
getWeRunData(
option?: T
): PromisifySuccessResult
/** [wx.getWifiList(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.getWifiList.html)
*
- * 请求获取 Wi-Fi 列表。在 `onGetWifiList` 注册的回调中返回 `wifiList` 数据。 **Android 调用前需要 [用户授权](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html) scope.userLocation。**
+ * 需要基础库: `1.6.0`
*
- * iOS 将跳转到系统的 Wi-Fi 界面,Android 不会跳转。 iOS 11.0 及 iOS 11.1 两个版本因系统问题,该方法失效。但在 iOS 11.2 中已修复。
+ * 在插件中使用:需要基础库 `2.9.1`
*
- * 最低基础库: `1.6.0` */
+ * 请求获取 Wi-Fi 列表。`wifiList` 数据会在 [onGetWifiList](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.onGetWifiList.html) 注册的回调中返回。 **Android 调用前需要 [用户授权](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html) scope.userLocation。**
+ *
+ * iOS 上将跳转到系统设置中的微信设置页,需要用户手动进入「无线局域网」设置页,并在系统扫描到设备后,小程序才能收到 onGetWifiList 回调。Android 不会跳转。
+ *
+ * **注意**
+ *
+ * 因系统问题,本方法在 iOS 11.0 及 11.1 两个版本失效。但在 iOS 11.2 中已修复。 */
getWifiList(
option?: T
): PromisifySuccessResult
/** [wx.hideHomeButton(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/navigation-bar/wx.hideHomeButton.html)
*
- * 隐藏返回首页按钮。微信7.0.7版本起,当用户打开的小程序最底层页面是非首页时,默认展示“返回首页”按钮,开发者可在页面 onShow 中调用 hideHomeButton 进行隐藏。
+ * 需要基础库: `2.8.3`
*
- * 最低基础库: `2.8.3` */
+ * 在插件中使用:不支持
+ *
+ * 隐藏返回首页按钮。微信7.0.7版本起,当用户打开的小程序最底层页面是非首页时,默认展示“返回首页”按钮,开发者可在页面 onShow 中调用 hideHomeButton 进行隐藏。 */
hideHomeButton(
option?: T
): PromisifySuccessResult
- /** [wx.hideKeyboard(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/keyboard/wx.hideKeyboard.html)
+ /** [wx.hideKeyboard(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/keyboard/wx.hideKeyboard.html)
+*
+* 需要基础库: `2.8.2`
+*
+* 在插件中使用:需要基础库 `3.8.8`
*
* 在input、textarea等focus拉起键盘之后,手动调用此接口收起键盘
*
* **示例代码**
*
-*
* ```js
wx.hideKeyboard({
complete: res => {
console.log('hideKeyboard res', res)
}
})
-```
-*
-* 最低基础库: `2.8.2` */
+``` */
hideKeyboard(
option?: T
): PromisifySuccessResult
/** [wx.hideLoading(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.hideLoading.html)
*
- * 隐藏 loading 提示框
+ * 需要基础库: `1.1.0`
*
- * 最低基础库: `1.1.0` */
+ * 在插件中使用:需要基础库 `1.9.6`
+ *
+ * 隐藏 loading 提示框 */
hideLoading(
option?: T
): PromisifySuccessResult
/** [wx.hideNavigationBarLoading(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/navigation-bar/wx.hideNavigationBarLoading.html)
+ *
+ * 在插件中使用:需要基础库 `2.1.0`
+ *
+ * 在插件中使用时,只能在当前插件的页面中调用
*
* 在当前页面隐藏导航条加载动画 */
hideNavigationBarLoading<
@@ -13823,6 +25657,12 @@ wx.hideKeyboard({
): PromisifySuccessResult
/** [wx.hideShareMenu(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.hideShareMenu.html)
*
+* 需要基础库: `1.1.0`
+*
+* 在插件中使用:需要基础库 `2.1.0`
+*
+* 在插件中使用时,只能在当前插件的页面中调用
+*
* 隐藏当前页面的转发按钮
*
* ****
@@ -13833,91 +25673,158 @@ wx.hideKeyboard({
*
* **示例代码**
*
-*
* ```js
wx.hideShareMenu({
menus: ['shareAppMessage', 'shareTimeline']
})
-```
-*
-* 最低基础库: `1.1.0` */
+``` */
hideShareMenu(
option?: T
): PromisifySuccessResult
/** [wx.hideTabBar(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.hideTabBar.html)
*
- * 隐藏 tabBar
+ * 需要基础库: `1.9.0`
*
- * 最低基础库: `1.9.0` */
+ * 在插件中使用:不支持
+ *
+ * 隐藏 tabBar */
hideTabBar(
option: T
): PromisifySuccessResult
/** [wx.hideTabBarRedDot(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.hideTabBarRedDot.html)
*
- * 隐藏 tabBar 某一项的右上角的红点
+ * 需要基础库: `1.9.0`
*
- * 最低基础库: `1.9.0` */
+ * 在插件中使用:不支持
+ *
+ * 隐藏 tabBar 某一项的右上角的红点 */
hideTabBarRedDot<
T extends HideTabBarRedDotOption = HideTabBarRedDotOption
>(
option: T
): PromisifySuccessResult
/** [wx.hideToast(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.hideToast.html)
+ *
+ * 在插件中使用:需要基础库 `1.9.6`
*
* 隐藏消息提示框 */
hideToast(
option?: T
): PromisifySuccessResult
+ /** [wx.initFaceDetect(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/face/wx.initFaceDetect.html)
+ *
+ * 需要基础库: `2.18.0`
+ *
+ * 在插件中使用:需要基础库 `2.21.3`
+ *
+ * @warning **该接口已停止维护,推荐使用 [wx.createVKSession](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/wx.createVKSession.html) 代替**
+ *
+ * 初始化人脸检测。本接口不再维护,请使用 [wx.createVKSession](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/wx.createVKSession.html) 接口代替。详情参考[人脸检测指南文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/visionkit/face.html)
+ *
+ * ****
+ *
+ * ### 特别说明
+ * 若小程序人脸识别功能涉及采集、存储用户生物特征(如人脸照片或视频、身份证和手持身份证、身份证照和免冠照等),此类型服务需使用[微信原生人脸识别接口](https://developers.weixin.qq.com/community/develop/doc/000442d352c1202bd498ecb105c00d?highline=%E4%BA%BA%E8%84%B8%E6%A0%B8%E8%BA%AB)。 */
+ initFaceDetect(option?: InitFaceDetectOption): void
+ /** [wx.isBluetoothDevicePaired(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.isBluetoothDevicePaired.html)
+ *
+ * 需要基础库: `2.20.1`
+ *
+ * 在插件中使用:需要基础库 `2.19.1`
+ *
+ * 查询蓝牙设备是否配对,仅安卓支持。 */
+ isBluetoothDevicePaired<
+ T extends IsBluetoothDevicePairedOption = IsBluetoothDevicePairedOption
+ >(
+ option: T
+ ): PromisifySuccessResult
+ /** [wx.join1v1Chat(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.join1v1Chat.html)
+ *
+ * 需要基础库: `2.20.1`
+ *
+ * 在插件中使用:不支持
+ *
+ * 加入(创建)双人通话。 */
+ join1v1Chat(option: Join1v1ChatOption): void
/** [wx.joinVoIPChat(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.joinVoIPChat.html)
*
- * 加入 (创建) 实时语音通话,更多信息可见 [实时语音指南](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/voip-chat.html)。调用前需要用户授权 `scope.record`,若房间类型为视频房间需要用户授权 `scope.camera`。
+ * 需要基础库: `2.7.0`
*
- * 最低基础库: `2.7.0` */
+ * 在插件中使用:需要基础库 `2.9.0`
+ *
+ * 加入 (创建) 实时语音通话,更多信息可见 [实时语音指南](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/voip-chat.html)。调用前需要用户授权 `scope.record`,若房间类型为视频房间需要用户授权 `scope.camera`。 */
joinVoIPChat(
option: T
): PromisifySuccessResult
- /** [wx.loadFontFace(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/font/wx.loadFontFace.html)
+ /** [wx.loadBuiltInFontFace(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/font/wx.loadBuiltInFontFace.html)
*
-* 动态加载网络字体,文件地址需为下载类型。[2.10.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)起支持全局生效,需在 `app.js` 中调用。
+* 需要基础库: `3.7.9`
*
-* 注意:
-* 1. 字体文件返回的 contet-type 参考 [font](https://www.iana.org/assignments/media-types/media-types.xhtml#font),格式不正确时会解析失败。
-* 2. 字体链接必须是https(ios不支持http)
-* 3. 字体链接必须是同源下的,或开启了cors支持,小程序的域名是`servicewechat.com`
-* 4. canvas等原生组件不支持使用接口添加的字体
-* 5. 工具里提示 Faild to load font可以忽略
-* 6. [2.10.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 以前仅在调用页面生效。
+* 在插件中使用:需要基础库 `3.7.9`
+*
+* 加载内置字体。
*
* **示例代码**
*
+* [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/i4rduVmM7JWZ)
+* ```js
+wx.loadBuiltInFontFace({
+ family: 'WeChatSansSS',
+ source: 'WeChatSansSS',
+ success: console.log
+})
+``` */
+ loadBuiltInFontFace(option: LoadBuiltInFontFaceOption): void
+ /** [wx.loadFontFace(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/font/wx.loadFontFace.html)
+*
+* 需要基础库: `2.1.0`
+*
+* 在插件中使用:需要基础库 `2.15.0`
+*
+* 动态加载网络字体。
+*
+* **示例代码**
*
* [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/b6Zrajm67R2x)
* ```js
wx.loadFontFace({
family: 'Bitstream Vera Serif Bold',
- source: 'url("https://sungd.github.io/Pacifico.ttf")',
+ source: 'url("https://res.wx.qq.com/t/wx_fed/base/weixin_portal/res/static/font/33uDySX.ttf")',
success: console.log
})
```
*
-* 最低基础库: `2.1.0` */
+* **Tips**
+*
+* 1. 字体链接需要是下载类型。
+* 2. 字体文件返回的 content-type 参考 [font](https://www.iana.org/assignments/media-types/media-types.xhtml#font),格式不正确时会解析失败。
+* 3. 字体链接必须是 https(ios不支持http)。
+* 4. 建议格式为 TTF 和 WOFF,WOFF2 在低版本的iOS上会不兼容。
+* 5. 字体链接必须是同源下的,或开启了cors支持,小程序的域名是`servicewechat.com`
+* 6. 工具里提示 Faild to load font可以忽略
+* 7. [2.10.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 以前仅在调用页面生效。[2.10.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起支持全局生效,需在 `app.js` 中调用。
+* 8. [3.7.9](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 以前 scopes 默认值为 webview。[3.7.9](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起默认全选。
+* 9. [3.7.9](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 开始 source 支持传入 Data URL。 */
loadFontFace(
option: T
): PromisifySuccessResult
/** [wx.login(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/login/wx.login.html)
*
-* 调用接口获取登录凭证(code)。通过凭证进而换取用户登录态信息,包括用户的唯一标识(openid)及本次登录的会话密钥(session_key)等。用户数据的加解密通讯需要依赖会话密钥完成。更多使用方法详见 [小程序登录](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/login.html)。
+* 在插件中使用:需要基础库 `2.3.1`
+*
+* 在插件中使用时,需要在用户信息功能页中获得用户授权或满足一定条件后调用。否则将返回 fail。详见 [用户信息功能页](https://developers.weixin.qq.com/miniprogram/dev/framework/plugin/functional-pages/user-info.html)
+*
+* 调用接口获取登录凭证(code)。通过凭证进而换取用户登录态信息,包括用户在当前小程序的唯一标识(openid)、微信开放平台账号下的唯一标识(unionid,若当前小程序已绑定到微信开放平台账号)及本次登录的会话密钥(session_key)等。用户数据的加解密通讯需要依赖会话密钥完成。
*
* **示例代码**
*
-*
* ```js
wx.login({
success (res) {
if (res.code) {
//发起网络请求
wx.request({
- url: 'https://test.com/onLogin',
+ url: 'https://example.com/onLogin',
data: {
code: res.code
}
@@ -13931,11 +25838,15 @@ wx.login({
login(
option?: T
): PromisifySuccessResult
- /** [wx.makeBluetoothPair(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.makeBluetoothPair.html)
+ /** [wx.makeBluetoothPair(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.makeBluetoothPair.html)
*
- * 蓝牙配对接口,仅安卓支持。通常情况下(需要指定 `pin` 码或者密码时)系统会接管配对流程,直接使用 直接 `createBLEConnection` 即可;该接口只应当在开发者不想让用户手动输入`pin` 码且真机验证确认可以正常生效情况下用。
+ * 需要基础库: `2.12.0`
*
- * 最低基础库: `2.12.0` */
+ * 在插件中使用:需要基础库 `2.12.0`
+ *
+ * 蓝牙配对接口,仅安卓支持。
+ *
+ * 通常情况下(需要指定 `pin` 码或者密码时)系统会接管配对流程,直接调用 [wx.createBLEConnection](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.createBLEConnection.html) 即可。该接口只应当在开发者不想让用户手动输入 `pin` 码且真机验证确认可以正常生效情况下用。 */
makeBluetoothPair<
T extends MakeBluetoothPairOption = MakeBluetoothPairOption
>(
@@ -13943,11 +25854,12 @@ wx.login({
): PromisifySuccessResult
/** [wx.makePhoneCall(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/phone/wx.makePhoneCall.html)
*
+* 在插件中使用:需要基础库 `1.9.6`
+*
* 拨打电话
*
* **示例代码**
*
-*
* ```js
wx.makePhoneCall({
phoneNumber: '1340000' //仅为示例,并非真实的电话号码
@@ -13957,32 +25869,37 @@ wx.makePhoneCall({
option: T
): PromisifySuccessResult
/** [wx.navigateBack(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.navigateBack.html)
+ *
+ * 在插件中使用:需要基础库 `2.1.0`
+ *
+ * 在插件中使用时,只能在当前插件的页面中调用
*
* 关闭当前页面,返回上一页面或多级页面。可通过 [getCurrentPages](https://developers.weixin.qq.com/miniprogram/dev/reference/api/getCurrentPages.html) 获取当前的页面栈,决定需要返回几层。 */
navigateBack(
option?: T
): PromisifySuccessResult
- /** [wx.navigateBackMiniProgram(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/miniprogram-navigate/wx.navigateBackMiniProgram.html)
+ /** [wx.navigateBackMiniProgram(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/navigate/wx.navigateBackMiniProgram.html)
*
-* 返回到上一个小程序。只有在当前小程序是被其他小程序打开时可以调用成功
+* 需要基础库: `1.3.0`
+*
+* 在插件中使用:不支持
+*
+* 返回到上一个小程序。只有在当前小程序是被其他小程序打开时可以调用成功。
*
* 注意:**微信客户端 iOS 6.5.9,Android 6.5.10 及以上版本支持**
*
* **示例代码**
*
-*
* ```js
wx.navigateBackMiniProgram({
extraData: {
- foo: 'bar'
-},
-success(res) {
- // 返回成功
-}
+ foo: 'bar'
+ },
+ success(res) {
+ // 返回成功
+ }
})
-```
-*
-* 最低基础库: `1.3.0` */
+``` */
navigateBackMiniProgram<
T extends NavigateBackMiniProgramOption = NavigateBackMiniProgramOption
>(
@@ -13990,12 +25907,14 @@ success(res) {
): PromisifySuccessResult
/** [wx.navigateTo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.navigateTo.html)
*
+* 在插件中使用:需要基础库 `2.2.2`
+*
+* 在插件中使用时,只能在当前插件的页面中调用
+*
* 保留当前页面,跳转到应用内的某个页面。但是不能跳到 tabbar 页面。使用 [wx.navigateBack](https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.navigateBack.html) 可以返回到原页面。小程序中页面栈最多十层。
*
* **示例代码**
*
-*
-*
* ```js
wx.navigateTo({
url: 'test?id=1',
@@ -14034,35 +25953,32 @@ Page({
navigateTo(
option: T
): PromisifySuccessResult
- /** [wx.navigateToMiniProgram(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/miniprogram-navigate/wx.navigateToMiniProgram.html)
+ /** [wx.navigateToMiniProgram(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/navigate/wx.navigateToMiniProgram.html)
+*
+* 需要基础库: `1.3.0`
+*
+* 在插件中使用:需要基础库 `2.18.1`
*
* 打开另一个小程序
*
* **使用限制**
*
-*
-* ##### 需要用户触发跳转
-* 从 2.3.0 版本开始,若用户未点击小程序页面任意位置,则开发者将无法调用此接口自动跳转至其他小程序。
-* ##### 需要用户确认跳转
-* 从 2.3.0 版本开始,在跳转至其他小程序前,将统一增加弹窗,询问是否跳转,用户确认后才可以跳转其他小程序。如果用户点击取消,则回调 `fail cancel`。
-* ##### 无需声明跳转名单,不限跳转数量(众测中)
-* 1. 从2020年4月24日起,使用跳转其他小程序功能将无需在全局配置中声明跳转名单,调用此接口时将不再校验所跳转的 AppID 是否在 navigateToMiniProgramAppIdList 中。
-* 2. 从2020年4月24日起,跳转其他小程序将不再受数量限制,使用此功能时请注意遵守运营规范。
+* ##### 需要用户触发跳转
+* 从 2.3.0 版本开始,若用户未点击小程序页面任意位置,则开发者将无法调用此接口自动跳转至其他小程序。
+* ##### 需要用户确认跳转
+* 从 2.3.0 版本开始,在跳转至其他小程序前,将统一增加弹窗,询问是否跳转,用户确认后才可以跳转其他小程序。如果用户点击取消,则回调 `fail cancel`。
*
* **运营规范**
*
-*
* 平台将坚决打击小程序盒子等互推行为,使用此功能时请严格遵守[《微信小程序平台运营规范》](https://developers.weixin.qq.com/miniprogram/product/#_5-10-%E4%BA%92%E6%8E%A8%E8%A1%8C%E4%B8%BA),若发现小程序违反运营规范将被下架处理。
*
* **关于调试**
*
-*
* - 在开发者工具上调用此 API 并不会真实的跳转到另外的小程序,但是开发者工具会校验本次调用跳转是否成功。[详情](https://developers.weixin.qq.com/miniprogram/dev/devtools/different.html#跳转小程序调试支持)
* - 开发者工具上支持被跳转的小程序处理接收参数的调试。[详情](https://developers.weixin.qq.com/miniprogram/dev/devtools/different.html#跳转小程序调试支持)
*
* **示例代码**
*
-*
* ```js
wx.navigateToMiniProgram({
appId: '',
@@ -14075,9 +25991,7 @@ wx.navigateToMiniProgram({
// 打开成功
}
})
-```
-*
-* 最低基础库: `1.3.0` */
+``` */
navigateToMiniProgram<
T extends NavigateToMiniProgramOption = NavigateToMiniProgramOption
>(
@@ -14085,19 +25999,20 @@ wx.navigateToMiniProgram({
): PromisifySuccessResult
/** [wx.nextTick(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/custom-component/wx.nextTick.html)
*
+* 需要基础库: `2.2.3`
+*
+* 在插件中使用:需要基础库 `2.7.1`
+*
* 延迟一部分操作到下一个时间片再执行。(类似于 setTimeout)
*
* **说明**
*
-*
-*
* 因为自定义组件中的 setData 和 triggerEvent 等接口本身是同步的操作,当这几个接口被连续调用时,都是在一个同步流程中执行完的,因此若逻辑不当可能会导致出错。
*
* 一个极端的案例:当父组件的 setData 引发了子组件的 triggerEvent,进而使得父组件又进行了一次 setData,期间有通过 wx:if 语句对子组件进行卸载,就有可能引发奇怪的错误,所以对于不需要在一个同步流程内完成的逻辑,可以使用此接口延迟到下一个时间片再执行。
*
* **示例代码**
*
-*
* ```js
Component({
doSth() {
@@ -14110,25 +26025,25 @@ Component({
this.setData({ number: 2 }) // 直接在当前同步流程中执行
}
})
-```
-*
-* 最低基础库: `2.2.3` */
+``` */
nextTick(callback: (...args: any[]) => any): void
/** [wx.notifyBLECharacteristicValueChange(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.notifyBLECharacteristicValueChange.html)
*
-* 启用低功耗蓝牙设备特征值变化时的 notify 功能,订阅特征值。注意:必须设备的特征值支持 notify 或者 indicate 才可以成功调用。
+* 需要基础库: `1.1.0`
*
-* 另外,必须先启用 `notifyBLECharacteristicValueChange` 才能监听到设备 `characteristicValueChange` 事件
+* 在插件中使用:需要基础库 `1.9.6`
+*
+* 启用蓝牙低功耗设备特征值变化时的 notify 功能,订阅特征。注意:必须设备的特征支持 notify 或者 indicate 才可以成功调用。
+*
+* 另外,必须先启用 [wx.notifyBLECharacteristicValueChange](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.notifyBLECharacteristicValueChange.html) 才能监听到设备 `characteristicValueChange` 事件
*
* **注意**
*
-*
-* - 订阅操作成功后需要设备主动更新特征值的 value,才会触发 [wx.onBLECharacteristicValueChange](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.onBLECharacteristicValueChange.html) 回调。
-* - 安卓平台上,在调用 `notifyBLECharacteristicValueChange` 成功后立即调用 `writeBLECharacteristicValue` 接口,在部分机型上会发生 10008 系统错误
+* - 订阅操作成功后需要设备主动更新特征的 value,才会触发 [wx.onBLECharacteristicValueChange](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.onBLECharacteristicValueChange.html) 回调。
+* - 安卓平台上,在本接口调用成功后立即调用 [wx.writeBLECharacteristicValue](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.writeBLECharacteristicValue.html) 接口,在部分机型上会发生 10008 系统错误
*
* **示例代码**
*
-*
* [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
* ```js
wx.notifyBLECharacteristicValueChange({
@@ -14143,368 +26058,1361 @@ wx.notifyBLECharacteristicValueChange({
console.log('notifyBLECharacteristicValueChange success', res.errMsg)
}
})
-```
-*
-* 最低基础库: `1.1.0` */
+``` */
notifyBLECharacteristicValueChange<
T extends NotifyBLECharacteristicValueChangeOption = NotifyBLECharacteristicValueChangeOption
>(
option: T
): PromisifySuccessResult
- /** [wx.offAccelerometerChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/accelerometer/wx.offAccelerometerChange.html)
+ /** [wx.notifyGroupMembers(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/chattool/wx.notifyGroupMembers.html)
*
- * 取消监听加速度数据事件,参数为空,则取消所有的事件监听。
+ * 需要基础库: `3.7.8`
*
- * 最低基础库: `2.9.3` */
+ * 在插件中使用:不支持
+ *
+ * 提醒用户完成任务,标题长度不超过 30 个字符,支持中英文和数字,中文算2个字符。 */
+ notifyGroupMembers<
+ T extends NotifyGroupMembersOption = NotifyGroupMembersOption
+ >(
+ option: T
+ ): PromisifySuccessResult
+ /** [wx.offAccelerometerChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/accelerometer/wx.offAccelerometerChange.html)
+*
+* 需要基础库: `2.9.3`
+*
+* 在插件中使用:需要基础库 `2.9.1`
+*
+* 移除加速度数据事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+wx.onAccelerometerChange(listener)
+wx.offAccelerometerChange(listener) // 需传入与监听时同一个的函数对象
+``` */
offAccelerometerChange(
- /** 加速度数据事件的回调函数 */
- callback: (...args: any[]) => any
+ /** onAccelerometerChange 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffAccelerometerChangeCallback
): void
- /** [wx.offAppHide(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offAppHide.html)
- *
- * 取消监听小程序切后台事件
- *
- * 最低基础库: `2.1.2` */
+ /** [wx.offAfterPageLoad(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-route/wx.offAfterPageLoad.html)
+*
+* 需要基础库: `3.5.5`
+*
+* 在插件中使用:需要基础库 `3.5.5`
+*
+* 移除路由事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+wx.onAfterPageLoad(listener)
+wx.offAfterPageLoad(listener) // 需传入与监听时同一个的函数对象
+``` */
+ offAfterPageLoad(
+ /** onAfterPageLoad 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffAfterPageLoadCallback
+ ): void
+ /** [wx.offAfterPageUnload(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-route/wx.offAfterPageUnload.html)
+*
+* 需要基础库: `3.5.5`
+*
+* 在插件中使用:需要基础库 `3.5.5`
+*
+* 移除路由事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+wx.onAfterPageUnload(listener)
+wx.offAfterPageUnload(listener) // 需传入与监听时同一个的函数对象
+``` */
+ offAfterPageUnload(
+ /** onAfterPageUnload 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffAfterPageUnloadCallback
+ ): void
+ /** [wx.offApiCategoryChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/life-cycle/wx.offApiCategoryChange.html)
+*
+* 需要基础库: `2.33.0`
+*
+* 在插件中使用:不支持
+*
+* 移除 API 类别变化事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+wx.onApiCategoryChange(listener)
+wx.offApiCategoryChange(listener) // 需传入与监听时同一个的函数对象
+``` */
+ offApiCategoryChange(
+ /** onApiCategoryChange 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffApiCategoryChangeCallback
+ ): void
+ /** [wx.offAppHide(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offAppHide.html)
+*
+* 需要基础库: `2.1.2`
+*
+* 在插件中使用:不支持
+*
+* 移除小程序切后台事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+wx.onAppHide(listener)
+wx.offAppHide(listener) // 需传入与监听时同一个的函数对象
+``` */
offAppHide(
- /** 小程序切后台事件的回调函数 */
- callback?: OffAppHideCallback
+ /** onAppHide 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffAppHideCallback
): void
- /** [wx.offAppShow(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offAppShow.html)
- *
- * 取消监听小程序切前台事件
- *
- * 最低基础库: `2.1.2` */
+ /** [wx.offAppRoute(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-route/wx.offAppRoute.html)
+*
+* 需要基础库: `3.5.5`
+*
+* 在插件中使用:需要基础库 `3.5.5`
+*
+* 移除路由事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+wx.onAppRoute(listener)
+wx.offAppRoute(listener) // 需传入与监听时同一个的函数对象
+``` */
+ offAppRoute(
+ /** onAppRoute 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffAppRouteCallback
+ ): void
+ /** [wx.offAppRouteDone(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-route/wx.offAppRouteDone.html)
+*
+* 需要基础库: `3.5.5`
+*
+* 在插件中使用:需要基础库 `3.5.5`
+*
+* 移除当前路由动画执行完成的事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+wx.onAppRouteDone(listener)
+wx.offAppRouteDone(listener) // 需传入与监听时同一个的函数对象
+``` */
+ offAppRouteDone(
+ /** onAppRouteDone 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffAppRouteDoneCallback
+ ): void
+ /** [wx.offAppShow(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offAppShow.html)
+*
+* 需要基础库: `2.1.2`
+*
+* 在插件中使用:不支持
+*
+* 移除小程序切前台事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+wx.onAppShow(listener)
+wx.offAppShow(listener) // 需传入与监听时同一个的函数对象
+``` */
offAppShow(
- /** 小程序切前台事件的回调函数 */
- callback?: OffAppShowCallback
+ /** onAppShow 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffAppShowCallback
): void
- /** [wx.offAudioInterruptionBegin(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offAudioInterruptionBegin.html)
- *
- * 取消监听音频因为受到系统占用而被中断开始事件
- *
- * 最低基础库: `2.6.2` */
+ /** [wx.offAudioInterruptionBegin(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offAudioInterruptionBegin.html)
+*
+* 需要基础库: `2.6.2`
+*
+* 在插件中使用:需要基础库 `2.15.0`
+*
+* 移除音频因为受到系统占用而被中断开始事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+wx.onAudioInterruptionBegin(listener)
+wx.offAudioInterruptionBegin(listener) // 需传入与监听时同一个的函数对象
+``` */
offAudioInterruptionBegin(
- /** 音频因为受到系统占用而被中断开始事件的回调函数 */
- callback?: OffAudioInterruptionBeginCallback
+ /** onAudioInterruptionBegin 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffAudioInterruptionBeginCallback
): void
- /** [wx.offAudioInterruptionEnd(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offAudioInterruptionEnd.html)
- *
- * 取消监听音频中断结束事件
- *
- * 最低基础库: `2.6.2` */
+ /** [wx.offAudioInterruptionEnd(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offAudioInterruptionEnd.html)
+*
+* 需要基础库: `2.6.2`
+*
+* 在插件中使用:需要基础库 `2.15.0`
+*
+* 移除音频中断结束事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+wx.onAudioInterruptionEnd(listener)
+wx.offAudioInterruptionEnd(listener) // 需传入与监听时同一个的函数对象
+``` */
offAudioInterruptionEnd(
- /** 音频中断结束事件的回调函数 */
- callback?: OffAudioInterruptionEndCallback
+ /** onAudioInterruptionEnd 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffAudioInterruptionEndCallback
): void
- /** [wx.offBLECharacteristicValueChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.offBLECharacteristicValueChange.html)
- *
- * 取消监听低功耗蓝牙设备的特征值变化事件。
- *
- * 最低基础库: `2.9.0` */
- offBLECharacteristicValueChange(
- /** 低功耗蓝牙设备的特征值变化事件的回调函数 */
- callback: (...args: any[]) => any
- ): void
- /** [wx.offBLEConnectionStateChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.offBLEConnectionStateChange.html)
- *
- * 取消监听低功耗蓝牙连接状态的改变事件
- *
- * 最低基础库: `2.9.0` */
+ /** [wx.offBLECharacteristicValueChange()](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.offBLECharacteristicValueChange.html)
+*
+* 需要基础库: `2.9.0`
+*
+* 在插件中使用:需要基础库 `2.9.1`
+*
+* 移除蓝牙低功耗设备的特征值变化事件的全部监听函数
+*
+* **示例代码**
+*
+* ```js
+wx.offBLECharacteristicValueChange()
+``` */
+ offBLECharacteristicValueChange(): void
+ /** [wx.offBLEConnectionStateChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.offBLEConnectionStateChange.html)
+*
+* 需要基础库: `2.9.0`
+*
+* 在插件中使用:需要基础库 `2.9.1`
+*
+* 移除蓝牙低功耗连接状态改变事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+wx.onBLEConnectionStateChange(listener)
+wx.offBLEConnectionStateChange(listener) // 需传入与监听时同一个的函数对象
+``` */
offBLEConnectionStateChange(
- /** 低功耗蓝牙连接状态的改变事件的回调函数 */
- callback: (...args: any[]) => any
+ /** onBLEConnectionStateChange 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffBLEConnectionStateChangeCallback
): void
- /** [wx.offBLEPeripheralConnectionStateChanged(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/wx.offBLEPeripheralConnectionStateChanged.html)
- *
- * 取消监听当前外围设备被连接或断开连接事件
- *
- * 最低基础库: `2.10.3` */
+ /** [wx.offBLEMTUChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.offBLEMTUChange.html)
+*
+* 需要基础库: `2.20.1`
+*
+* 在插件中使用:需要基础库 `2.20.1`
+*
+* 移除蓝牙低功耗的最大传输单元变化事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+wx.onBLEMTUChange(listener)
+wx.offBLEMTUChange(listener) // 需传入与监听时同一个的函数对象
+``` */
+ offBLEMTUChange(
+ /** onBLEMTUChange 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffBLEMTUChangeCallback
+ ): void
+ /** [wx.offBLEPeripheralConnectionStateChanged(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/wx.offBLEPeripheralConnectionStateChanged.html)
+*
+* 需要基础库: `2.10.3`
+*
+* 在插件中使用:需要基础库 `2.22.1`
+*
+* 移除当前外围设备被连接或断开连接事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+wx.onBLEPeripheralConnectionStateChanged(listener)
+wx.offBLEPeripheralConnectionStateChanged(listener) // 需传入与监听时同一个的函数对象
+``` */
offBLEPeripheralConnectionStateChanged(
- /** 当前外围设备被连接或断开连接事件的回调函数 */
- callback?: OffBLEPeripheralConnectionStateChangedCallback
+ /** onBLEPeripheralConnectionStateChanged 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffBLEPeripheralConnectionStateChangedCallback
): void
- /** [wx.offBeaconServiceChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.offBeaconServiceChange.html)
- *
- * 取消监听 iBeacon 服务状态变化事件
- *
- * 最低基础库: `2.8.1` */
- offBeaconServiceChange(
- /** iBeacon 服务状态变化事件的回调函数 */
- callback?: OffBeaconServiceChangeCallback
+ /** [wx.offBatteryInfoChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/battery/wx.offBatteryInfoChange.html)
+*
+* 需要基础库: `3.5.0`
+*
+* 在插件中使用:不支持
+*
+* 移除电池信息变化事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+wx.onBatteryInfoChange(listener)
+wx.offBatteryInfoChange(listener) // 需传入与监听时同一个的函数对象
+``` */
+ offBatteryInfoChange(
+ /** onBatteryInfoChange 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffBatteryInfoChangeCallback
): void
- /** [wx.offBeaconUpdate(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.offBeaconUpdate.html)
- *
- * 取消监听 iBeacon 设备更新事件
- *
- * 最低基础库: `2.8.1` */
- offBeaconUpdate(
- /** iBeacon 设备更新事件的回调函数 */
- callback?: OffBeaconUpdateCallback
+ /** [wx.offBeaconServiceChange()](https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.offBeaconServiceChange.html)
+*
+* 需要基础库: `2.8.1`
+*
+* 在插件中使用:需要基础库 `2.9.1`
+*
+* 移除 Beacon 服务状态变化事件的全部监听函数
+*
+* **示例代码**
+*
+* ```js
+wx.offBeaconServiceChange()
+``` */
+ offBeaconServiceChange(): void
+ /** [wx.offBeaconUpdate()](https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.offBeaconUpdate.html)
+*
+* 需要基础库: `2.8.1`
+*
+* 在插件中使用:需要基础库 `2.9.1`
+*
+* 移除 Beacon 设备更新事件的全部监听函数
+*
+* **示例代码**
+*
+* ```js
+wx.offBeaconUpdate()
+``` */
+ offBeaconUpdate(): void
+ /** [wx.offBeforeAppRoute(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-route/wx.offBeforeAppRoute.html)
+*
+* 需要基础库: `3.5.5`
+*
+* 在插件中使用:需要基础库 `3.5.5`
+*
+* 移除路由事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+wx.onBeforeAppRoute(listener)
+wx.offBeforeAppRoute(listener) // 需传入与监听时同一个的函数对象
+``` */
+ offBeforeAppRoute(
+ /** onBeforeAppRoute 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffBeforeAppRouteCallback
): void
- /** [wx.offBluetoothAdapterStateChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.offBluetoothAdapterStateChange.html)
- *
- * 取消监听蓝牙适配器状态变化事件。
- *
- * 最低基础库: `2.9.0` */
- offBluetoothAdapterStateChange(
- /** 蓝牙适配器状态变化事件的回调函数 */
- callback: (...args: any[]) => any
+ /** [wx.offBeforePageLoad(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-route/wx.offBeforePageLoad.html)
+*
+* 需要基础库: `3.5.5`
+*
+* 在插件中使用:需要基础库 `3.5.5`
+*
+* 移除路由事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+wx.onBeforePageLoad(listener)
+wx.offBeforePageLoad(listener) // 需传入与监听时同一个的函数对象
+``` */
+ offBeforePageLoad(
+ /** onBeforePageLoad 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffBeforePageLoadCallback
): void
- /** [wx.offBluetoothDeviceFound(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.offBluetoothDeviceFound.html)
- *
- * 取消监听寻找到新设备的事件。
- *
- * 最低基础库: `2.9.0` */
- offBluetoothDeviceFound(
- /** 寻找到新设备的事件的回调函数 */
- callback: (...args: any[]) => any
+ /** [wx.offBeforePageUnload(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-route/wx.offBeforePageUnload.html)
+*
+* 需要基础库: `3.5.5`
+*
+* 在插件中使用:需要基础库 `3.5.5`
+*
+* 移除路由事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+wx.onBeforePageUnload(listener)
+wx.offBeforePageUnload(listener) // 需传入与监听时同一个的函数对象
+``` */
+ offBeforePageUnload(
+ /** onBeforePageUnload 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffBeforePageUnloadCallback
): void
- /** [wx.offCompassChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/compass/wx.offCompassChange.html)
- *
- * 取消监听罗盘数据变化事件,参数为空,则取消所有的事件监听。
- *
- * 最低基础库: `2.9.3` */
+ /** [wx.offBluetoothAdapterStateChange()](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.offBluetoothAdapterStateChange.html)
+*
+* 需要基础库: `2.9.0`
+*
+* 在插件中使用:需要基础库 `2.9.1`
+*
+* 移除蓝牙适配器状态变化事件的全部监听函数
+*
+* **示例代码**
+*
+* ```js
+wx.offBluetoothAdapterStateChange()
+``` */
+ offBluetoothAdapterStateChange(): void
+ /** [wx.offBluetoothDeviceFound()](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.offBluetoothDeviceFound.html)
+*
+* 需要基础库: `2.9.0`
+*
+* 在插件中使用:需要基础库 `2.9.1`
+*
+* 移除搜索到新设备的事件的全部监听函数
+*
+* **示例代码**
+*
+* ```js
+wx.offBluetoothDeviceFound()
+``` */
+ offBluetoothDeviceFound(): void
+ /** [wx.offCompassChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/compass/wx.offCompassChange.html)
+*
+* 需要基础库: `2.9.3`
+*
+* 在插件中使用:需要基础库 `2.9.1`
+*
+* 移除罗盘数据变化事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+wx.onCompassChange(listener)
+wx.offCompassChange(listener) // 需传入与监听时同一个的函数对象
+``` */
offCompassChange(
- /** 罗盘数据变化事件的回调函数 */
- callback: (...args: any[]) => any
+ /** onCompassChange 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffCompassChangeCallback
): void
- /** [wx.offCopyUrl(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.offCopyUrl.html)
+ /** [wx.offCopyUrl()](https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.offCopyUrl.html)
*
- * 取消监听用户点击右上角菜单的「复制链接」按钮时触发的事件
+ * 需要基础库: `2.14.3`
*
- * 最低基础库: `2.14.3` */
- offCopyUrl(
- /** 用户点击右上角菜单的「复制链接」按钮时触发的事件的回调函数 */
- callback?: OffCopyUrlCallback
- ): void
- /** [wx.offDeviceMotionChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/motion/wx.offDeviceMotionChange.html)
+ * 在插件中使用:不支持
*
- * 取消监听设备方向变化事件,参数为空,则取消所有的事件监听。
- *
- * 最低基础库: `2.9.3` */
+ * 移除用户点击右上角菜单的「复制链接」按钮时触发的事件的全部监听函数 */
+ offCopyUrl(): void
+ /** [wx.offDeviceMotionChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/motion/wx.offDeviceMotionChange.html)
+*
+* 需要基础库: `2.9.3`
+*
+* 在插件中使用:需要基础库 `2.9.1`
+*
+* 移除设备方向变化事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+wx.onDeviceMotionChange(listener)
+wx.offDeviceMotionChange(listener) // 需传入与监听时同一个的函数对象
+``` */
offDeviceMotionChange(
- /** 设备方向变化事件的回调函数 */
- callback: (...args: any[]) => any
+ /** onDeviceMotionChange 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffDeviceMotionChangeCallback
): void
- /** [wx.offError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offError.html)
- *
- * 取消监听小程序错误事件。
- *
- * 最低基础库: `2.1.2` */
+ /** [wx.offEmbeddedMiniProgramHeightChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/navigate/wx.offEmbeddedMiniProgramHeightChange.html)
+*
+* 需要基础库: `2.33.0`
+*
+* 在插件中使用:不支持
+*
+* 移除半屏小程序可视高度变化事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+wx.onEmbeddedMiniProgramHeightChange(listener)
+wx.offEmbeddedMiniProgramHeightChange(listener) // 需传入与监听时同一个的函数对象
+``` */
+ offEmbeddedMiniProgramHeightChange(
+ /** onEmbeddedMiniProgramHeightChange 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffEmbeddedMiniProgramHeightChangeCallback
+ ): void
+ /** [wx.offError(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offError.html)
+*
+* 需要基础库: `2.1.2`
+*
+* 在插件中使用:不支持
+*
+* 移除小程序错误事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+wx.onError(listener)
+wx.offError(listener) // 需传入与监听时同一个的函数对象
+``` */
offError(
- /** 小程序错误事件的回调函数 */
- callback: (...args: any[]) => any
+ /** onError 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: WxOffErrorCallback
): void
- /** [wx.offGetWifiList(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.offGetWifiList.html)
+ /** [wx.offGeneratePoster()](https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.offGeneratePoster.html)
*
- * 取消监听获取到 Wi-Fi 列表数据事件。
+ * 需要基础库: `3.12.0`
*
- * 最低基础库: `2.9.0` */
+ * 在插件中使用:不支持
+ *
+ * 用户截屏之后需要开发者生成自定义海报事件。取消事件监听。 */
+ offGeneratePoster(): void
+ /** [wx.offGetWifiList(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.offGetWifiList.html)
+*
+* 需要基础库: `2.9.0`
+*
+* 在插件中使用:需要基础库 `2.9.1`
+*
+* 移除获取到 Wi-Fi 列表数据事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+wx.onGetWifiList(listener)
+wx.offGetWifiList(listener) // 需传入与监听时同一个的函数对象
+``` */
offGetWifiList(
- /** 获取到 Wi-Fi 列表数据事件的回调函数 */
- callback: (...args: any[]) => any
+ /** onGetWifiList 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffGetWifiListCallback
): void
- /** [wx.offGyroscopeChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/gyroscope/wx.offGyroscopeChange.html)
- *
- * 取消监听陀螺仪数据变化事件。
- *
- * 最低基础库: `2.9.3` */
+ /** [wx.offGyroscopeChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/gyroscope/wx.offGyroscopeChange.html)
+*
+* 需要基础库: `2.9.3`
+*
+* 在插件中使用:需要基础库 `2.9.1`
+*
+* 移除陀螺仪数据变化事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+wx.onGyroscopeChange(listener)
+wx.offGyroscopeChange(listener) // 需传入与监听时同一个的函数对象
+``` */
offGyroscopeChange(
- /** 陀螺仪数据变化事件的回调函数 */
- callback: (...args: any[]) => any
+ /** onGyroscopeChange 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffGyroscopeChangeCallback
): void
- /** [wx.offHCEMessage(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/wx.offHCEMessage.html)
- *
- * 接收 NFC 设备消息事件,取消事件监听。
- *
- * 最低基础库: `2.8.1` */
+ /** [wx.offHCEMessage(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc-hce/wx.offHCEMessage.html)
+*
+* 需要基础库: `2.8.1`
+*
+* 在插件中使用:需要基础库 `2.9.1`
+*
+* 移除接收 NFC 设备消息事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+wx.onHCEMessage(listener)
+wx.offHCEMessage(listener) // 需传入与监听时同一个的函数对象
+``` */
offHCEMessage(
- /** 接收 NFC 设备消息事件的回调函数 */
- callback: (...args: any[]) => any
+ /** onHCEMessage 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffHCEMessageCallback
): void
- /** [wx.offKeyboardHeightChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/keyboard/wx.offKeyboardHeightChange.html)
- *
- * 取消监听键盘高度变化事件
- *
- * 最低基础库: `2.9.2` */
+ /** [wx.offKeyDown(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/keyboard/wx.offKeyDown.html)
+*
+* 需要基础库: `3.6.0`
+*
+* 在插件中使用:不支持
+*
+* 移除小程序全局键盘按键按下事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+wx.onKeyDown(listener)
+wx.offKeyDown(listener) // 需传入与监听时同一个的函数对象
+``` */
+ offKeyDown(
+ /** onKeyDown 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffKeyDownCallback
+ ): void
+ /** [wx.offKeyUp(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/keyboard/wx.offKeyUp.html)
+*
+* 需要基础库: `3.6.0`
+*
+* 在插件中使用:不支持
+*
+* 移除小程序全局键盘按键弹起事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+wx.onKeyUp(listener)
+wx.offKeyUp(listener) // 需传入与监听时同一个的函数对象
+``` */
+ offKeyUp(
+ /** onKeyUp 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffKeyUpCallback
+ ): void
+ /** [wx.offKeyboardHeightChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/keyboard/wx.offKeyboardHeightChange.html)
+*
+* 需要基础库: `2.9.2`
+*
+* 在插件中使用:不支持
+*
+* 移除键盘高度变化事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+wx.onKeyboardHeightChange(listener)
+wx.offKeyboardHeightChange(listener) // 需传入与监听时同一个的函数对象
+``` */
offKeyboardHeightChange(
- /** 键盘高度变化事件的回调函数 */
- callback: (...args: any[]) => any
+ /** onKeyboardHeightChange 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffKeyboardHeightChangeCallback
): void
- /** [wx.offLocalServiceDiscoveryStop(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/mdns/wx.offLocalServiceDiscoveryStop.html)
- *
- * 取消监听 mDNS 服务停止搜索的事件
- *
- * 最低基础库: `2.4.0` */
+ /** [wx.offLazyLoadError(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offLazyLoadError.html)
+*
+* 需要基础库: `2.24.3`
+*
+* 在插件中使用:不支持
+*
+* 移除小程序异步组件加载失败事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+wx.onLazyLoadError(listener)
+wx.offLazyLoadError(listener) // 需传入与监听时同一个的函数对象
+``` */
+ offLazyLoadError(
+ /** onLazyLoadError 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffLazyLoadErrorCallback
+ ): void
+ /** [wx.offLocalServiceDiscoveryStop(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/mdns/wx.offLocalServiceDiscoveryStop.html)
+*
+* 需要基础库: `2.4.0`
+*
+* 在插件中使用:需要基础库 `2.15.0`
+*
+* 移除 mDNS 服务停止搜索的事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+wx.onLocalServiceDiscoveryStop(listener)
+wx.offLocalServiceDiscoveryStop(listener) // 需传入与监听时同一个的函数对象
+``` */
offLocalServiceDiscoveryStop(
- /** mDNS 服务停止搜索的事件的回调函数 */
- callback?: OffLocalServiceDiscoveryStopCallback
+ /** onLocalServiceDiscoveryStop 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffLocalServiceDiscoveryStopCallback
): void
- /** [wx.offLocalServiceFound(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/mdns/wx.offLocalServiceFound.html)
- *
- * 取消监听 mDNS 服务发现的事件
- *
- * 最低基础库: `2.4.0` */
+ /** [wx.offLocalServiceFound(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/mdns/wx.offLocalServiceFound.html)
+*
+* 需要基础库: `2.4.0`
+*
+* 在插件中使用:需要基础库 `2.15.0`
+*
+* 移除 mDNS 服务发现的事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+wx.onLocalServiceFound(listener)
+wx.offLocalServiceFound(listener) // 需传入与监听时同一个的函数对象
+``` */
offLocalServiceFound(
- /** mDNS 服务发现的事件的回调函数 */
- callback?: OffLocalServiceFoundCallback
+ /** onLocalServiceFound 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffLocalServiceFoundCallback
): void
- /** [wx.offLocalServiceLost(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/mdns/wx.offLocalServiceLost.html)
- *
- * 取消监听 mDNS 服务离开的事件
- *
- * 最低基础库: `2.4.0` */
+ /** [wx.offLocalServiceLost(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/mdns/wx.offLocalServiceLost.html)
+*
+* 需要基础库: `2.4.0`
+*
+* 在插件中使用:需要基础库 `2.15.0`
+*
+* 移除 mDNS 服务离开的事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+wx.onLocalServiceLost(listener)
+wx.offLocalServiceLost(listener) // 需传入与监听时同一个的函数对象
+``` */
offLocalServiceLost(
- /** mDNS 服务离开的事件的回调函数 */
- callback?: OffLocalServiceLostCallback
+ /** onLocalServiceLost 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffLocalServiceLostCallback
): void
- /** [wx.offLocalServiceResolveFail(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/mdns/wx.offLocalServiceResolveFail.html)
- *
- * 取消监听 mDNS 服务解析失败的事件
- *
- * 最低基础库: `2.4.0` */
+ /** [wx.offLocalServiceResolveFail(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/mdns/wx.offLocalServiceResolveFail.html)
+*
+* 需要基础库: `2.4.0`
+*
+* 在插件中使用:需要基础库 `2.15.0`
+*
+* 移除 mDNS 服务解析失败的事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+wx.onLocalServiceResolveFail(listener)
+wx.offLocalServiceResolveFail(listener) // 需传入与监听时同一个的函数对象
+``` */
offLocalServiceResolveFail(
- /** mDNS 服务解析失败的事件的回调函数 */
- callback?: OffLocalServiceResolveFailCallback
+ /** onLocalServiceResolveFail 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffLocalServiceResolveFailCallback
): void
- /** [wx.offLocationChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.offLocationChange.html)
- *
- * 取消监听实时地理位置变化事件
- *
- * 最低基础库: `2.8.1` */
+ /** [wx.offLocationChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.offLocationChange.html)
+*
+* 需要基础库: `2.8.1`
+*
+* 在插件中使用:不支持
+*
+* 移除实时地理位置变化事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+wx.onLocationChange(listener)
+wx.offLocationChange(listener) // 需传入与监听时同一个的函数对象
+``` */
offLocationChange(
- /** 实时地理位置变化事件的回调函数 */
- callback?: OffLocationChangeCallback
+ /** onLocationChange 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffLocationChangeCallback
): void
- /** [wx.offMemoryWarning(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/performance/wx.offMemoryWarning.html)
- *
- * 取消监听内存不足告警事件。
- *
- * 最低基础库: `2.9.0` */
+ /** [wx.offLocationChangeError(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.offLocationChangeError.html)
+*
+* 需要基础库: `2.19.5`
+*
+* 在插件中使用:不支持
+*
+* 移除持续定位接口返回失败时触发。的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+wx.onLocationChangeError(listener)
+wx.offLocationChangeError(listener) // 需传入与监听时同一个的函数对象
+``` */
+ offLocationChangeError(
+ /** onLocationChangeError 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffLocationChangeErrorCallback
+ ): void
+ /** [wx.offMemoryWarning(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/memory/wx.offMemoryWarning.html)
+*
+* 需要基础库: `2.9.0`
+*
+* 在插件中使用:不支持
+*
+* 移除内存不足告警事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+wx.onMemoryWarning(listener)
+wx.offMemoryWarning(listener) // 需传入与监听时同一个的函数对象
+``` */
offMemoryWarning(
- /** 内存不足告警事件的回调函数 */
- callback: (...args: any[]) => any
+ /** onMemoryWarning 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffMemoryWarningCallback
): void
- /** [wx.offNetworkStatusChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/network/wx.offNetworkStatusChange.html)
- *
- * 取消监听网络状态变化事件,参数为空,则取消所有的事件监听。
- *
- * 最低基础库: `2.9.3` */
+ /** [wx.offMenuButtonBoundingClientRectWeightChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/menu/wx.offMenuButtonBoundingClientRectWeightChange.html)
+*
+* 需要基础库: `3.4.3`
+*
+* 在插件中使用:不支持
+*
+* 移除菜单按钮(右上角胶囊按钮)的布局位置信息变化事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+wx.onMenuButtonBoundingClientRectWeightChange(listener)
+wx.offMenuButtonBoundingClientRectWeightChange(listener) // 需传入与监听时同一个的函数对象
+``` */
+ offMenuButtonBoundingClientRectWeightChange(
+ /** onMenuButtonBoundingClientRectWeightChange 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffMenuButtonBoundingClientRectWeightChangeCallback
+ ): void
+ /** [wx.offNetworkStatusChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/network/wx.offNetworkStatusChange.html)
+*
+* 需要基础库: `2.9.3`
+*
+* 在插件中使用:需要基础库 `2.9.1`
+*
+* 移除网络状态变化事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+wx.onNetworkStatusChange(listener)
+wx.offNetworkStatusChange(listener) // 需传入与监听时同一个的函数对象
+``` */
offNetworkStatusChange(
- /** 网络状态变化事件的回调函数 */
- callback: (...args: any[]) => any
+ /** onNetworkStatusChange 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffNetworkStatusChangeCallback
): void
- /** [wx.offPageNotFound(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offPageNotFound.html)
- *
- * 取消监听小程序要打开的页面不存在事件
- *
- * 最低基础库: `2.1.2` */
+ /** [wx.offNetworkWeakChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/network/wx.offNetworkWeakChange.html)
+*
+* 需要基础库: `2.21.0`
+*
+* 在插件中使用:不支持
+*
+* 移除弱网状态变化事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+wx.onNetworkWeakChange(listener)
+wx.offNetworkWeakChange(listener) // 需传入与监听时同一个的函数对象
+``` */
+ offNetworkWeakChange(
+ /** onNetworkWeakChange 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffNetworkWeakChangeCallback
+ ): void
+ /** [wx.offOnUserTriggerTranslation(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/menu/wx.offOnUserTriggerTranslation.html)
+*
+* 需要基础库: `3.7.9`
+*
+* 在插件中使用:不支持
+*
+* 移除用户触发小程序菜单中翻译功能的事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+wx.onOnUserTriggerTranslation(listener)
+wx.offOnUserTriggerTranslation(listener) // 需传入与监听时同一个的函数对象
+``` */
+ offOnUserTriggerTranslation(
+ /** onOnUserTriggerTranslation 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffOnUserTriggerTranslationCallback
+ ): void
+ /** [wx.offPageNotFound(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offPageNotFound.html)
+*
+* 需要基础库: `2.1.2`
+*
+* 在插件中使用:不支持
+*
+* 移除小程序要打开的页面不存在事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+wx.onPageNotFound(listener)
+wx.offPageNotFound(listener) // 需传入与监听时同一个的函数对象
+``` */
offPageNotFound(
- /** 小程序要打开的页面不存在事件的回调函数 */
- callback?: OffPageNotFoundCallback
+ /** onPageNotFound 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffPageNotFoundCallback
): void
- /** [wx.offThemeChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offThemeChange.html)
- *
- * 取消监听系统主题改变事件
- *
- * 最低基础库: `2.11.0` */
+ /** [wx.offParallelStateChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/window/wx.offParallelStateChange.html)
+*
+* 需要基础库: `3.12.1`
+*
+* 在插件中使用:不支持
+*
+* 移除小程序分栏状态变化事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+wx.onParallelStateChange(listener)
+wx.offParallelStateChange(listener) // 需传入与监听时同一个的函数对象
+``` */
+ offParallelStateChange(
+ /** onParallelStateChange 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffParallelStateChangeCallback
+ ): void
+ /** [wx.offScreenRecordingStateChanged(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.offScreenRecordingStateChanged.html)
+*
+* 需要基础库: `2.24.0`
+*
+* 在插件中使用:不支持
+*
+* 移除用户录屏事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+wx.onScreenRecordingStateChanged(listener)
+wx.offScreenRecordingStateChanged(listener) // 需传入与监听时同一个的函数对象
+``` */
+ offScreenRecordingStateChanged(
+ /** onScreenRecordingStateChanged 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffScreenRecordingStateChangedCallback
+ ): void
+ /** [wx.offThemeChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offThemeChange.html)
+*
+* 需要基础库: `2.11.0`
+*
+* 在插件中使用:不支持
+*
+* 移除系统主题改变事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+wx.onThemeChange(listener)
+wx.offThemeChange(listener) // 需传入与监听时同一个的函数对象
+``` */
offThemeChange(
- /** 系统主题改变事件的回调函数 */
- callback?: OffThemeChangeCallback
+ /** onThemeChange 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffThemeChangeCallback
): void
- /** [wx.offUnhandledRejection(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offUnhandledRejection.html)
- *
- * 取消监听未处理的 Promise 拒绝事件
- *
- * 最低基础库: `2.10.0` */
+ /** [wx.offUnhandledRejection(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offUnhandledRejection.html)
+*
+* 需要基础库: `2.10.0`
+*
+* 在插件中使用:不支持
+*
+* 移除未处理的 Promise 拒绝事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+wx.onUnhandledRejection(listener)
+wx.offUnhandledRejection(listener) // 需传入与监听时同一个的函数对象
+``` */
offUnhandledRejection(
- /** 未处理的 Promise 拒绝事件的回调函数 */
- callback?: OffUnhandledRejectionCallback
+ /** onUnhandledRejection 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffUnhandledRejectionCallback
): void
- /** [wx.offUserCaptureScreen(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.offUserCaptureScreen.html)
+ /** [wx.offUserCaptureScreen()](https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.offUserCaptureScreen.html)
*
- * 用户主动截屏事件。取消事件监听。
+ * 需要基础库: `2.9.3`
*
- * 最低基础库: `2.9.3` */
- offUserCaptureScreen(
- /** 用户主动截屏事件的回调函数 */
- callback?: (...args: any[]) => any
- ): void
- /** [wx.offVoIPChatInterrupted(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.offVoIPChatInterrupted.html)
+ * 在插件中使用:需要基础库 `2.9.1`
*
- * 取消监听被动断开实时语音通话事件。
+ * 在插件中使用时,只能在当前插件的页面中调用
*
- * 最低基础库: `2.9.0` */
+ * 用户主动截屏事件。取消事件监听。 */
+ offUserCaptureScreen(): void
+ /** [wx.offVoIPChatInterrupted(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.offVoIPChatInterrupted.html)
+*
+* 需要基础库: `2.9.0`
+*
+* 在插件中使用:需要基础库 `2.9.1`
+*
+* 移除被动断开实时语音通话事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+wx.onVoIPChatInterrupted(listener)
+wx.offVoIPChatInterrupted(listener) // 需传入与监听时同一个的函数对象
+``` */
offVoIPChatInterrupted(
- /** 被动断开实时语音通话事件的回调函数 */
- callback: (...args: any[]) => any
+ /** onVoIPChatInterrupted 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffVoIPChatInterruptedCallback
): void
- /** [wx.offVoIPChatMembersChanged(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.offVoIPChatMembersChanged.html)
- *
- * 取消监听实时语音通话成员在线状态变化事件。
- *
- * 最低基础库: `2.9.0` */
+ /** [wx.offVoIPChatMembersChanged(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.offVoIPChatMembersChanged.html)
+*
+* 需要基础库: `2.9.0`
+*
+* 在插件中使用:需要基础库 `2.9.1`
+*
+* 移除实时语音通话成员在线状态变化事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+wx.onVoIPChatMembersChanged(listener)
+wx.offVoIPChatMembersChanged(listener) // 需传入与监听时同一个的函数对象
+``` */
offVoIPChatMembersChanged(
- /** 实时语音通话成员在线状态变化事件的回调函数 */
- callback: (...args: any[]) => any
+ /** onVoIPChatMembersChanged 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffVoIPChatMembersChangedCallback
): void
- /** [wx.offVoIPVideoMembersChanged(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.offVoIPVideoMembersChanged.html)
- *
- * 取消监听实时语音通话成员视频状态变化事件
- *
- * 最低基础库: `2.11.0` */
+ /** [wx.offVoIPChatSpeakersChanged(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.offVoIPChatSpeakersChanged.html)
+*
+* 需要基础库: `2.9.0`
+*
+* 在插件中使用:需要基础库 `2.9.1`
+*
+* 移除实时语音通话成员通话状态变化事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+wx.onVoIPChatSpeakersChanged(listener)
+wx.offVoIPChatSpeakersChanged(listener) // 需传入与监听时同一个的函数对象
+``` */
+ offVoIPChatSpeakersChanged(
+ /** onVoIPChatSpeakersChanged 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffVoIPChatSpeakersChangedCallback
+ ): void
+ /** [wx.offVoIPChatStateChanged(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.offVoIPChatStateChanged.html)
+*
+* 需要基础库: `2.16.0`
+*
+* 在插件中使用:不支持
+*
+* 移除房间状态变化事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+wx.onVoIPChatStateChanged(listener)
+wx.offVoIPChatStateChanged(listener) // 需传入与监听时同一个的函数对象
+``` */
+ offVoIPChatStateChanged(
+ /** onVoIPChatStateChanged 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffVoIPChatStateChangedCallback
+ ): void
+ /** [wx.offVoIPVideoMembersChanged(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.offVoIPVideoMembersChanged.html)
+*
+* 需要基础库: `2.11.0`
+*
+* 在插件中使用:不支持
+*
+* 移除实时语音通话成员视频状态变化事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+wx.onVoIPVideoMembersChanged(listener)
+wx.offVoIPVideoMembersChanged(listener) // 需传入与监听时同一个的函数对象
+``` */
offVoIPVideoMembersChanged(
- /** 实时语音通话成员视频状态变化事件的回调函数 */
- callback?: OffVoIPVideoMembersChangedCallback
+ /** onVoIPVideoMembersChanged 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffVoIPVideoMembersChangedCallback
): void
- /** [wx.offWifiConnected(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.offWifiConnected.html)
- *
- * 取消监听连接上 Wi-Fi 的事件。
- *
- * 最低基础库: `2.9.0` */
+ /** [wx.offWifiConnected(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.offWifiConnected.html)
+*
+* 需要基础库: `2.9.0`
+*
+* 在插件中使用:需要基础库 `2.9.1`
+*
+* 移除连接上 Wi-Fi 的事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+wx.onWifiConnected(listener)
+wx.offWifiConnected(listener) // 需传入与监听时同一个的函数对象
+``` */
offWifiConnected(
- /** 连接上 Wi-Fi 的事件的回调函数 */
- callback: (...args: any[]) => any
+ /** onWifiConnected 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffWifiConnectedCallback
): void
- /** [wx.offWindowResize(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/window/wx.offWindowResize.html)
- *
- * 取消监听窗口尺寸变化事件
- *
- * 最低基础库: `2.3.0` */
+ /** [wx.offWifiConnectedWithPartialInfo(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.offWifiConnectedWithPartialInfo.html)
+*
+* 需要基础库: `2.22.0`
+*
+* 在插件中使用:需要基础库 `2.22.1`
+*
+* 移除连接上 Wi-Fi 的事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+wx.onWifiConnectedWithPartialInfo(listener)
+wx.offWifiConnectedWithPartialInfo(listener) // 需传入与监听时同一个的函数对象
+``` */
+ offWifiConnectedWithPartialInfo(
+ /** onWifiConnectedWithPartialInfo 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffWifiConnectedWithPartialInfoCallback
+ ): void
+ /** [wx.offWindowResize(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/window/wx.offWindowResize.html)
+*
+* 需要基础库: `2.3.0`
+*
+* 在插件中使用:不支持
+*
+* 移除窗口尺寸变化事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+wx.onWindowResize(listener)
+wx.offWindowResize(listener) // 需传入与监听时同一个的函数对象
+``` */
offWindowResize(
- /** 窗口尺寸变化事件的回调函数 */
- callback?: OffWindowResizeCallback
+ /** onWindowResize 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffWindowResizeCallback
): void
- /** [wx.onAccelerometerChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/accelerometer/wx.onAccelerometerChange.html)
+ /** [wx.offWindowStateChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/window/wx.offWindowStateChange.html)
+*
+* 需要基础库: `3.8.8`
+*
+* 在插件中使用:不支持
+*
+* 移除小程序窗口状态变化事件的监听函数
+*
+* **示例代码**
+*
+* ```js
+const listener = function (res) { console.log(res) }
+
+wx.onWindowStateChange(listener)
+wx.offWindowStateChange(listener) // 需传入与监听时同一个的函数对象
+``` */
+ offWindowStateChange(
+ /** onWindowStateChange 传入的监听函数。不传此参数则移除所有监听函数。 */
+ listener?: OffWindowStateChangeCallback
+ ): void
+ /** [wx.onAccelerometerChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/accelerometer/wx.onAccelerometerChange.html)
+*
+* 在插件中使用:不支持
*
* 监听加速度数据事件。频率根据 [wx.startAccelerometer()](https://developers.weixin.qq.com/miniprogram/dev/api/device/accelerometer/wx.startAccelerometer.html) 的 interval 参数, 接口调用后会自动开始监听。
*
* **示例代码**
*
-*
* ```js
wx.onAccelerometerChange(callback)
``` */
onAccelerometerChange(
- /** 加速度数据事件的回调函数 */
- callback: OnAccelerometerChangeCallback
+ /** 加速度数据事件的监听函数 */
+ listener: OnAccelerometerChangeCallback
): void
- /** [wx.onAppHide(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onAppHide.html)
+ /** [wx.onAfterPageLoad(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-route/wx.onAfterPageLoad.html)
+*
+* 需要基础库: `3.5.5`
+*
+* 在插件中使用:需要基础库 `3.5.5`
+*
+* 监听路由事件引起新的页面实例化时,页面实例化完成的事件监听,详见 [页面路由监听](https://developers.weixin.qq.com/miniprogram/dev/framework/app-service/route-event-listener.html)。
+*
+* ****
+*
+* > 新旧版本小程序组件框架的说明详见:[glass-easel:新版微信小程序组件框架](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/glass-easel/introduction.html)
+*
+* **示例代码**
+*
+* ```js
+const func = function (res) {
+ console.log(res)
+}
+wx.onAfterPageLoad(func)
+// 取消监听
+wx.offAfterPageLoad(func)
+``` */
+ onAfterPageLoad(
+ /** 路由事件的监听函数 */
+ listener: OnAfterPageLoadCallback
+ ): void
+ /** [wx.onAfterPageUnload(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-route/wx.onAfterPageUnload.html)
+*
+* 需要基础库: `3.5.5`
+*
+* 在插件中使用:需要基础库 `3.5.5`
+*
+* 监听路由事件引起现有页面实例销毁时,页面实例销毁后的事件监听,详见 [页面路由监听](https://developers.weixin.qq.com/miniprogram/dev/framework/app-service/route-event-listener.html)。
+*
+* **示例代码**
+*
+* ```js
+const func = function (res) {
+ console.log(res)
+}
+wx.onAfterPageUnload(func)
+// 取消监听
+wx.offAfterPageUnload(func)
+``` */
+ onAfterPageUnload(
+ /** 路由事件的监听函数 */
+ listener: OnAfterPageUnloadCallback
+ ): void
+ /** [wx.onApiCategoryChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/life-cycle/wx.onApiCategoryChange.html)
+*
+* 需要基础库: `2.33.0`
+*
+* 在插件中使用:不支持
+*
+* 监听 API 类别变化事件
+*
+* **不同 apiCategory 场景下的 API 限制**
+*
+* `X` 表示 API 被限制无法使用;不在表格中的 API 不限制。
+*
+* | | default | nativeFunctionalized | browseOnly | embedded | chatTool |
+* |-|-|-|-|-|--|
+* |openSetting | | | `X` | | |
+* |<button open-type="share"> | | `X` | `X` | `X` | `X` |
+* |<button open-type="feedback"> | | | `X` | | |
+* |<button open-type="open-setting">| | | `X` | | |
+* |navigateToMiniProgram | | `X` | `X` | | `X` |
+* |openEmbeddedMiniProgram | | `X` | `X` | `X` | `X` |
+* |openOfficialAccountArticle | | | | | `X` |
+* |openChannelsUserProfile | | | | | `X` |
+* |ad | | | | | `X` |
+* |ad-custom | | | | | `X` |
+* |小程序菜单分享 | | | | | `X` |
+*
+* **示例代码**
+*
+* ```js
+const func = function (res) {
+ console.log(res.apiCategory)
+}
+wx.onApiCategoryChange(func)
+// 取消监听
+wx.offApiCategoryChange(func)
+``` */
+ onApiCategoryChange(
+ /** API 类别变化事件的监听函数 */
+ listener: OnApiCategoryChangeCallback
+ ): void
+ /** [wx.onAppHide(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onAppHide.html)
*
- * 监听小程序切后台事件。该事件与 [`App.onHide`](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onhide) 的回调时机一致。
+ * 需要基础库: `2.1.2`
*
- * 最低基础库: `2.1.2` */
+ * 在插件中使用:不支持
+ *
+ * 监听小程序切后台事件。该事件与 [`App.onHide`](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onhide) 的回调参数一致。 */
onAppHide(
- /** 小程序切后台事件的回调函数 */
- callback: OnAppHideCallback
+ /** 小程序切后台事件的监听函数 */
+ listener: OnAppHideCallback
): void
- /** [wx.onAppShow(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onAppShow.html)
+ /** [wx.onAppRoute(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-route/wx.onAppRoute.html)
+*
+* 需要基础库: `3.5.5`
+*
+* 在插件中使用:需要基础库 `3.5.5`
+*
+* 监听路由事件下发后,执行路由逻辑后的事件监听,详见 [页面路由监听](https://developers.weixin.qq.com/miniprogram/dev/framework/app-service/route-event-listener.html)。
+*
+* ****
+*
+* > Skyline 渲染引擎相关说明:[详情](https://developers.weixin.qq.com/miniprogram/dev/framework/runtime/skyline/introduction.html)
+* > xr-frame 解决方案相关说明:[详情](#)
+*
+* **注意**
+*
+* 在低于 3.5.5 版本的基础库中也存在此接口,但参数可能与当前文档不同,请注意。
+*
+* **示例代码**
+*
+* ```js
+const func = function (res) {
+ console.log(res)
+}
+wx.onAppRoute(func)
+// 取消监听
+wx.offAppRoute(func)
+``` */
+ onAppRoute(
+ /** 路由事件的监听函数 */
+ listener: OnAppRouteCallback
+ ): void
+ /** [wx.onAppRouteDone(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-route/wx.onAppRouteDone.html)
+*
+* 需要基础库: `3.5.5`
+*
+* 在插件中使用:需要基础库 `3.5.5`
+*
+* 监听当前路由动画执行完成的事件监听,详见 [页面路由监听](https://developers.weixin.qq.com/miniprogram/dev/framework/app-service/route-event-listener.html)。
+*
+* **注意**
+*
+* 在低于 3.5.5 版本的基础库中也存在此接口,但参数可能与当前文档不同,请注意。
+*
+* **示例代码**
+*
+* ```js
+const func = function (res) {
+ console.log(res)
+}
+wx.onAppRouteDone(func)
+// 取消监听
+wx.offAppRouteDone(func)
+``` */
+ onAppRouteDone(
+ /** 当前路由动画执行完成的事件的监听函数 */
+ listener: OnAppRouteDoneCallback
+ ): void
+ /** [wx.onAppShow(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onAppShow.html)
+ *
+ * 需要基础库: `2.1.2`
+ *
+ * 在插件中使用:不支持
*
* 监听小程序切前台事件。该事件与 [`App.onShow`](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onshowobject-object) 的回调参数一致。
*
* **返回有效 referrerInfo 的场景**
*
- *
* | 场景值 | 场景 | appId含义 |
* | ------ | ------------------------------- | ---------- |
* | 1020 | 公众号 profile 页相关小程序列表 | 来源公众号 |
@@ -14514,41 +27422,63 @@ wx.onAccelerometerChange(callback)
* | 1038 | 从另一个小程序返回 | 来源小程序 |
* | 1043 | 公众号模板消息 | 来源公众号 |
*
+ * **不同 apiCategory 场景下的 API 限制**
+ *
+ * `X` 表示 API 被限制无法使用;不在表格中的 API 不限制。
+ *
+ * | | default | nativeFunctionalized | browseOnly | embedded | chatTool |
+ * |-|-|-|-|-|--|
+ * |openSetting | | | `X` | | |
+ * |<button open-type="share"> | | `X` | `X` | `X` | `X` |
+ * |<button open-type="feedback"> | | | `X` | | |
+ * |<button open-type="open-setting">| | | `X` | | |
+ * |navigateToMiniProgram | | `X` | `X` | | `X` |
+ * |openEmbeddedMiniProgram | | `X` | `X` | `X` | `X` |
+ * |openOfficialAccountArticle | | | | | `X` |
+ * |openChannelsUserProfile | | | | | `X` |
+ * |ad | | | | | `X` |
+ * |ad-custom | | | | | `X` |
+ * |小程序菜单分享 | | | | | `X` |
+ *
* **注意**
*
- *
- * 部分版本在无`referrerInfo`的时候会返回 `undefined`,建议使用 `options.referrerInfo && options.referrerInfo.appId` 进行判断。
- *
- * 最低基础库: `2.1.2` */
+ * 部分版本在无`referrerInfo`的时候会返回 `undefined`,建议使用 `options.referrerInfo && options.referrerInfo.appId` 进行判断。 */
onAppShow(
- /** 小程序切前台事件的回调函数 */
- callback: OnAppShowCallback
+ /** 小程序切前台事件的监听函数 */
+ listener: OnAppShowCallback
): void
- /** [wx.onAudioInterruptionBegin(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onAudioInterruptionBegin.html)
+ /** [wx.onAudioInterruptionBegin(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onAudioInterruptionBegin.html)
*
- * 监听音频因为受到系统占用而被中断开始事件。以下场景会触发此事件:闹钟、电话、FaceTime 通话、微信语音聊天、微信视频聊天。此事件触发后,小程序内所有音频会暂停。
+ * 需要基础库: `2.6.2`
*
- * 最低基础库: `2.6.2` */
+ * 在插件中使用:需要基础库 `2.15.0`
+ *
+ * 监听音频因为受到系统占用而被中断开始事件。以下场景会触发此事件:闹钟、电话、FaceTime 通话、微信语音聊天、微信视频聊天、有声广告开始播放、实名认证页面弹出等。此事件触发后,小程序内所有音频会暂停。 */
onAudioInterruptionBegin(
- /** 音频因为受到系统占用而被中断开始事件的回调函数 */
- callback: OnAudioInterruptionBeginCallback
+ /** 音频因为受到系统占用而被中断开始事件的监听函数 */
+ listener: OnAudioInterruptionBeginCallback
): void
- /** [wx.onAudioInterruptionEnd(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onAudioInterruptionEnd.html)
+ /** [wx.onAudioInterruptionEnd(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onAudioInterruptionEnd.html)
*
- * 监听音频中断结束事件。在收到 onAudioInterruptionBegin 事件之后,小程序内所有音频会暂停,收到此事件之后才可再次播放成功
+ * 需要基础库: `2.6.2`
*
- * 最低基础库: `2.6.2` */
+ * 在插件中使用:需要基础库 `2.15.0`
+ *
+ * 监听音频中断结束事件。在收到 onAudioInterruptionBegin 事件之后,小程序内所有音频会暂停,收到此事件之后才可再次播放成功 */
onAudioInterruptionEnd(
- /** 音频中断结束事件的回调函数 */
- callback: OnAudioInterruptionEndCallback
+ /** 音频中断结束事件的监听函数 */
+ listener: OnAudioInterruptionEndCallback
): void
- /** [wx.onBLECharacteristicValueChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.onBLECharacteristicValueChange.html)
+ /** [wx.onBLECharacteristicValueChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.onBLECharacteristicValueChange.html)
*
-* 监听低功耗蓝牙设备的特征值变化事件。必须先启用 `notifyBLECharacteristicValueChange` 接口才能接收到设备推送的 notification。
+* 需要基础库: `1.1.0`
+*
+* 在插件中使用:需要基础库 `2.9.1`
+*
+* 监听蓝牙低功耗设备的特征值变化事件。必须先调用 [wx.notifyBLECharacteristicValueChange](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.notifyBLECharacteristicValueChange.html) 接口才能接收到设备推送的 notification。
*
* **示例代码**
*
-*
* [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
*
* ```js
@@ -14566,127 +27496,273 @@ wx.onBLECharacteristicValueChange(function(res) {
console.log(`characteristic ${res.characteristicId} has changed, now is ${res.value}`)
console.log(ab2hex(res.value))
})
-```
-*
-* 最低基础库: `1.1.0` */
+``` */
onBLECharacteristicValueChange(
- /** 低功耗蓝牙设备的特征值变化事件的回调函数 */
- callback: OnBLECharacteristicValueChangeCallback
+ /** 蓝牙低功耗设备的特征值变化事件的监听函数 */
+ listener: OnBLECharacteristicValueChangeCallback
): void
- /** [wx.onBLEConnectionStateChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.onBLEConnectionStateChange.html)
+ /** [wx.onBLEConnectionStateChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.onBLEConnectionStateChange.html)
*
-* 监听低功耗蓝牙连接状态的改变事件。包括开发者主动连接或断开连接,设备丢失,连接异常断开等等
+* 需要基础库: `1.1.0`
+*
+* 在插件中使用:需要基础库 `2.9.1`
+*
+* 监听蓝牙低功耗连接状态改变事件。包括开发者主动连接或断开连接,设备丢失,连接异常断开等等
*
* **示例代码**
*
-*
* [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
* ```js
wx.onBLEConnectionStateChange(function(res) {
// 该方法回调中可以用于处理连接意外断开等异常情况
console.log(`device ${res.deviceId} state has changed, connected: ${res.connected}`)
})
-```
-*
-* 最低基础库: `1.1.0` */
+``` */
onBLEConnectionStateChange(
- /** 低功耗蓝牙连接状态的改变事件的回调函数 */
- callback: OnBLEConnectionStateChangeCallback
+ /** 蓝牙低功耗连接状态改变事件的监听函数 */
+ listener: OnBLEConnectionStateChangeCallback
): void
- /** [wx.onBLEPeripheralConnectionStateChanged(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/wx.onBLEPeripheralConnectionStateChanged.html)
+ /** [wx.onBLEMTUChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.onBLEMTUChange.html)
+*
+* 需要基础库: `2.20.1`
+*
+* 在插件中使用:需要基础库 `2.20.1`
+*
+* 监听蓝牙低功耗的最大传输单元变化事件(仅安卓触发)。
+*
+* **示例代码**
+*
+* [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
+* ```js
+wx.onBLEMTUChange(function (res) {
+ console.log('bluetooth mtu is', res.mtu)
+})
+``` */
+ onBLEMTUChange(
+ /** 蓝牙低功耗的最大传输单元变化事件的监听函数 */
+ listener: OnBLEMTUChangeCallback
+ ): void
+ /** [wx.onBLEPeripheralConnectionStateChanged(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/wx.onBLEPeripheralConnectionStateChanged.html)
*
- * 监听当前外围设备被连接或断开连接事件
+ * 需要基础库: `2.10.3`
*
- * 最低基础库: `2.10.3` */
+ * 在插件中使用:需要基础库 `2.22.1`
+ *
+ * 监听当前外围设备被连接或断开连接事件 */
onBLEPeripheralConnectionStateChanged(
- /** 当前外围设备被连接或断开连接事件的回调函数 */
- callback: OnBLEPeripheralConnectionStateChangedCallback
+ /** 当前外围设备被连接或断开连接事件的监听函数 */
+ listener: OnBLEPeripheralConnectionStateChangedCallback
): void
- /** [wx.onBackgroundAudioPause(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.onBackgroundAudioPause.html)
+ /** [wx.onBackgroundAudioPause(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.onBackgroundAudioPause.html)
*
- * 监听音乐暂停事件。
+ * 在插件中使用:不支持
* @deprecated 基础库版本 [1.2.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [wx.getBackgroundAudioManager](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.getBackgroundAudioManager.html) 替换
- * */
+ *
+ * 监听音乐暂停事件。 */
onBackgroundAudioPause(
- /** 音乐暂停事件的回调函数 */
- callback: OnBackgroundAudioPauseCallback
+ /** 音乐暂停事件的监听函数 */
+ listener: OnBackgroundAudioPauseCallback
): void
- /** [wx.onBackgroundAudioPlay(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.onBackgroundAudioPlay.html)
+ /** [wx.onBackgroundAudioPlay(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.onBackgroundAudioPlay.html)
*
- * 监听音乐播放事件。
+ * 在插件中使用:不支持
* @deprecated 基础库版本 [1.2.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [wx.getBackgroundAudioManager](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.getBackgroundAudioManager.html) 替换
- * */
+ *
+ * 监听音乐播放事件。 */
onBackgroundAudioPlay(
- /** 音乐播放事件的回调函数 */
- callback: OnBackgroundAudioPlayCallback
+ /** 音乐播放事件的监听函数 */
+ listener: OnBackgroundAudioPlayCallback
): void
- /** [wx.onBackgroundAudioStop(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.onBackgroundAudioStop.html)
+ /** [wx.onBackgroundAudioStop(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.onBackgroundAudioStop.html)
*
- * 监听音乐停止事件。
+ * 在插件中使用:不支持
* @deprecated 基础库版本 [1.2.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [wx.getBackgroundAudioManager](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.getBackgroundAudioManager.html) 替换
- * */
+ *
+ * 监听音乐停止事件。 */
onBackgroundAudioStop(
- /** 音乐停止事件的回调函数 */
- callback: OnBackgroundAudioStopCallback
+ /** 音乐停止事件的监听函数 */
+ listener: OnBackgroundAudioStopCallback
): void
- /** [wx.onBackgroundFetchData(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/background-fetch/wx.onBackgroundFetchData.html)
+ /** [wx.onBackgroundFetchData(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/background-fetch/wx.onBackgroundFetchData.html)
*
- * 监听收到 backgroundFetch 数据时的回调
+ * 需要基础库: `2.8.0`
*
- * 最低基础库: `2.8.0` */
+ * 在插件中使用:不支持
+ *
+ * 监听收到 backgroundFetch 数据事件。如果监听时请求已经完成,则事件不会触发。建议和 [wx.getBackgroundFetchData](https://developers.weixin.qq.com/miniprogram/dev/api/storage/background-fetch/wx.getBackgroundFetchData.html) 配合使用 */
onBackgroundFetchData(
- /** 的回调函数 */
- callback: OnBackgroundFetchDataCallback
+ /** 收到 backgroundFetch 数据事件的监听函数 */
+ listener: OnBackgroundFetchDataCallback
): void
- /** [wx.onBeaconServiceChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.onBeaconServiceChange.html)
- *
- * 监听 iBeacon 服务状态变化事件,仅能注册一个监听
- *
- * 最低基础库: `1.2.0` */
+ /** [wx.onBatteryInfoChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/battery/wx.onBatteryInfoChange.html)
+*
+* 需要基础库: `3.5.0`
+*
+* 在插件中使用:不支持
+*
+* 监听电池信息变化事件,目前只支持监听省电模式的切换
+*
+* **示例代码**
+*
+* ```js
+const cb = res => {
+ console.log(res.isLowPowerModeEnabled)
+}
+wx.onBatteryInfoChange(cb)
+// 取消监听
+wx.offBatteryInfoChange(cb)
+``` */
+ onBatteryInfoChange(
+ /** 电池信息变化事件的监听函数 */
+ listener: OnBatteryInfoChangeCallback
+ ): void
+ /** [wx.onBeaconServiceChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.onBeaconServiceChange.html)
+*
+* 需要基础库: `1.2.0`
+*
+* 在插件中使用:需要基础库 `1.9.6`
+*
+* 监听 Beacon 服务状态变化事件,仅能注册一个监听
+*
+* **示例代码**
+*
+* ```js
+wx.onBeaconServiceChange(res => {
+ console.log(res.available, res.discovering)
+})
+``` */
onBeaconServiceChange(
- /** iBeacon 服务状态变化事件的回调函数 */
- callback: OnBeaconServiceChangeCallback
+ /** Beacon 服务状态变化事件的监听函数 */
+ listener: OnBeaconServiceChangeCallback
): void
- /** [wx.onBeaconUpdate(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.onBeaconUpdate.html)
- *
- * 监听 iBeacon 设备更新事件,仅能注册一个监听
- *
- * 最低基础库: `1.2.0` */
+ /** [wx.onBeaconUpdate(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.onBeaconUpdate.html)
+*
+* 需要基础库: `1.2.0`
+*
+* 在插件中使用:需要基础库 `1.9.6`
+*
+* 监听 Beacon 设备更新事件,仅能注册一个监听
+*
+* **示例代码**
+*
+* ```js
+wx.onBeaconUpdate(res => {
+ console.log(res.beacons)
+})
+``` */
onBeaconUpdate(
- /** iBeacon 设备更新事件的回调函数 */
- callback: OnBeaconUpdateCallback
+ /** Beacon 设备更新事件的监听函数 */
+ listener: OnBeaconUpdateCallback
): void
- /** [wx.onBluetoothAdapterStateChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.onBluetoothAdapterStateChange.html)
+ /** [wx.onBeforeAppRoute(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-route/wx.onBeforeAppRoute.html)
+*
+* 需要基础库: `3.5.5`
+*
+* 在插件中使用:需要基础库 `3.5.5`
+*
+* 监听路由事件下发后,执行路由逻辑前的事件监听,详见 [页面路由监听](https://developers.weixin.qq.com/miniprogram/dev/framework/app-service/route-event-listener.html)。
+*
+* ****
+*
+* > Skyline 渲染引擎相关说明:[详情](https://developers.weixin.qq.com/miniprogram/dev/framework/runtime/skyline/introduction.html)
+* > xr-frame 解决方案相关说明:[详情](#)
+*
+* **示例代码**
+*
+* ```js
+const func = function (res) {
+ console.log(res)
+}
+wx.onBeforeAppRoute(func)
+// 取消监听
+wx.offBeforeAppRoute(func)
+``` */
+ onBeforeAppRoute(
+ /** 路由事件的监听函数 */
+ listener: OnBeforeAppRouteCallback
+ ): void
+ /** [wx.onBeforePageLoad(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-route/wx.onBeforePageLoad.html)
+*
+* 需要基础库: `3.5.5`
+*
+* 在插件中使用:需要基础库 `3.5.5`
+*
+* 监听路由事件引起新的页面实例化时,页面实例化前的事件监听,详见 [页面路由监听](https://developers.weixin.qq.com/miniprogram/dev/framework/app-service/route-event-listener.html)。
+*
+* ****
+*
+* > 新旧版本小程序组件框架的说明详见:[glass-easel:新版微信小程序组件框架](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/glass-easel/introduction.html)
+*
+* **示例代码**
+*
+* ```js
+const func = function (res) {
+ console.log(res)
+}
+wx.onBeforePageLoad(func)
+// 取消监听
+wx.offBeforePageLoad(func)
+``` */
+ onBeforePageLoad(
+ /** 路由事件的监听函数 */
+ listener: OnBeforePageLoadCallback
+ ): void
+ /** [wx.onBeforePageUnload(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-route/wx.onBeforePageUnload.html)
+*
+* 需要基础库: `3.5.5`
+*
+* 在插件中使用:需要基础库 `3.5.5`
+*
+* 监听路由事件引起现有页面实例销毁时,页面实例销毁前的事件监听,详见 [页面路由监听](https://developers.weixin.qq.com/miniprogram/dev/framework/app-service/route-event-listener.html)。
+*
+* **示例代码**
+*
+* ```js
+const func = function (res) {
+ console.log(res)
+}
+wx.onBeforePageUnload(func)
+// 取消监听
+wx.offBeforePageUnload(func)
+``` */
+ onBeforePageUnload(
+ /** 路由事件的监听函数 */
+ listener: OnBeforePageUnloadCallback
+ ): void
+ /** [wx.onBluetoothAdapterStateChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.onBluetoothAdapterStateChange.html)
+*
+* 需要基础库: `1.1.0`
+*
+* 在插件中使用:需要基础库 `2.9.1`
*
* 监听蓝牙适配器状态变化事件
*
* **示例代码**
*
-*
* [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
* ```js
wx.onBluetoothAdapterStateChange(function (res) {
console.log('adapterState changed, now is', res)
})
-```
-*
-* 最低基础库: `1.1.0` */
+``` */
onBluetoothAdapterStateChange(
- /** 蓝牙适配器状态变化事件的回调函数 */
- callback: OnBluetoothAdapterStateChangeCallback
+ /** 蓝牙适配器状态变化事件的监听函数 */
+ listener: OnBluetoothAdapterStateChangeCallback
): void
- /** [wx.onBluetoothDeviceFound(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.onBluetoothDeviceFound.html)
+ /** [wx.onBluetoothDeviceFound(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.onBluetoothDeviceFound.html)
*
-* 监听寻找到新设备的事件
+* 需要基础库: `1.1.0`
+*
+* 在插件中使用:需要基础库 `2.9.1`
+*
+* 监听搜索到新设备的事件
*
* **注意**
*
-*
* - 若在 [wx.onBluetoothDeviceFound](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.onBluetoothDeviceFound.html) 回调了某个设备,则此设备会添加到 [wx.getBluetoothDevices](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.getBluetoothDevices.html) 接口获取到的数组中。
*
* **示例代码**
*
-*
* [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
*
* ```js
@@ -14710,21 +27786,20 @@ wx.onBluetoothDeviceFound(function(res) {
*
* **注意**
*
-*
-* - 安卓下部分机型需要有位置权限才能搜索到设备,需留意是否开启了位置权限
-*
-* 最低基础库: `1.1.0` */
+* - 蓝牙设备在被搜索到时,系统返回的 `name` 字段一般为广播包中的 `LocalName` 字段中的设备名称,而如果与蓝牙设备建立连接,系统返回的 `name` 字段会改为从蓝牙设备上获取到的 `GattName`。若需要动态改变设备名称并展示,建议使用 `localName` 字段。
+* - 安卓下部分机型需要有位置权限才能搜索到设备,需留意是否开启了位置权限 */
onBluetoothDeviceFound(
- /** 寻找到新设备的事件的回调函数 */
- callback: OnBluetoothDeviceFoundCallback
+ /** 搜索到新设备的事件的监听函数 */
+ listener: OnBluetoothDeviceFoundCallback
): void
- /** [wx.onCompassChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/compass/wx.onCompassChange.html)
+ /** [wx.onCompassChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/compass/wx.onCompassChange.html)
+ *
+ * 在插件中使用:不支持
*
* 监听罗盘数据变化事件。频率:5 次/秒,接口调用后会自动开始监听,可使用 wx.stopCompass 停止监听。
*
* **accuracy 在 iOS/Android 的差异**
*
- *
* 由于平台差异,accuracy 在 iOS/Android 的值不同。
*
* - iOS:accuracy 是一个 number 类型的值,表示相对于磁北极的偏差。0 表示设备指向磁北,90 表示指向东,180 表示指向南,依此类推。
@@ -14739,120 +27814,288 @@ wx.onBluetoothDeviceFound(function(res) {
* | unreliable | 不可信,原因未知 |
* | unknow ${value} | 未知的精度枚举值,即该 Android 系统此时返回的表示精度的 value 不是一个标准的精度枚举值 | */
onCompassChange(
- /** 罗盘数据变化事件的回调函数 */
- callback: OnCompassChangeCallback
+ /** 罗盘数据变化事件的监听函数 */
+ listener: OnCompassChangeCallback
): void
- /** [wx.onCopyUrl(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.onCopyUrl.html)
+ /** [wx.onCopyUrl(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.onCopyUrl.html)
*
- * 监听用户点击右上角菜单的「复制链接」按钮时触发的事件。本接口为 Beta 版本,暂只在 Android 平台支持。
+ * 需要基础库: `2.14.3`
*
- * 最低基础库: `2.14.3` */
+ * 在插件中使用:不支持
+ *
+ * 监听用户点击右上角菜单的「复制链接」按钮时触发的事件。 */
onCopyUrl(
- /** 用户点击右上角菜单的「复制链接」按钮时触发的事件的回调函数 */
- callback: OnCopyUrlCallback
+ /** 用户点击右上角菜单的「复制链接」按钮时触发的事件的监听函数 */
+ listener: OnCopyUrlCallback
): void
- /** [wx.onDeviceMotionChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/motion/wx.onDeviceMotionChange.html)
+ /** [wx.onDeviceMotionChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/motion/wx.onDeviceMotionChange.html)
*
- * 监听设备方向变化事件。频率根据 [wx.startDeviceMotionListening()](https://developers.weixin.qq.com/miniprogram/dev/api/device/motion/wx.startDeviceMotionListening.html) 的 interval 参数。可以使用 [wx.stopDeviceMotionListening()](https://developers.weixin.qq.com/miniprogram/dev/api/device/motion/wx.stopDeviceMotionListening.html) 停止监听。
+ * 需要基础库: `2.3.0`
*
- * 最低基础库: `2.3.0` */
+ * 在插件中使用:不支持
+ *
+ * 监听设备方向变化事件。频率根据 [wx.startDeviceMotionListening()](https://developers.weixin.qq.com/miniprogram/dev/api/device/motion/wx.startDeviceMotionListening.html) 的 interval 参数。可以使用 [wx.stopDeviceMotionListening()](https://developers.weixin.qq.com/miniprogram/dev/api/device/motion/wx.stopDeviceMotionListening.html) 停止监听。 */
onDeviceMotionChange(
- /** 设备方向变化事件的回调函数 */
- callback: OnDeviceMotionChangeCallback
+ /** 设备方向变化事件的监听函数 */
+ listener: OnDeviceMotionChangeCallback
): void
- /** [wx.onError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onError.html)
- *
- * 监听小程序错误事件。如脚本错误或 API 调用报错等。该事件与 [`App.onError`](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onerrorstring-error) 的回调时机与参数一致。
- *
- * 最低基础库: `2.1.2` */
- onError(
- /** 小程序错误事件的回调函数 */
- callback: OnAppErrorCallback
- ): void
- /** [wx.onGetWifiList(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.onGetWifiList.html)
- *
- * 监听获取到 Wi-Fi 列表数据事件
- *
- * 最低基础库: `1.6.0` */
- onGetWifiList(
- /** 获取到 Wi-Fi 列表数据事件的回调函数 */
- callback: OnGetWifiListCallback
- ): void
- /** [wx.onGyroscopeChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/gyroscope/wx.onGyroscopeChange.html)
- *
- * 监听陀螺仪数据变化事件。频率根据 [wx.startGyroscope()](https://developers.weixin.qq.com/miniprogram/dev/api/device/gyroscope/wx.startGyroscope.html) 的 interval 参数。可以使用 [wx.stopGyroscope()](https://developers.weixin.qq.com/miniprogram/dev/api/device/gyroscope/wx.stopGyroscope.html) 停止监听。
- *
- * 最低基础库: `2.3.0` */
- onGyroscopeChange(
- /** 陀螺仪数据变化事件的回调函数 */
- callback: OnGyroscopeChangeCallback
- ): void
- /** [wx.onHCEMessage(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/wx.onHCEMessage.html)
- *
- * 监听接收 NFC 设备消息事件,仅能注册一个监听
- *
- * 最低基础库: `1.7.0` */
- onHCEMessage(
- /** 接收 NFC 设备消息事件的回调函数 */
- callback: OnHCEMessageCallback
- ): void
- /** [wx.onKeyboardHeightChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/keyboard/wx.onKeyboardHeightChange.html)
+ /** [wx.onEmbeddedMiniProgramHeightChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/navigate/wx.onEmbeddedMiniProgramHeightChange.html)
*
-* 监听键盘高度变化
+* 需要基础库: `2.33.0`
+*
+* 在插件中使用:不支持
+*
+* 监听半屏小程序可视高度变化事件
*
* **示例代码**
*
+* ```js
+const func = function (res) {
+ console.log(res.height)
+ console.log(res.initialHeight)
+}
+wx.onEmbeddedMiniProgramHeightChange(func)
+// 取消监听
+wx.offEmbeddedMiniProgramHeightChange(func)
+``` */
+ onEmbeddedMiniProgramHeightChange(
+ /** 半屏小程序可视高度变化事件的监听函数 */
+ listener: OnEmbeddedMiniProgramHeightChangeCallback
+ ): void
+ /** [wx.onError(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onError.html)
+ *
+ * 需要基础库: `2.1.2`
+ *
+ * 在插件中使用:不支持
+ *
+ * 监听小程序错误事件。如脚本错误或 API 调用报错等。该事件与 [`App.onError`](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onerrorstring-error) 的回调时机与参数一致。 */
+ onError(
+ /** 小程序错误事件的监听函数 */
+ listener: WxOnErrorCallback
+ ): void
+ /** [wx.onGeneratePoster(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.onGeneratePoster.html)
+*
+* 需要基础库: `3.12.0`
+*
+* 在插件中使用:不支持
+*
+* 监听用户截屏之后需要开发者生成自定义海报事件,在点击转发截图按钮时触发。只能注册一个监听函数,重复调用会覆盖上一个监听函数
+*
+* **示例代码**
+*
+* ```js
+wx.onGeneratePoster(function () {
+ console.log('需要开发者生成自定义海报')
+ return {
+ src: 'images/a.jpg',
+ promise: new Promise((resolve) => { // 通过promise延时传递小程序的query参数
+ setTimeout(() => {
+ resolve({
+ src: 'images/a.jpg',
+ })
+ }, 1000) // 在1秒内对query进行解析
+ })
+ }
+})
+``` */
+ onGeneratePoster(
+ /** 用户截屏之后需要开发者生成自定义海报事件的监听函数 */
+ listener: OnGeneratePosterCallback
+ ): void
+ /** [wx.onGetWifiList(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.onGetWifiList.html)
+ *
+ * 需要基础库: `1.6.0`
+ *
+ * 在插件中使用:需要基础库 `2.9.1`
+ *
+ * 监听获取到 Wi-Fi 列表数据事件 */
+ onGetWifiList(
+ /** 获取到 Wi-Fi 列表数据事件的监听函数 */
+ listener: OnGetWifiListCallback
+ ): void
+ /** [wx.onGyroscopeChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/gyroscope/wx.onGyroscopeChange.html)
+ *
+ * 需要基础库: `2.3.0`
+ *
+ * 在插件中使用:需要基础库 `2.9.1`
+ *
+ * 监听陀螺仪数据变化事件。频率根据 [wx.startGyroscope()](https://developers.weixin.qq.com/miniprogram/dev/api/device/gyroscope/wx.startGyroscope.html) 的 interval 参数。可以使用 [wx.stopGyroscope()](https://developers.weixin.qq.com/miniprogram/dev/api/device/gyroscope/wx.stopGyroscope.html) 停止监听。 */
+ onGyroscopeChange(
+ /** 陀螺仪数据变化事件的监听函数 */
+ listener: OnGyroscopeChangeCallback
+ ): void
+ /** [wx.onHCEMessage(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc-hce/wx.onHCEMessage.html)
+ *
+ * 需要基础库: `1.7.0`
+ *
+ * 在插件中使用:需要基础库 `2.9.1`
+ *
+ * 监听接收 NFC 设备消息事件。仅能注册一个监听 */
+ onHCEMessage(
+ /** 接收 NFC 设备消息事件的监听函数 */
+ listener: OnHCEMessageCallback
+ ): void
+ /** [wx.onKeyDown(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/keyboard/wx.onKeyDown.html)
+ *
+ * 需要基础库: `3.6.0`
+ *
+ * 在插件中使用:不支持
+ *
+ * 监听小程序全局键盘按键按下事件。仅适用于 PC 平台
+ *
+ * **注意事项**
+ *
+ * 1. 必须在小程序窗口处于前台且曾有过用户操作(例如点击等)后才会触发。
+ * 2. 如某个快捷键组合已经被系统定义(例如 alt+F4、全屏时按 esc 退出等),则会优先响应系统操作,是否发送此事件取决于系统规则。
+ * 3. 如当前焦点正聚焦在 `input`、`textarea`、`editor` 组件,则不会发送此事件。
+ * 4. 如当前焦点在 webview 组件中,则不会发送此事件。 */
+ onKeyDown(
+ /** 小程序全局键盘按键按下事件的监听函数 */
+ listener: OnKeyDownCallback
+ ): void
+ /** [wx.onKeyUp(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/keyboard/wx.onKeyUp.html)
+ *
+ * 需要基础库: `3.6.0`
+ *
+ * 在插件中使用:不支持
+ *
+ * 监听小程序全局键盘按键弹起事件。仅适用于 PC 平台
+ *
+ * **注意事项**
+ *
+ * 1. 必须在小程序窗口处于前台且曾有过用户操作(例如点击等)后才会触发。
+ * 2. 如某个快捷键组合已经被系统定义(例如 alt+F4、全屏时按 esc 退出等),则会优先响应系统操作,是否发送此事件取决于系统规则。
+ * 3. 如当前焦点正聚焦在 `input`、`textarea`、`editor` 组件,则不会发送此事件。
+ * 4. 如当前焦点在 webview 组件中,则不会发送此事件。 */
+ onKeyUp(
+ /** 小程序全局键盘按键弹起事件的监听函数 */
+ listener: OnKeyUpCallback
+ ): void
+ /** [wx.onKeyboardHeightChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/keyboard/wx.onKeyboardHeightChange.html)
+*
+* 需要基础库: `2.7.0`
+*
+* 在插件中使用:不支持
+*
+* 监听键盘高度变化事件
+*
+* **示例代码**
*
* ```js
wx.onKeyboardHeightChange(res => {
console.log(res.height)
})
-```
-*
-* 最低基础库: `2.7.0` */
- onKeyboardHeightChange(callback: OnKeyboardHeightChangeCallback): void
- /** [wx.onLocalServiceDiscoveryStop(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/mdns/wx.onLocalServiceDiscoveryStop.html)
+``` */
+ onKeyboardHeightChange(
+ /** 键盘高度变化事件的监听函数 */
+ listener: OnKeyboardHeightChangeCallback
+ ): void
+ /** [wx.onLazyLoadError(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onLazyLoadError.html)
*
- * 监听 mDNS 服务停止搜索的事件
+ * 需要基础库: `2.24.3`
*
- * 最低基础库: `2.4.0` */
+ * 在插件中使用:不支持
+ *
+ * 监听小程序异步组件加载失败事件。
+ *
+ * **注意**
+ *
+ * - 加载异步组件通常需要下载分包,若分包下载超时,则会触发 errMsg 为 "loadSubpackage: timeout" 的回调,默认超时等待时间为 10 秒。
+ * - 可以通过第二个参数指定超时时间(单位:ms),该设置全局有效,多次指定超时时间则覆盖前面。
+ * - 分包确认下载失败时,会再次触发 errMsg 为 "loadSubpackage: fail" 的回调。
+ * - 若在页面中使用该接口进行监听,请确保在必要时手动调用 offLazyLoadError 取消监听,以避免非预期的内存泄漏。 */
+ onLazyLoadError(
+ /** 小程序异步组件加载失败事件的监听函数 */
+ listener: OnLazyLoadErrorCallback
+ ): void
+ /** [wx.onLocalServiceDiscoveryStop(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/mdns/wx.onLocalServiceDiscoveryStop.html)
+ *
+ * 需要基础库: `2.4.0`
+ *
+ * 在插件中使用:需要基础库 `2.15.0`
+ *
+ * 监听 mDNS 服务停止搜索的事件 */
onLocalServiceDiscoveryStop(
- /** mDNS 服务停止搜索的事件的回调函数 */
- callback: OnLocalServiceDiscoveryStopCallback
+ /** mDNS 服务停止搜索的事件的监听函数 */
+ listener: OnLocalServiceDiscoveryStopCallback
): void
- /** [wx.onLocalServiceFound(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/mdns/wx.onLocalServiceFound.html)
+ /** [wx.onLocalServiceFound(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/mdns/wx.onLocalServiceFound.html)
*
- * 监听 mDNS 服务发现的事件
+ * 需要基础库: `2.4.0`
*
- * 最低基础库: `2.4.0` */
+ * 在插件中使用:需要基础库 `2.15.0`
+ *
+ * 监听 mDNS 服务发现的事件 */
onLocalServiceFound(
- /** mDNS 服务发现的事件的回调函数 */
- callback: OnLocalServiceFoundCallback
+ /** mDNS 服务发现的事件的监听函数 */
+ listener: OnLocalServiceFoundCallback
): void
- /** [wx.onLocalServiceLost(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/mdns/wx.onLocalServiceLost.html)
+ /** [wx.onLocalServiceLost(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/mdns/wx.onLocalServiceLost.html)
*
- * 监听 mDNS 服务离开的事件
+ * 需要基础库: `2.4.0`
*
- * 最低基础库: `2.4.0` */
+ * 在插件中使用:需要基础库 `2.15.0`
+ *
+ * 监听 mDNS 服务离开的事件 */
onLocalServiceLost(
- /** mDNS 服务离开的事件的回调函数 */
- callback: OnLocalServiceLostCallback
+ /** mDNS 服务离开的事件的监听函数 */
+ listener: OnLocalServiceLostCallback
): void
- /** [wx.onLocalServiceResolveFail(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/mdns/wx.onLocalServiceResolveFail.html)
+ /** [wx.onLocalServiceResolveFail(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/mdns/wx.onLocalServiceResolveFail.html)
*
- * 监听 mDNS 服务解析失败的事件
+ * 需要基础库: `2.4.0`
*
- * 最低基础库: `2.4.0` */
+ * 在插件中使用:需要基础库 `2.15.0`
+ *
+ * 监听 mDNS 服务解析失败的事件 */
onLocalServiceResolveFail(
- /** mDNS 服务解析失败的事件的回调函数 */
- callback: OnLocalServiceResolveFailCallback
+ /** mDNS 服务解析失败的事件的监听函数 */
+ listener: OnLocalServiceResolveFailCallback
): void
- /** [wx.onLocationChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.onLocationChange.html)
+ /** [wx.onLocationChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.onLocationChange.html)
+*
+* 需要基础库: `2.8.1`
+*
+* 在插件中使用:不支持
*
* 监听实时地理位置变化事件,需结合 [wx.startLocationUpdateBackground](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.startLocationUpdateBackground.html)、[wx.startLocationUpdate](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.startLocationUpdate.html)使用。
*
-* **示例代码**
+* ## 使用方法
+* 自 2022 年 7 月 14 日后发布的小程序,若使用该接口,需要在 app.json 中进行声明,否则将无法正常使用该接口,2022年7月14日前发布的小程序不受影响。[具体规则见公告](https://developers.weixin.qq.com/community/develop/doc/000a02f2c5026891650e7f40351c01)
*
+* ## 申请开通
+* 暂只针对如下类目的小程序开放,需要先通过类目审核,再在小程序管理后台,「开发」-「开发管理」-「接口设置」中自助开通该接口权限。
+* 接口权限申请入口将于2022年3月11日开始内测,于3月31日全量上线。并从4月18日开始,在代码审核环节将检测该接口是否已完成开通,如未开通,将在代码提审环节进行拦截。
+*
+* ### 国内主体开放类目
+*
+* | 一级类目/主体类型 | 二级类目 | 应用场景 |
+* | -------------- | -------| -------- |
+* | 电商平台 | / | 售卖商品线下发货、收货、送货服务 |
+* | 商家自营 | / | 提供售卖商品线下发货、收货、送货服务、线下商超导览、导航服务 |
+* | 医疗服务 | 公立医疗机构、三级私立医疗机构、其他私立医疗机构、就医服务、其他医学健康服务、药品(非处方药)销售、非处方药销售平台、医疗器械生产企业、医疗器械自营、医疗器械经营销售平台、互联网医院血液、干细胞服务、临床试验 | 1、实际物品/药品接收服务 2、基于地理位置取号并现场报到、附近医院导航等服务 |
+* | 交通服务 | / | 代驾服务、租车网点导航等相关服务 |
+* | 生活服务 | / | 上门服务作业等线下场景 |
+* | 物流服务 | 收件/派件、查件、邮政、装卸搬运、快递柜、货物运输 | 快递/货物收发服务 |
+* | 餐饮服务 | 点餐平台、外卖平台 | 线下送餐服务 |
+* | 工具 | 天气、信息查询 | 与地理位置相关的服务,比如潮汐查询、海拔查询、天气查询等 |
+* | 金融 | 保险 | 提供线下网点预约、基于地理位置取号并现场报到、附近网点导航等服务 |
+* | 旅游 | 景区服务 | 提供景区导航、导览服务 |
+* | 政务民生 | / | 提供政务单位相关业务 |
+* | 政府主体账号 | / | 提供政务单位相关业务 |
+*
+* ### 海外主体开放类目
+* | 一级类目/主体类型 | 二级类目 | 应用场景 |
+* | -------------- | -------| -------- |
+* | 出行与交通 | / | 代驾服务、租车网点导航等相关服务 |
+* | 快递业与邮政 | / | 快递/货物收发服务 |
+* | 餐饮 | 外卖点餐 | 线下送餐服务 |
+* | 出行与交通 | / | 代驾服务、租车网点导航等相关服务 |
+* | 跨境电商 | / | 提供售卖商品线下发货、收货服务、线下商超导览、导航服务 |
+* | 本地服务 | 电商平台、服装/鞋/箱包、玩具、家电/数码/手机、美妆/洗护、珠宝/饰品/眼镜/钟表、运动/户外/乐器、鲜花/园艺/工艺品、家居/家饰/家纺、办公/文具、机械/电子器件、酒、食品、百货/超市/便利店、宠物食品/用品 | 提供售卖商品线下发货、线下收货服务、线下商超导览、导航服务 |
+* | 生活服务 | 家政、外送 | 上门服务作业等线下场景 |
+*
+* **示例代码**
*
* ```js
const _locationChangeFn = function(res) {
@@ -14860,204 +28103,521 @@ wx.onKeyboardHeightChange(res => {
}
wx.onLocationChange(_locationChangeFn)
wx.offLocationChange(_locationChangeFn)
+``` */
+ onLocationChange(
+ /** 实时地理位置变化事件的监听函数 */
+ listener: OnLocationChangeCallback
+ ): void
+ /** [wx.onLocationChangeError(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.onLocationChangeError.html)
+ *
+ * 需要基础库: `2.19.5`
+ *
+ * 在插件中使用:不支持
+ *
+ * 监听持续定位接口返回失败时触发。 */
+ onLocationChangeError(
+ /** 的监听函数 */
+ listener: OnLocationChangeErrorCallback
+ ): void
+ /** [wx.onMemoryWarning(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/memory/wx.onMemoryWarning.html)
+*
+* 需要基础库: `2.0.2`
+*
+* 在插件中使用:不支持
+*
+* 监听内存不足告警事件。
+*
+* 当 iOS/Android 向小程序进程发出内存警告时,触发该事件。触发该事件不意味小程序被杀,大部分情况下仅仅是告警,开发者可在收到通知后回收一些不必要资源避免进一步加剧内存紧张。
+*
+* **示例代码**
+*
+* ```js
+wx.onMemoryWarning(function () {
+ console.log('onMemoryWarningReceive')
+})
+``` */
+ onMemoryWarning(
+ /** 内存不足告警事件的监听函数 */
+ listener: OnMemoryWarningCallback
+ ): void
+ /** [wx.onMenuButtonBoundingClientRectWeightChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/menu/wx.onMenuButtonBoundingClientRectWeightChange.html)
+*
+* 需要基础库: `3.4.3`
+*
+* 在插件中使用:不支持
+*
+* 监听菜单按钮(右上角胶囊按钮)的布局位置信息变化事件
+*
+* **示例代码**
+*
+* ```js
+const callback = res => console.log('menuButtonBoundingClientRectWeightChange', res)
+
+wx.onMenuButtonBoundingClientRectWeightChange(callback)
+// 取消监听
+wx.offMenuButtonBoundingClientRectWeightChange(callback)
+``` */
+ onMenuButtonBoundingClientRectWeightChange(
+ /** 菜单按钮(右上角胶囊按钮)的布局位置信息变化事件的监听函数 */
+ listener: OnMenuButtonBoundingClientRectWeightChangeCallback
+ ): void
+ /** [wx.onNeedPrivacyAuthorization(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/privacy/wx.onNeedPrivacyAuthorization.html)
+*
+* 需要基础库: `2.32.3`
+*
+* 在插件中使用:不支持
+*
+* 监听隐私接口需要用户授权事件。当需要用户进行隐私授权时会触发。触发该事件时,开发者需要弹出隐私协议说明,并在用户同意或拒绝授权后调用回调接口 resolve 触发原隐私接口或组件继续执行。隐私合规开发指南详情可见[《小程序隐私协议开发指南》](https://developers.weixin.qq.com/miniprogram/dev/framework/user-privacy/PrivacyAuthorize.html)
+*
+* ****
+*
+* ## 回调参数
+*
+* ### function resolve
+*
+* resolve 是 onNeedPrivacyAuthorization 的首个回调参数,是一个接口函数。
+*
+* 当触发 onNeedPrivacyAuthorization 事件时,触发该事件的隐私接口或组件会处于 pending 状态。
+*
+* 如果调用 resolve({ buttonId: 'agree-btn', event:'agree' }),则触发当前 onNeedPrivacyAuthorization 事件的原隐私接口或组件会继续执行。其中 buttonId 为隐私同意授权按钮的id,为确保用户有同意的操作,基础库会检查对应的同意按钮是否被点击过。(Tips: 需要在`` 组件的 bindagreeprivacyauthorization 事件触发后再调用 `resolve({ buttonId: 'agree-btn', event:'agree' })`)
+*
+* 如果调用 resolve({ event: 'disagree' }),则触发当前 onNeedPrivacyAuthorization 事件的原隐私接口或组件会失败并返回 `API:fail privacy permission is not authorized` 的错误信息。
+*
+* 在调用 resolve({ event: 'agree'/'disagree' }) 之前,开发者可以调用 resolve({ event: 'exposureAuthorization' }) 把隐私弹窗曝光告知平台。
+*
+* ### Object eventInfo
+*
+* eventInfo 是 onNeedPrivacyAuthorization 的第二个回调参数,表示触发本次 onNeedPrivacyAuthorization 事件的关联信息
+*
+* | 属性 | 类型 | 说明 |
+* | ---- | ---- | ---- |
+* | referrer | string | 触发本次 onNeedPrivacyAuthorization 事件的接口或组件名(例如:"getUserProfile", "button.getPhoneNumber") |
+*
+* ****
+*
+* ## resolve 接口参数
+*
+* | 属性 | 类型 | 是否必填 | 说明 |
+* | ---- | ---- | ---- | ---- |
+* | event | string | 是 | 用户操作类型 |
+* | buttonId | string | 是 | 同意授权按钮的id (仅event=agree时必填) |
+*
+* ### event 合法值
+*
+* | event | 说明 |
+* | ---- | ---- |
+* | exposureAuthorization | 自定义隐私弹窗曝光 |
+* | agree | 用户同意隐私授权 |
+* | disagree | 用户拒绝隐私授权 |
+*
+* ****
+*
+* ## 具体说明:
+*
+* - 1. 什么时候会触发 onNeedPrivacyAuthorization 事件?
+* - 1. 调用隐私相关接口(比如 wx.getUserProfile、wx.getClipboardData)和组件(比如 ` `),并且用户还未同意过隐私协议时
+* - 2. 调用 wx.requirePrivacyAuthorize 接口来模拟隐私接口调用,并且用户还未同意过隐私协议时
+* - 3. 如果用户已经同意过隐私协议,则不会再触发 onNeedPrivacyAuthorization 事件
+* - 2. 当触发 onNeedPrivacyAuthorization 事件时,触发该事件的隐私接口或组件会处于 pending 状态,等待用户授权后才会继续执行,此时开发者需要弹出自定义隐私弹窗,并在用户点击同意/拒绝后调用回调接口 resolve ,触发该事件的隐私接口或组件才会继续执行。
+* - 3. wx.onNeedPrivacyAuthorization 是覆盖式注册监听,若重复注册监听,则只有最后一次注册会生效。
+* - 4. 一定要注册 wx.onNeedPrivacyAuthorization 监听以及调用 resolve 吗?
+* - 1. 不是的,如果能保证在调用隐私接口之前,用户已经轻触过了 `` 按钮,那就不需要 wx.onNeedPrivacyAuthorization。
+* - 2. 但如果注册了 wx.onNeedPrivacyAuthorization 监听,则一定要调用 resolve 接口。
+*
+* **示例代码**
+*
+* ```html
+* // page.wxml
+*
+* 隐私弹窗内容....
+* 同意
+*
+* ```
+* ```js
+// page.js
+Page({
+ data: {
+ showPrivacy: false
+ },
+ onLoad() {
+ wx.onNeedPrivacyAuthorization((resolve, eventInfo) => {
+ console.log('触发本次事件的接口是:' + eventInfo.referrer)
+ // 需要用户同意隐私授权时
+ // 弹出开发者自定义的隐私授权弹窗
+ this.setData({
+ showPrivacy: true
+ })
+ this.resolvePrivacyAuthorization = resolve
+ })
+
+ wx.getUserProfile({
+ success: console.log,
+ fail: console.error
+ })
+ },
+ handleAgreePrivacyAuthorization() {
+ // 用户点击同意按钮后
+ this.resolvePrivacyAuthorization({ buttonId: 'agree-btn', event: 'agree' })
+ // 用户点击同意后,开发者调用 resolve({ buttonId: 'agree-btn', event: 'agree' }) 告知平台用户已经同意,参数传同意按钮的id。为确保用户有同意的操作,基础库在 resolve 被调用后,会去检查对应的同意按钮有没有被点击过。检查通过后,相关隐私接口会继续调用
+ // 用户点击拒绝后,开发者调用 resolve({ event:'disagree' }) 告知平台用户已经拒绝
+ }
+})
```
*
-* 最低基础库: `2.8.1` */
- onLocationChange(
- /** 实时地理位置变化事件的回调函数 */
- callback: OnLocationChangeCallback
+* **完整示例demo**
+*
+* demo1: 演示使用 `wx.getPrivacySetting` 和 `` 在首页处理隐私弹窗逻辑
+* [https://developers.weixin.qq.com/s/gi71sGm67hK0](https://developers.weixin.qq.com/s/gi71sGm67hK0)
+*
+* demo2: 演示使用 `wx.onNeedPrivacyAuthorization` 和 `` 在多个页面处理隐私弹窗逻辑,同时演示了如何处理多个隐私接口同时调用。
+* [https://developers.weixin.qq.com/s/hndZUOmA7gKn](https://developers.weixin.qq.com/s/hndZUOmA7gKn)
+*
+* demo3: 演示 `wx.onNeedPrivacyAuthorization`、`wx.requirePrivacyAuthorize`、`` 和 ` ` 组件如何结合使用
+* [https://developers.weixin.qq.com/s/jX7xWGmA7UKa](https://developers.weixin.qq.com/s/jX7xWGmA7UKa)
+*
+* demo4: 演示使用 `wx.onNeedPrivacyAuthorization` 和 `` 在多个 tabBar 页面处理隐私弹窗逻辑。
+* [https://developers.weixin.qq.com/s/g6BWZGmt7XK9](https://developers.weixin.qq.com/s/g6BWZGmt7XK9) */
+ onNeedPrivacyAuthorization(
+ /** 隐私接口需要用户授权事件的监听函数 */
+ listener: OnNeedPrivacyAuthorizationCallback
): void
- /** [wx.onMemoryWarning(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/performance/wx.onMemoryWarning.html)
- *
- * 监听内存不足告警事件。
- *
- * 当 iOS/Android 向小程序进程发出内存警告时,触发该事件。触发该事件不意味小程序被杀,大部分情况下仅仅是告警,开发者可在收到通知后回收一些不必要资源避免进一步加剧内存紧张。
- *
- * **示例代码**
- *
- *
- * ```js
- * wx.onMemoryWarning(function () {
- * console.log('onMemoryWarningReceive')
- * })
- * ``
- *
- * 最低基础库: `2.0.2` */
- onMemoryWarning(
- /** 内存不足告警事件的回调函数 */
- callback: OnMemoryWarningCallback
- ): void
- /** [wx.onNetworkStatusChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/network/wx.onNetworkStatusChange.html)
+ /** [wx.onNetworkStatusChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/network/wx.onNetworkStatusChange.html)
+*
+* 需要基础库: `1.1.0`
+*
+* 在插件中使用:支持
*
* 监听网络状态变化事件
*
* **示例代码**
*
-*
* ```js
wx.onNetworkStatusChange(function (res) {
console.log(res.isConnected)
console.log(res.networkType)
})
-```
-*
-* 最低基础库: `1.1.0` */
+``` */
onNetworkStatusChange(
- /** 网络状态变化事件的回调函数 */
- callback: OnNetworkStatusChangeCallback
+ /** 网络状态变化事件的监听函数 */
+ listener: OnNetworkStatusChangeCallback
): void
- /** [wx.onPageNotFound(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onPageNotFound.html)
+ /** [wx.onNetworkWeakChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/network/wx.onNetworkWeakChange.html)
+*
+* 需要基础库: `2.21.0`
+*
+* 在插件中使用:不支持
+*
+* 监听弱网状态变化事件
+*
+* **示例代码**
+*
+* ```js
+wx.onNetworkWeakChange(function (res) {
+ console.log(res.weakNet)
+ console.log(res.networkType)
+})
+// 取消监听
+wx.offNetworkWeakChange()
+``` */
+ onNetworkWeakChange(
+ /** 弱网状态变化事件的监听函数 */
+ listener: OnNetworkWeakChangeCallback
+ ): void
+ /** [wx.onOnUserTriggerTranslation(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/menu/wx.onOnUserTriggerTranslation.html)
+*
+* 需要基础库: `3.7.9`
+*
+* 在插件中使用:不支持
+*
+* 监听用户触发小程序菜单中翻译功能的事件
+*
+* **示例代码**
+*
+* ```js
+const callback = res => console.log('userTriggerTranslation', res)
+
+wx.onUserTriggerTranslation(callback)
+// 取消监听
+wx.offUserTriggerTranslation(callback)
+``` */
+ onOnUserTriggerTranslation(
+ /** 用户触发小程序菜单中翻译功能的事件的监听函数 */
+ listener: OnOnUserTriggerTranslationCallback
+ ): void
+ /** [wx.onPageNotFound(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onPageNotFound.html)
+ *
+ * 需要基础库: `2.1.2`
+ *
+ * 在插件中使用:不支持
*
* 监听小程序要打开的页面不存在事件。该事件与 [`App.onPageNotFound`](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onpagenotfoundobject-object) 的回调时机一致。
*
* **注意**
*
- *
* - 开发者可以在回调中进行页面重定向,但必须在回调中**同步**处理,异步处理(例如 `setTimeout` 异步执行)无效。
* - 若开发者没有调用 [wx.onPageNotFound](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onPageNotFound.html) 绑定监听,也没有声明 `App.onPageNotFound`,当跳转页面不存在时,将推入微信客户端原生的页面不存在提示页面。
- * - 如果回调中又重定向到另一个不存在的页面,将推入微信客户端原生的页面不存在提示页面,并且不再第二次回调。
- *
- * 最低基础库: `2.1.2` */
+ * - 如果回调中又重定向到另一个不存在的页面,将推入微信客户端原生的页面不存在提示页面,并且不再第二次回调。 */
onPageNotFound(
- /** 小程序要打开的页面不存在事件的回调函数 */
- callback: OnPageNotFoundCallback
+ /** 小程序要打开的页面不存在事件的监听函数 */
+ listener: OnPageNotFoundCallback
): void
- /** [wx.onSocketClose(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/wx.onSocketClose.html)
+ /** [wx.onParallelStateChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/window/wx.onParallelStateChange.html)
*
- * 监听 WebSocket 连接关闭事件 */
+ * 需要基础库: `3.12.1`
+ *
+ * 在插件中使用:不支持
+ *
+ * 监听小程序分栏状态变化事件。仅适用于 PC 平台 */
+ onParallelStateChange(
+ /** 小程序分栏状态变化事件的监听函数 */
+ listener: OnParallelStateChangeCallback
+ ): void
+ /** [wx.onScreenRecordingStateChanged(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.onScreenRecordingStateChanged.html)
+ *
+ * 需要基础库: `2.24.0`
+ *
+ * 在插件中使用:不支持
+ *
+ * 监听用户录屏事件。 */
+ onScreenRecordingStateChanged(
+ /** 用户录屏事件的监听函数 */
+ listener: OnScreenRecordingStateChangedCallback
+ ): void
+ /** [wx.onSocketClose(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/wx.onSocketClose.html)
+ *
+ * 在插件中使用:不支持
+ *
+ * @warning **推荐使用 [SocketTask](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.html) 的方式去管理 webSocket 链接,每一条链路的生命周期都更加可控,同时存在多个 webSocket 的链接的情况下使用 wx 前缀的方法可能会带来一些和预期不一致的情况。**
+ *
+ * 监听 WebSocket 连接关闭事件。 */
onSocketClose(
- /** WebSocket 连接关闭事件的回调函数 */
- callback: OnSocketCloseCallback
+ /** WebSocket 连接关闭事件的监听函数 */
+ listener: OnSocketCloseCallback
): void
- /** [wx.onSocketError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/wx.onSocketError.html)
+ /** [wx.onSocketError(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/wx.onSocketError.html)
*
- * 监听 WebSocket 错误事件 */
+ * 在插件中使用:不支持
+ *
+ * @warning **推荐使用 [SocketTask](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.html) 的方式去管理 webSocket 链接,每一条链路的生命周期都更加可控,同时存在多个 webSocket 的链接的情况下使用 wx 前缀的方法可能会带来一些和预期不一致的情况。**
+ *
+ * 监听 WebSocket 错误事件。 */
onSocketError(
- /** WebSocket 错误事件的回调函数 */
- callback: OnSocketErrorCallback
+ /** WebSocket 错误事件的监听函数 */
+ listener: OnSocketErrorCallback
): void
- /** [wx.onSocketMessage(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/wx.onSocketMessage.html)
+ /** [wx.onSocketMessage(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/wx.onSocketMessage.html)
*
- * 监听 WebSocket 接受到服务器的消息事件 */
+ * 在插件中使用:不支持
+ *
+ * @warning **推荐使用 [SocketTask](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.html) 的方式去管理 webSocket 链接,每一条链路的生命周期都更加可控,同时存在多个 webSocket 的链接的情况下使用 wx 前缀的方法可能会带来一些和预期不一致的情况。**
+ *
+ * 监听 WebSocket 接收到服务器的消息事件。 */
onSocketMessage(
- /** WebSocket 接受到服务器的消息事件的回调函数 */
- callback: OnSocketMessageCallback
+ /** WebSocket 接收到服务器的消息事件的监听函数 */
+ listener: OnSocketMessageCallback
): void
- /** [wx.onSocketOpen(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/wx.onSocketOpen.html)
+ /** [wx.onSocketOpen(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/wx.onSocketOpen.html)
*
- * 监听 WebSocket 连接打开事件 */
+ * 在插件中使用:不支持
+ *
+ * @warning **推荐使用 [SocketTask](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.html) 的方式去管理 webSocket 链接,每一条链路的生命周期都更加可控,同时存在多个 webSocket 的链接的情况下使用 wx 前缀的方法可能会带来一些和预期不一致的情况。**
+ *
+ * 监听 WebSocket 连接打开事件。 */
onSocketOpen(
- /** WebSocket 连接打开事件的回调函数 */
- callback: OnSocketOpenCallback
+ /** WebSocket 连接打开事件的监听函数 */
+ listener: OnSocketOpenCallback
): void
- /** [wx.onThemeChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onThemeChange.html)
+ /** [wx.onThemeChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onThemeChange.html)
+ *
+ * 需要基础库: `2.11.0`
+ *
+ * 在插件中使用:不支持
*
* 监听系统主题改变事件。该事件与 [`App.onThemeChange`](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onThemeChange-Object-object) 的回调时机一致。
*
* **注意**
*
- *
- * - 只有在全局配置"darkmode": true时才会触发此事件。
- *
- * 最低基础库: `2.11.0` */
+ * - 只有在全局配置"darkmode": true时才会触发此事件。 */
onThemeChange(
- /** 系统主题改变事件的回调函数 */
- callback: OnThemeChangeCallback
+ /** 系统主题改变事件的监听函数 */
+ listener: OnThemeChangeCallback
): void
- /** [wx.onUnhandledRejection(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onUnhandledRejection.html)
+ /** [wx.onUnhandledRejection(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onUnhandledRejection.html)
*
- * 监听未处理的 Promise 拒绝事件。该事件与 `App.onUnhandledRejection` 的回调时机与参数一致。
+ * 需要基础库: `2.10.0`
+ *
+ * 在插件中使用:不支持
+ *
+ * 监听未处理的 Promise 拒绝事件。该事件与 [`App.onUnhandledRejection`](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onUnhandledRejection-Object-object) 的回调时机与参数一致。
*
* **注意**
*
- *
- * - 安卓平台暂时不支持该事件
- * - 所有的 unhandledRejection 都可以被这一监听捕获,但只有 Error 类型的才会在小程序后台触发报警。
- *
- * 最低基础库: `2.10.0` */
+ * - 所有的 unhandledRejection 都可以被这一监听捕获,但只有 Error 类型的才会在小程序后台触发报警。 */
onUnhandledRejection(
- /** 未处理的 Promise 拒绝事件的回调函数 */
- callback: OnUnhandledRejectionCallback
+ /** 未处理的 Promise 拒绝事件的监听函数 */
+ listener: OnUnhandledRejectionCallback
): void
- /** [wx.onUserCaptureScreen(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.onUserCaptureScreen.html)
+ /** [wx.onUserCaptureScreen(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.onUserCaptureScreen.html)
+*
+* 需要基础库: `1.4.0`
+*
+* 在插件中使用:不支持
*
* 监听用户主动截屏事件。用户使用系统截屏按键截屏时触发,只能注册一个监听
*
* **示例代码**
*
-*
+* 页面要先调用wx.showShareMenu()来允许调用
* ```js
wx.onUserCaptureScreen(function (res) {
console.log('用户截屏了')
+ return {
+ query: "parameter=test", // 通过截屏图片打开小程序的query参数
+ promise: new Promise((resolve) => { // 通过promise延时传递小程序的query参数
+ setTimeout(() => {
+ resolve({
+ query: "parameter=test2",
+ })
+ }, 1000) // 在1秒内对query进行解析
+ })
+ }
})
-```
-*
-* 最低基础库: `1.4.0` */
+``` */
onUserCaptureScreen(
- /** 用户主动截屏事件的回调函数 */
- callback: OnUserCaptureScreenCallback
+ /** 用户主动截屏事件的监听函数 */
+ listener: OnUserCaptureScreenCallback
): void
- /** [wx.onVoIPChatInterrupted(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.onVoIPChatInterrupted.html)
+ /** [wx.onVoIPChatInterrupted(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.onVoIPChatInterrupted.html)
*
- * 监听被动断开实时语音通话事件。包括小游戏切入后端时断开
+ * 需要基础库: `2.7.0`
*
- * 最低基础库: `2.7.0` */
+ * 在插件中使用:需要基础库 `2.9.1`
+ *
+ * 监听被动断开实时语音通话事件。包括小游戏切入后端时断开 */
onVoIPChatInterrupted(
- /** 被动断开实时语音通话事件的回调函数 */
- callback: OnVoIPChatInterruptedCallback
+ /** 被动断开实时语音通话事件的监听函数 */
+ listener: OnVoIPChatInterruptedCallback
): void
- /** [wx.onVoIPChatMembersChanged(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.onVoIPChatMembersChanged.html)
+ /** [wx.onVoIPChatMembersChanged(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.onVoIPChatMembersChanged.html)
*
- * 监听实时语音通话成员在线状态变化事件。有成员加入/退出通话时触发回调
+ * 需要基础库: `2.7.0`
*
- * 最低基础库: `2.7.0` */
+ * 在插件中使用:需要基础库 `2.9.1`
+ *
+ * 监听实时语音通话成员在线状态变化事件。有成员加入/退出通话时触发回调 */
onVoIPChatMembersChanged(
- /** 实时语音通话成员在线状态变化事件的回调函数 */
- callback: OnVoIPChatMembersChangedCallback
+ /** 实时语音通话成员在线状态变化事件的监听函数 */
+ listener: OnVoIPChatMembersChangedCallback
): void
- /** [wx.onVoIPChatSpeakersChanged(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.onVoIPChatSpeakersChanged.html)
+ /** [wx.onVoIPChatSpeakersChanged(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.onVoIPChatSpeakersChanged.html)
*
- * 监听实时语音通话成员通话状态变化事件。有成员开始/停止说话时触发回调
+ * 需要基础库: `2.7.0`
*
- * 最低基础库: `2.7.0` */
+ * 在插件中使用:需要基础库 `2.9.1`
+ *
+ * 监听实时语音通话成员通话状态变化事件。有成员开始/停止说话时触发回调 */
onVoIPChatSpeakersChanged(
- /** 实时语音通话成员通话状态变化事件的回调函数 */
- callback: OnVoIPChatSpeakersChangedCallback
+ /** 实时语音通话成员通话状态变化事件的监听函数 */
+ listener: OnVoIPChatSpeakersChangedCallback
): void
- /** [wx.onVoIPVideoMembersChanged(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.onVoIPVideoMembersChanged.html)
+ /** [wx.onVoIPChatStateChanged(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.onVoIPChatStateChanged.html)
*
- * 监听实时语音通话成员视频状态变化事件。
+ * 需要基础库: `2.16.0`
*
- * 最低基础库: `2.11.0` */
+ * 在插件中使用:不支持
+ *
+ * 监听房间状态变化事件。 */
+ onVoIPChatStateChanged(
+ /** 房间状态变化事件的监听函数 */
+ listener: OnVoIPChatStateChangedCallback
+ ): void
+ /** [wx.onVoIPVideoMembersChanged(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.onVoIPVideoMembersChanged.html)
+ *
+ * 需要基础库: `2.11.0`
+ *
+ * 在插件中使用:不支持
+ *
+ * 监听实时语音通话成员视频状态变化事件。 */
onVoIPVideoMembersChanged(
- /** 实时语音通话成员视频状态变化事件的回调函数 */
- callback: OnVoIPVideoMembersChangedCallback
+ /** 实时语音通话成员视频状态变化事件的监听函数 */
+ listener: OnVoIPVideoMembersChangedCallback
): void
- /** [wx.onWifiConnected(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.onWifiConnected.html)
+ /** [wx.onWifiConnected(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.onWifiConnected.html)
*
- * 监听连接上 Wi-Fi 的事件
+ * 需要基础库: `1.6.0`
*
- * 最低基础库: `1.6.0` */
+ * 在插件中使用:需要基础库 `2.9.1`
+ *
+ * 监听连接上 Wi-Fi 的事件 */
onWifiConnected(
- /** 连接上 Wi-Fi 的事件的回调函数 */
- callback: OnWifiConnectedCallback
+ /** 连接上 Wi-Fi 的事件的监听函数 */
+ listener: OnWifiConnectedCallback
): void
- /** [wx.onWindowResize(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/window/wx.onWindowResize.html)
+ /** [wx.onWifiConnectedWithPartialInfo(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.onWifiConnectedWithPartialInfo.html)
*
- * 监听窗口尺寸变化事件
+ * 需要基础库: `2.22.0`
*
- * 最低基础库: `2.3.0` */
+ * 在插件中使用:需要基础库 `2.22.1`
+ *
+ * 监听连接上 Wi-Fi 的事件 */
+ onWifiConnectedWithPartialInfo(
+ /** 连接上 Wi-Fi 的事件的监听函数 */
+ listener: OnWifiConnectedWithPartialInfoCallback
+ ): void
+ /** [wx.onWindowResize(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/window/wx.onWindowResize.html)
+ *
+ * 需要基础库: `2.3.0`
+ *
+ * 在插件中使用:不支持
+ *
+ * 监听窗口尺寸变化事件 */
onWindowResize(
- /** 窗口尺寸变化事件的回调函数 */
- callback: OnWindowResizeCallback
+ /** 窗口尺寸变化事件的监听函数 */
+ listener: OnWindowResizeCallback
): void
+ /** [wx.onWindowStateChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/window/wx.onWindowStateChange.html)
+ *
+ * 需要基础库: `3.8.8`
+ *
+ * 在插件中使用:不支持
+ *
+ * 监听小程序窗口状态变化事件。仅适用于 PC 平台 */
+ onWindowStateChange(
+ /** 小程序窗口状态变化事件的监听函数 */
+ listener: OnWindowStateChangeCallback
+ ): void
+ /** [wx.openAppAuthorizeSetting(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.openAppAuthorizeSetting.html)
+*
+* 需要基础库: `2.20.1`
+*
+* 在插件中使用:需要基础库 `2.21.3`
+*
+* 跳转系统微信授权管理页
+*
+* **示例代码**
+*
+* ```js
+wx.openAppAuthorizeSetting({
+ success (res) {
+ console.log(res)
+ }
+})
+``` */
+ openAppAuthorizeSetting<
+ T extends OpenAppAuthorizeSettingOption = OpenAppAuthorizeSettingOption
+ >(
+ option?: T
+ ): PromisifySuccessResult
/** [wx.openBluetoothAdapter(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.openBluetoothAdapter.html)
*
-* 初始化蓝牙模块。iOS 上开启主机/从机模式时需分别调用一次,指定对应的 `mode`。
+* 需要基础库: `1.1.0`
+*
+* 在插件中使用:需要基础库 `1.9.6`
+*
+* 初始化蓝牙模块。iOS 上开启主机/从机(外围设备)模式时需分别调用一次,并指定对应的 `mode`。
*
* **object.fail 回调函数返回的 state 参数(仅 iOS)**
*
-*
* | 状态码 | 说明 |
* | ------ | ------ |
* | 0 | 未知 |
@@ -15068,13 +28628,11 @@ wx.onUserCaptureScreen(function (res) {
*
* **注意**
*
-*
* - 其他蓝牙相关 API 必须在 [wx.openBluetoothAdapter](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.openBluetoothAdapter.html) 调用之后使用。否则 API 会返回错误(errCode=10000)。
* - 在用户蓝牙开关未开启或者手机不支持蓝牙功能的情况下,调用 [wx.openBluetoothAdapter](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.openBluetoothAdapter.html) 会返回错误(errCode=10001),表示手机蓝牙功能不可用。此时小程序蓝牙模块已经初始化完成,可通过 [wx.onBluetoothAdapterStateChange](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.onBluetoothAdapterStateChange.html) 监听手机蓝牙状态的改变,也可以调用蓝牙模块的所有API。
*
* **示例代码**
*
-*
* [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
* ```js
wx.openBluetoothAdapter({
@@ -15082,9 +28640,7 @@ wx.openBluetoothAdapter({
console.log(res)
}
})
-```
-*
-* 最低基础库: `1.1.0` */
+``` */
openBluetoothAdapter<
T extends OpenBluetoothAdapterOption = OpenBluetoothAdapterOption
>(
@@ -15092,11 +28648,14 @@ wx.openBluetoothAdapter({
): PromisifySuccessResult
/** [wx.openCard(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/card/wx.openCard.html)
*
+* 需要基础库: `1.1.0`
+*
+* 在插件中使用:不支持
+*
* 查看微信卡包中的卡券。只有通过 [认证](https://developers.weixin.qq.com/miniprogram/product/renzheng.html) 的小程序或文化互动类目的小游戏才能使用。更多文档请参考 [微信卡券接口文档](https://mp.weixin.qq.com/cgi-bin/announce?action=getannouncement&key=1490190158&version=1&lang=zh_CN&platform=2)。
*
* **示例代码**
*
-*
* ```js
wx.openCard({
cardList: [{
@@ -15108,25 +28667,136 @@ wx.openCard({
}],
success (res) { }
})
-```
-*
-* 最低基础库: `1.1.0` */
+``` */
openCard(
option: T
): PromisifySuccessResult
+ /** [wx.openChannelsActivity(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/channels/wx.openChannelsActivity.html)
+ *
+ * 需要基础库: `2.19.2`
+ *
+ * 在插件中使用:不支持
+ *
+ * 打开视频号视频 */
+ openChannelsActivity(option: OpenChannelsActivityOption): void
+ /** [wx.openChannelsEvent(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/channels/wx.openChannelsEvent.html)
+ *
+ * 需要基础库: `2.21.0`
+ *
+ * 在插件中使用:需要基础库 `3.7.11`
+ *
+ * 打开视频号活动页 */
+ openChannelsEvent(option: OpenChannelsEventOption): void
+ /** [wx.openChannelsLive(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/channels/wx.openChannelsLive.html)
+ *
+ * 需要基础库: `2.15.0`
+ *
+ * 在插件中使用:不支持
+ *
+ * 打开视频号直播 */
+ openChannelsLive(option: OpenChannelsLiveOption): void
+ /** [wx.openChannelsUserProfile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/channels/wx.openChannelsUserProfile.html)
+ *
+ * 需要基础库: `2.21.2`
+ *
+ * 在插件中使用:支持
+ *
+ * 打开视频号主页。若为插件环境,只允许在插件页面中调用。 */
+ openChannelsUserProfile(option: OpenChannelsUserProfileOption): void
+ /** [wx.openChatTool(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/chattool/wx.openChatTool.html)
+ *
+ * 需要基础库: `3.7.8`
+ *
+ * 在插件中使用:不支持
+ *
+ * 进入聊天工具模式。
+ *
+ * 1. 不传入聊天室id时,微信会拉起聊天列表让用户选择,用户选择后绑定聊天室进入聊天工具模式。
+ * 2. 传入聊天室id时(群聊为opengid,单聊为open_single_roomid),会直接绑定该聊天室进入,此时必须传入对应的 chatType。
+ * 3. 聊天室类型可从 [[getGroupEnterInfo]](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/group/wx.getGroupEnterInfo.html) 返回值中获取。 */
+ openChatTool(
+ option: T
+ ): PromisifySuccessResult
+ /** [wx.openCustomerServiceChat(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/service-chat/wx.openCustomerServiceChat.html)
+*
+* 需要基础库: `2.19.0`
+*
+* 在插件中使用:不支持
+*
+* 打开微信客服,页面产生点击事件后才可调用。了解更多信息,可以参考[微信客服介绍](https://work.weixin.qq.com/kf/)。
+*
+* **示例代码**
+*
+* ```js
+wx.openCustomerServiceChat({
+ extInfo: {url: ''},
+ corpId: '',
+ success(res) {}
+})
+``` */
+ openCustomerServiceChat(option: OpenCustomerServiceChatOption): void
/** [wx.openDocument(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/wx.openDocument.html)
+ *
+ * 在插件中使用:需要基础库 `2.15.0`
*
* 新开页面打开文档。微信客户端 `7.0.12` 版本前默认显示右上角菜单按钮,之后的版本默认不显示,需主动传入 `showMenu`。 */
openDocument(
option: T
): PromisifySuccessResult
+ /** [wx.openEmbeddedMiniProgram(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/navigate/wx.openEmbeddedMiniProgram.html)
+ *
+ * 需要基础库: `2.20.1`
+ *
+ * 在插件中使用:需要基础库 `2.26.2`
+ *
+ * 打开半屏小程序。接入指引请参考 [半屏小程序能力](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/openEmbeddedMiniProgram.html)。 */
+ openEmbeddedMiniProgram<
+ T extends OpenEmbeddedMiniProgramOption = OpenEmbeddedMiniProgramOption
+ >(
+ option: T
+ ): PromisifySuccessResult
+ /** [wx.openHKOfflinePayView(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/payment/wx.openHKOfflinePayView.html)
+*
+* 需要基础库: `3.4.4`
+*
+* 在插件中使用:不支持
+*
+* 拉起WeChat Pay HK付款码。
+*
+* 接入步骤:
+* 1. 商户需已经开通微信港币钱包WeChat Pay HK的支付权限,
+* 2.请用商户在微信支付入驻时预留的邮箱,发起邮件申请接入权限:
+* - 【收件人】hkpayment@wechat.com
+* - 【邮件主题】申请接入拉起WeChat Pay HK付款码+商户名称:***+商户号:***
+* - 【邮件内容】因XXX原因(原因请按商户实际情况填写,不合理会驳回),需申请拉起WeChat Pay HK付款码,申请材料如下:
+* - 商户名称
+* - 商户号
+* - 商户资质材料扫描件或照片(CI,BR任一),所有材料均需清晰,且有盖章
+* - 拉起WeChat Pay HK付款码的场景说明:需有文字和示意图说明
+* - 商户联系方式:邮件***,联系电话***
+*
+* **示例代码**
+*
+* ```js
+wx.openHKOfflinePayView({
+ timeStamp: '',
+ nonceStr: '',
+ package: '',
+ signType: 'SHA1',
+ paySign: '',
+ success (res) { },
+ fail (res) { }
+})
+``` */
+ openHKOfflinePayView(option: OpenHKOfflinePayViewOption): void
/** [wx.openLocation(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.openLocation.html)
*
+* 在插件中使用:需要基础库 `1.9.6`
+*
* 使用微信内置地图查看位置
*
* **示例代码**
*
-*
* ```js
wx.getLocation({
type: 'gcj02', //返回可以用于wx.openLocation的经纬度
@@ -15144,8 +28814,125 @@ wx.openCard({
openLocation(
option: T
): PromisifySuccessResult
+ /** [wx.openOfficialAccountArticle(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/navigate/wx.openOfficialAccountArticle.html)
+*
+* 需要基础库: `3.4.8`
+*
+* 在插件中使用:不支持
+*
+* 通过小程序打开任意公众号文章(不包括临时链接等异常状态下的公众号文章),必须有点击行为才能调用成功。
+*
+* **示例代码**
+*
+* ```js
+ wx.openOfficialAccountArticle({
+ url:'', // 此处填写公众号文章连接
+ success: res => {
+ },
+ fail: res => {
+ }
+ })
+``` */
+ openOfficialAccountArticle(
+ option: OpenOfficialAccountArticleOption
+ ): void
+ /** [wx.openOfficialAccountChat(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/navigate/wx.openOfficialAccountChat.html)
+*
+* 需要基础库: `3.10.0`
+*
+* 在插件中使用:不支持
+*
+* 通过小程序打开公众号会话界面
+*
+* **示例代码**
+*
+* ```js
+ wx.openOfficialAccountChat({
+ username: '', // 此处填写公众号的微信号
+ success: res => {
+ },
+ fail: res => {
+ }
+ })
+```
+*
+* **Tips**
+*
+* 1. 跳转的公众号需与小程序为同主体或关联主体
+* 2. 如果用户没有关注则进行回退,跳转到公众号主页 */
+ openOfficialAccountChat(option: OpenOfficialAccountChatOption): void
+ /** [wx.openOfficialAccountProfile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/navigate/wx.openOfficialAccountProfile.html)
+*
+* 需要基础库: `3.7.10`
+*
+* 在插件中使用:不支持
+*
+* 通过小程序打开公众号主页
+*
+* **示例代码**
+*
+* ```js
+ wx.openOfficialAccountProfile({
+ username: '', // 此处填写公众号的原始 ID
+ success: res => {
+ },
+ fail: res => {
+ }
+ })
+```
+*
+* **Tips**
+*
+* 1. 跳转的公众号需与小程序为同主体或关联主体 */
+ openOfficialAccountProfile(
+ option: OpenOfficialAccountProfileOption
+ ): void
+ /** [wx.openPrivacyContract(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/privacy/wx.openPrivacyContract.html)
+*
+* 需要基础库: `2.32.3`
+*
+* 在插件中使用:不支持
+*
+* 跳转至隐私协议页面。隐私合规开发指南详情可见[《小程序隐私协议开发指南》](https://developers.weixin.qq.com/miniprogram/dev/framework/user-privacy/PrivacyAuthorize.html)
+*
+* ****
+*
+* ## 具体说明:
+*
+* - 1. 一定要调用 wx.openPrivacyContract 接口吗?
+*
+* - 不是。开发者也可以选择在小程序页面内自行展示完整的隐私协议。但推荐使用该接口。
+*
+* **示例代码**
+*
+* ```js
+wx.openPrivacyContract({
+ success: () => {}, // 打开成功
+ fail: () => {}, // 打开失败
+ complete: () => {}
+})
+```
+*
+* **完整示例demo**
+*
+* demo1: 演示使用 `wx.getPrivacySetting` 和 `` 在首页处理隐私弹窗逻辑
+* [https://developers.weixin.qq.com/s/gi71sGm67hK0](https://developers.weixin.qq.com/s/gi71sGm67hK0)
+*
+* demo2: 演示使用 `wx.onNeedPrivacyAuthorization` 和 `` 在多个页面处理隐私弹窗逻辑,同时演示了如何处理多个隐私接口同时调用。
+* [https://developers.weixin.qq.com/s/hndZUOmA7gKn](https://developers.weixin.qq.com/s/hndZUOmA7gKn)
+*
+* demo3: 演示 `wx.onNeedPrivacyAuthorization`、`wx.requirePrivacyAuthorize`、`` 和 ` ` 组件如何结合使用
+* [https://developers.weixin.qq.com/s/jX7xWGmA7UKa](https://developers.weixin.qq.com/s/jX7xWGmA7UKa)
+*
+* demo4: 演示使用 `wx.onNeedPrivacyAuthorization` 和 `` 在多个 tabBar 页面处理隐私弹窗逻辑。
+* [https://developers.weixin.qq.com/s/g6BWZGmt7XK9](https://developers.weixin.qq.com/s/g6BWZGmt7XK9) */
+ openPrivacyContract(option: OpenPrivacyContractOption): void
/** [wx.openSetting(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/setting/wx.openSetting.html)
*
+* 需要基础库: `1.1.0`
+*
+* 在插件中使用:需要基础库 `2.10.3`
+*
* 调起客户端小程序设置界面,返回用户设置的操作结果。**设置界面只会出现小程序已经向用户请求过的[权限](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html)**。
*
* ****
@@ -15154,7 +28941,6 @@ wx.openCard({
*
* **示例代码**
*
-*
* ```js
wx.openSetting({
success (res) {
@@ -15165,25 +28951,119 @@ wx.openSetting({
// }
}
})
-```
-*
-* 最低基础库: `1.1.0` */
+``` */
openSetting(
option?: T
): PromisifySuccessResult
+ /** [wx.openSingleStickerView(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/sticker/wx.openSingleStickerView.html)
+*
+* 需要基础库: `3.0.1`
+*
+* 在插件中使用:不支持
+*
+* 打开单个表情
+*
+* **示例代码**
+*
+* ```js
+wx.openSingleStickerView({
+ url: '',
+ success(res) {}
+})
+``` */
+ openSingleStickerView(option: OpenSingleStickerViewOption): void
+ /** [wx.openStickerIPView(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/sticker/wx.openStickerIPView.html)
+*
+* 需要基础库: `3.0.1`
+*
+* 在插件中使用:不支持
+*
+* 打开表情IP合辑
+*
+* **示例代码**
+*
+* ```js
+wx.openStickerIPView({
+ url: '',
+ success(res) {}
+})
+``` */
+ openStickerIPView(option: OpenStickerIPViewOption): void
+ /** [wx.openStickerSetView(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/sticker/wx.openStickerSetView.html)
+*
+* 需要基础库: `3.0.1`
+*
+* 在插件中使用:不支持
+*
+* 打开表情专辑
+*
+* **示例代码**
+*
+* ```js
+wx.openStickerSetView({
+ url: '',
+ success(res) {}
+})
+``` */
+ openStickerSetView(option: OpenStickerSetViewOption): void
+ /** [wx.openStoreCouponDetail(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/store/wx.openStoreCouponDetail.html)
+ *
+ * 需要基础库: `3.8.5`
+ *
+ * 在插件中使用:不支持
+ *
+ * 打开微信小店优惠券详情页 */
+ openStoreCouponDetail(option: OpenStoreCouponDetailOption): void
+ /** [wx.openStoreOrderDetail(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/store/wx.openStoreOrderDetail.html)
+ *
+ * 需要基础库: `3.7.1`
+ *
+ * 在插件中使用:不支持
+ *
+ * 打开微信小店订单详情页 */
+ openStoreOrderDetail(option: OpenStoreOrderDetailOption): void
+ /** [wx.openSystemBluetoothSetting(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.openSystemBluetoothSetting.html)
+*
+* 需要基础库: `2.20.1`
+*
+* 在插件中使用:需要基础库 `2.21.3`
+*
+* 跳转系统蓝牙设置页。仅支持安卓。
+*
+* **示例代码**
+*
+* ```js
+wx.openSystemBluetoothSetting({
+ success (res) {
+ console.log(res)
+ }
+})
+``` */
+ openSystemBluetoothSetting<
+ T extends OpenSystemBluetoothSettingOption = OpenSystemBluetoothSettingOption
+ >(
+ option?: T
+ ): PromisifySuccessResult
/** [wx.openVideoEditor(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.openVideoEditor.html)
*
- * 打开视频编辑器
+ * 需要基础库: `2.12.0`
*
- * 最低基础库: `2.12.0` */
+ * 在插件中使用:需要基础库 `2.15.0`
+ *
+ * 打开视频编辑器 */
openVideoEditor(option: OpenVideoEditorOption): void
/** [wx.pageScrollTo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/scroll/wx.pageScrollTo.html)
*
+* 需要基础库: `1.4.0`
+*
+* 在插件中使用:需要基础库 `2.1.0`
+*
+* 在插件中使用时,只能在当前插件的页面中调用
+*
* 将页面滚动到目标位置,支持选择器和滚动距离两种方式定位
*
* **selector 语法**
*
-*
* selector类似于 CSS 的选择器,但仅支持下列语法。
*
* + ID选择器:#the-id
@@ -15195,30 +29075,27 @@ wx.openSetting({
*
* **示例代码**
*
-*
* ```js
wx.pageScrollTo({
scrollTop: 0,
duration: 300
})
-```
-*
-* 最低基础库: `1.4.0` */
+``` */
pageScrollTo(
option: T
): PromisifySuccessResult