提交 7678d1b5 编写于 作者: fxy060608's avatar fxy060608

fix(mp): vuex store

上级 6f5af7d8
...@@ -231,7 +231,7 @@ const promiseInterceptor = { ...@@ -231,7 +231,7 @@ const promiseInterceptor = {
}; };
const SYNC_API_RE = const SYNC_API_RE =
/^\$|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/; /^\$|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/;
const CONTEXT_API_RE = /^create|Manager$/; const CONTEXT_API_RE = /^create|Manager$/;
...@@ -1136,6 +1136,10 @@ function parseBaseApp (vm, { ...@@ -1136,6 +1136,10 @@ function parseBaseApp (vm, {
if (this.mpType !== 'app') { if (this.mpType !== 'app') {
initRefs(this); initRefs(this);
initMocks(this, mocks); initMocks(this, mocks);
} else {
if (this.$options.store) { // vuex store
Vue.prototype.$store = this.$options.store;
}
} }
} }
}); });
......
...@@ -231,7 +231,7 @@ const promiseInterceptor = { ...@@ -231,7 +231,7 @@ const promiseInterceptor = {
}; };
const SYNC_API_RE = const SYNC_API_RE =
/^\$|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/; /^\$|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/;
const CONTEXT_API_RE = /^create|Manager$/; const CONTEXT_API_RE = /^create|Manager$/;
...@@ -639,9 +639,23 @@ const protocols = { // 需要做转换的 API 列表 ...@@ -639,9 +639,23 @@ const protocols = { // 需要做转换的 API 列表
}, },
scanCode: { scanCode: {
name: 'scan', name: 'scan',
args: { args (fromArgs) {
onlyFromCamera: 'hideAlbum', if (fromArgs.scanType === 'qrCode') {
scanType: false fromArgs.type = 'qr';
return {
onlyFromCamera: 'hideAlbum'
}
} else if (fromArgs.scanType === 'barCode') {
fromArgs.type = 'bar';
return {
onlyFromCamera: 'hideAlbum'
}
} else {
return {
scanType: false,
onlyFromCamera: 'hideAlbum'
}
}
}, },
returnValue: { returnValue: {
code: 'result' code: 'result'
...@@ -1523,6 +1537,10 @@ function parseBaseApp (vm, { ...@@ -1523,6 +1537,10 @@ function parseBaseApp (vm, {
if (this.mpType !== 'app') { if (this.mpType !== 'app') {
initRefs(this); initRefs(this);
initMocks(this, mocks); initMocks(this, mocks);
} else {
if (this.$options.store) { // vuex store
Vue.prototype.$store = this.$options.store;
}
} }
} }
}); });
......
...@@ -231,7 +231,7 @@ const promiseInterceptor = { ...@@ -231,7 +231,7 @@ const promiseInterceptor = {
}; };
const SYNC_API_RE = const SYNC_API_RE =
/^\$|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/; /^\$|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/;
const CONTEXT_API_RE = /^create|Manager$/; const CONTEXT_API_RE = /^create|Manager$/;
...@@ -1282,6 +1282,10 @@ function parseBaseApp (vm, { ...@@ -1282,6 +1282,10 @@ function parseBaseApp (vm, {
if (this.mpType !== 'app') { if (this.mpType !== 'app') {
initRefs(this); initRefs(this);
initMocks(this, mocks); initMocks(this, mocks);
} else {
if (this.$options.store) { // vuex store
Vue.prototype.$store = this.$options.store;
}
} }
} }
}); });
......
...@@ -231,7 +231,7 @@ const promiseInterceptor = { ...@@ -231,7 +231,7 @@ const promiseInterceptor = {
}; };
const SYNC_API_RE = const SYNC_API_RE =
/^\$|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/; /^\$|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/;
const CONTEXT_API_RE = /^create|Manager$/; const CONTEXT_API_RE = /^create|Manager$/;
...@@ -1200,6 +1200,10 @@ function parseBaseApp (vm, { ...@@ -1200,6 +1200,10 @@ function parseBaseApp (vm, {
if (this.mpType !== 'app') { if (this.mpType !== 'app') {
initRefs(this); initRefs(this);
initMocks(this, mocks); initMocks(this, mocks);
} else {
if (this.$options.store) { // vuex store
Vue.prototype.$store = this.$options.store;
}
} }
} }
}); });
......
...@@ -231,7 +231,7 @@ const promiseInterceptor = { ...@@ -231,7 +231,7 @@ const promiseInterceptor = {
}; };
const SYNC_API_RE = const SYNC_API_RE =
/^\$|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/; /^\$|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/;
const CONTEXT_API_RE = /^create|Manager$/; const CONTEXT_API_RE = /^create|Manager$/;
...@@ -1292,6 +1292,10 @@ function parseBaseApp (vm, { ...@@ -1292,6 +1292,10 @@ function parseBaseApp (vm, {
if (this.mpType !== 'app') { if (this.mpType !== 'app') {
initRefs(this); initRefs(this);
initMocks(this, mocks); initMocks(this, mocks);
} else {
if (this.$options.store) { // vuex store
Vue.prototype.$store = this.$options.store;
}
} }
} }
}); });
......
...@@ -231,7 +231,7 @@ const promiseInterceptor = { ...@@ -231,7 +231,7 @@ const promiseInterceptor = {
}; };
const SYNC_API_RE = const SYNC_API_RE =
/^\$|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/; /^\$|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/;
const CONTEXT_API_RE = /^create|Manager$/; const CONTEXT_API_RE = /^create|Manager$/;
...@@ -1140,6 +1140,10 @@ function parseBaseApp (vm, { ...@@ -1140,6 +1140,10 @@ function parseBaseApp (vm, {
if (this.mpType !== 'app') { if (this.mpType !== 'app') {
initRefs(this); initRefs(this);
initMocks(this, mocks); initMocks(this, mocks);
} else {
if (this.$options.store) { // vuex store
Vue.prototype.$store = this.$options.store;
}
} }
} }
}); });
......
...@@ -39,6 +39,10 @@ export default function parseBaseApp (vm, { ...@@ -39,6 +39,10 @@ export default function parseBaseApp (vm, {
if (this.mpType !== 'app') { if (this.mpType !== 'app') {
initRefs(this) initRefs(this)
initMocks(this, mocks) initMocks(this, mocks)
} else {
if (this.$options.store) { // vuex store
Vue.prototype.$store = this.$options.store
}
} }
} }
}) })
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册