提交 754060fc 编写于 作者: Q qiang

Merge branch 'alpha'

......@@ -12,5 +12,5 @@
"message": "chore(release): publish %s"
}
},
"version": "2.0.2-3070320230222001"
"version": "2.0.2-alpha-3070720230316001"
}
{
"name": "@dcloudio/uni-app-plus-nvue",
"version": "2.0.2-3070320230222001",
"version": "2.0.2-alpha-3070720230316001",
"description": "uni-app app-plus-nvue",
"main": "dist/index.js",
"repository": {
......
......@@ -9563,8 +9563,12 @@ var serviceContext = (function () {
files,
header,
formData,
timeout = __uniConfig.networkTimeout.uploadFile ? __uniConfig.networkTimeout.uploadFile / 1000 : 120
timeout
} = {}) {
timeout =
(timeout ||
(__uniConfig.networkTimeout && __uniConfig.networkTimeout.uploadFile) ||
60 * 1000) / 1000;
const uploader = plus.uploader.createUpload(url, {
timeout,
// 需要与其它平台上的表现保持一致,不走重试的逻辑。
......@@ -10538,6 +10542,9 @@ var serviceContext = (function () {
return proxy;
}
function resolveSyncResult(res) {
if ((process.env.NODE_ENV !== 'production')) {
console.log('uts.invokeSync.result', res);
}
if (res.errMsg) {
throw new Error(res.errMsg);
}
......@@ -10548,6 +10555,9 @@ var serviceContext = (function () {
throw new Error(args.errMsg);
}
delete args.errMsg;
if ((process.env.NODE_ENV !== 'production')) {
console.log('uts.invokePropGetter.args', args);
}
return resolveSyncResult(getProxy().invokeSync(args, () => { }));
}
function initProxyFunction(async, { moduleName, moduleType, package: pkg, class: cls, name: propOrMethod, method, companion, params: methodParams, errMsg, }, instanceId) {
......@@ -10589,7 +10599,13 @@ var serviceContext = (function () {
});
if (async) {
return new Promise((resolve, reject) => {
if ((process.env.NODE_ENV !== 'production')) {
console.log('uts.invokeAsync.args', invokeArgs);
}
getProxy().invokeAsync(invokeArgs, (res) => {
if ((process.env.NODE_ENV !== 'production')) {
console.log('uts.invokeAsync.result', res);
}
if (res.type !== 'return') {
invokeCallback(res);
}
......@@ -10604,6 +10620,9 @@ var serviceContext = (function () {
});
});
}
if ((process.env.NODE_ENV !== 'production')) {
console.log('uts.invokeSync.args', invokeArgs);
}
return resolveSyncResult(getProxy().invokeSync(invokeArgs, invokeCallback));
};
}
......@@ -10616,6 +10635,12 @@ var serviceContext = (function () {
return initProxyFunction(async, opts, 0);
}
const initUTSProxyFunction = initUTSStaticMethod;
function parseClassMethodName(name, methods) {
if (hasOwn(methods, name + 'ByJs')) {
return name + 'ByJs';
}
return name;
}
function initUTSProxyClass({ moduleName, moduleType, package: pkg, class: cls, constructor: { params: constructorParams }, methods, props, staticProps, staticMethods, errMsg, }) {
const baseOptions = {
moduleName,
......@@ -10624,6 +10649,12 @@ var serviceContext = (function () {
class: cls,
errMsg,
};
// iOS 需要为 ByJs 的 class 构造函数(如果包含JSONObject或UTSCallback类型)补充最后一个参数
if (typeof plus !== 'undefined' && plus.os.name === 'iOS') {
if (constructorParams.find((p) => p.type === 'UTSCallback' || p.type.indexOf('JSONObject') > 0)) {
constructorParams.push({ name: '_byJs', type: 'boolean' });
}
}
const ProxyClass = class UTSClass {
constructor(...params) {
if (errMsg) {
......@@ -10639,6 +10670,7 @@ var serviceContext = (function () {
get(_, name) {
if (!target[name]) {
//实例方法
name = parseClassMethodName(name, methods);
if (hasOwn(methods, name)) {
const { async, params } = methods[name];
target[name] = initUTSInstanceMethod(!!async, extend({
......@@ -10665,6 +10697,7 @@ var serviceContext = (function () {
const staticMethodCache = {};
return new Proxy(ProxyClass, {
get(target, name, receiver) {
name = parseClassMethodName(name, staticMethods);
if (hasOwn(staticMethods, name)) {
if (!staticMethodCache[name]) {
const { async, params } = staticMethods[name];
......@@ -24062,6 +24095,21 @@ var serviceContext = (function () {
});
}
// script setup onPageScroll、onReachBottom not effective
const setup = extendOptions.setup;
if (setup) {
const injectHooks = ['onPageScroll', 'onReachBottom'];
let setupString = '';
try {
setupString = setup.toString();
} catch (error) {}
injectHooks.forEach(hook => {
if (setupString.indexOf(`uniApp.${hook}`) && !extendOptions[hook]) {
extendOptions[hook] = [() => {}];
}
});
}
return oldExtend.call(this, extendOptions)
};
......
{
"name": "@dcloudio/uni-app-plus",
"version": "2.0.2-3070320230222001",
"version": "2.0.2-alpha-3070720230316001",
"description": "uni-app app-plus",
"main": "dist/index.js",
"repository": {
......
{
"name": "@dcloudio/uni-app",
"version": "2.0.2-3070320230222001",
"version": "2.0.2-alpha-3070720230316001",
"description": "uni-app composition-api",
"main": "dist/index.js",
"repository": {
......
{
"name": "@dcloudio/uni-automator",
"version": "2.0.2-3070320230222001",
"version": "2.0.2-alpha-3070720230316001",
"description": "uni-app automator",
"main": "dist/index.js",
"repository": {
......
{
"name": "@dcloudio/uni-cli-i18n",
"version": "2.0.2-3070320230222001",
"version": "2.0.2-alpha-3070720230316001",
"description": "uni-cli-i18n",
"main": "lib/index.js",
"repository": {
......
{
"name": "@dcloudio/uni-cli-shared",
"version": "2.0.2-3070320230222001",
"version": "2.0.2-alpha-3070720230316001",
"description": "uni-cli-shared",
"main": "lib/index.js",
"repository": {
......
{
"name": "@dcloudio/uni-h5-ui",
"version": "2.0.2-3070320230222001",
"version": "2.0.2-alpha-3070720230316001",
"description": "uni-app h5 ui",
"main": "dist/index.umd.min.js",
"repository": {
......
{
"name": "@dcloudio/uni-h5",
"version": "2.0.2-3070320230222001",
"version": "2.0.2-alpha-3070720230316001",
"description": "uni-app h5",
"main": "dist/index.umd.min.js",
"repository": {
......
{
"name": "@dcloudio/uni-i18n",
"version": "2.0.2-3070320230222001",
"version": "2.0.2-alpha-3070720230316001",
"description": "@dcloudio/uni-i18n",
"main": "./dist/uni-i18n.cjs.js",
"module": "./dist/uni-i18n.es.js",
......
{
"name": "@dcloudio/uni-migration",
"version": "2.0.2-3070320230222001",
"version": "2.0.2-alpha-3070720230316001",
"description": "uni-app migration",
"main": "lib/index.js",
"repository": {
......
{
"name": "@dcloudio/uni-mp-alipay",
"version": "2.0.2-3070320230222001",
"version": "2.0.2-alpha-3070720230316001",
"description": "uni-app mp-alipay",
"main": "dist/index.js",
"repository": {
......
{
"name": "@dcloudio/uni-mp-baidu",
"version": "2.0.2-3070320230222001",
"version": "2.0.2-alpha-3070720230316001",
"description": "uni-app mp-baidu",
"main": "dist/index.js",
"repository": {
......
{
"name": "@dcloudio/uni-mp-jd",
"version": "2.0.2-3070320230222001",
"version": "2.0.2-alpha-3070720230316001",
"description": "uni-app mp-jd",
"main": "dist/index.js",
"repository": {
......
{
"name": "@dcloudio/uni-mp-kuaishou",
"version": "2.0.2-3070320230222001",
"version": "2.0.2-alpha-3070720230316001",
"description": "uni-app mp-kuaishou",
"main": "dist/index.js",
"repository": {
......
{
"name": "@dcloudio/uni-mp-lark",
"version": "2.0.2-3070320230222001",
"version": "2.0.2-alpha-3070720230316001",
"description": "uni-app mp-lark",
"main": "dist/index.js",
"repository": {
......
{
"name": "@dcloudio/uni-mp-qq",
"version": "2.0.2-3070320230222001",
"version": "2.0.2-alpha-3070720230316001",
"description": "uni-app mp-qq",
"main": "dist/index.js",
"repository": {
......
......@@ -1041,11 +1041,6 @@ const canIUses = [
// 需要做转换的 API 列表
const protocols = {
chooseImage: {
args: {
sizeType: false
}
},
navigateTo,
redirectTo,
previewImage,
......
{
"name": "@dcloudio/uni-mp-toutiao",
"version": "2.0.2-3070320230222001",
"version": "2.0.2-alpha-3070720230316001",
"description": "uni-app mp-toutiao",
"main": "dist/index.js",
"repository": {
......
{
"name": "@dcloudio/uni-mp-vue",
"version": "2.0.2-3070320230222001",
"version": "2.0.2-alpha-3070720230316001",
"description": "@dcloudio/uni-mp-vue",
"main": "dist/vue.runtime.esm.js",
"module": "dist/vue.runtime.esm.js",
......
......@@ -1429,6 +1429,20 @@ function toSkip (obj) {
});
}
return obj
}
const WORKLET_RE = /_(.*)_worklet_factory_/;
function initWorkletMethods (mpMethods, vueMethods) {
if (vueMethods) {
Object.keys(vueMethods).forEach((name) => {
const matches = name.match(WORKLET_RE);
if (matches) {
const workletName = matches[1];
mpMethods[name] = vueMethods[name];
mpMethods[workletName] = vueMethods[workletName];
}
});
}
}
const MPPage = Page;
......@@ -2436,6 +2450,9 @@ function parseBasePage (vuePageOptions) {
{
initUnknownHooks(pageOptions.methods, vuePageOptions, ['onReady']);
}
{
initWorkletMethods(pageOptions.methods, vueOptions.methods);
}
return pageOptions
}
......
{
"name": "@dcloudio/uni-mp-weixin",
"version": "2.0.2-3070320230222001",
"version": "2.0.2-alpha-3070720230316001",
"description": "uni-app mp-weixin",
"main": "dist/index.js",
"repository": {
......
{
"name": "@dcloudio/uni-mp-xhs",
"version": "2.0.2-3070320230222001",
"version": "2.0.2-alpha-3070720230316001",
"description": "uni-app mp-xhs",
"main": "dist/index.js",
"repository": {
......
{
"name": "@dcloudio/uni-quickapp-native",
"version": "2.0.2-3070320230222001",
"version": "2.0.2-alpha-3070720230316001",
"description": "uni-app quickapp-native",
"main": "dist/vue.prod.js",
"repository": {
......
{
"name": "@dcloudio/uni-quickapp-webview",
"version": "2.0.2-3070320230222001",
"version": "2.0.2-alpha-3070720230316001",
"description": "uni-app quickapp-webview",
"main": "dist/index.js",
"repository": {
......
{
"name": "@dcloudio/uni-stacktracey",
"version": "2.0.2-3070320230222001",
"version": "2.0.2-alpha-3070720230316001",
"description": "@dcloudio/uni-stacktracey",
"main": "dist/uni-stacktracey.cjs.js",
"module": "dist/uni-stacktracey.es.js",
......
{
"name": "@dcloudio/uni-stat",
"version": "2.0.2-3070320230222001",
"version": "2.0.2-alpha-3070720230316001",
"description": "",
"main": "dist/uni-stat.es.js",
"repository": {
......
......@@ -438,4 +438,11 @@ describe('mp:compiler-mp-weixin', () => {
}
)
})
it('skyline gesture', () => {
assertCodegen(
'<vertical-drag-gesture-handler onGestureEvent="handlePan" native-view="scroll-view" shouldResponseOnMove="shouldResponse" shouldAcceptGesture="shouldAccept"/>',
'<vertical-drag-gesture-handler onGestureEvent="handlePan" native-view="scroll-view" shouldResponseOnMove="shouldResponse" shouldAcceptGesture="shouldAccept"></vertical-drag-gesture-handler>'
)
})
})
......@@ -83,7 +83,25 @@ const tags = {
'page-container',
'page-meta',
'navigation-bar',
'match-media'
'match-media',
'share-element',
'channel-live',
'channel-video',
'voip-room',
'root-portal',
// 手势组件
'tap-gesture-handler',
'double-tap-gesture-handler',
'scale-gesture-handler',
'force-press-gesture-handler',
'pan-gesture-handler',
'vertical-drag-gesture-handler',
'horizontal-drag-gesture-handler',
'long-press-gesture-handler',
'grid-view',
'list-view',
'sticky-header',
'sticky-section'
],
// 支付宝小程序平台独有组件
'mp-alipay': [
......@@ -184,4 +202,4 @@ module.exports = function getCompilerOptions (platform) {
baseCompiler,
require(id + '/lib/uni.compiler.js')
)
}
}
{
"name": "@dcloudio/uni-template-compiler",
"version": "2.0.2-3070320230222001",
"version": "2.0.2-alpha-3070720230316001",
"description": "uni-template-compiler",
"main": "lib/index.js",
"repository": {
......
{
"name": "@dcloudio/vue-cli-plugin-hbuilderx",
"version": "2.0.2-3070320230222001",
"version": "2.0.2-alpha-3070720230316001",
"description": "HBuilderX plugin for vue-cli 3",
"main": "index.js",
"repository": {
......
{
"name": "@dcloudio/vue-cli-plugin-uni-optimize",
"version": "2.0.2-3070320230222001",
"version": "2.0.2-alpha-3070720230316001",
"description": "uni-app optimize plugin for vue-cli 3",
"main": "index.js",
"repository": {
......
{
"name": "@dcloudio/vue-cli-plugin-uni",
"version": "2.0.2-3070320230222001",
"version": "2.0.2-alpha-3070720230316001",
"description": "uni-app plugin for vue-cli 3",
"main": "index.js",
"repository": {
......@@ -17,7 +17,7 @@
"author": "fxy060608",
"license": "Apache-2.0",
"dependencies": {
"@dcloudio/uni-stat": "^2.0.2-3070320230222001",
"@dcloudio/uni-stat": "^2.0.2-alpha-3070720230316001",
"buffer-json": "^2.0.0",
"clone-deep": "^4.0.1",
"cross-env": "^5.2.0",
......
因为 它太大了无法显示 source diff 。你可以改为 查看blob
......@@ -4,13 +4,13 @@ module.exports = function (appJson) {
}
if (!appJson.plugins['uni-ad']) {
appJson.plugins['uni-ad'] = {
version: '1.0.1',
version: '1.1.1',
provider: 'wxf72d316417b6767f'
}
}
if (!appJson.plugins['coral-adv']) {
appJson.plugins['coral-adv'] = {
version: '1.0.12',
version: '1.0.15',
provider: 'wx0e203209e27b1e66'
}
}
......
{
"name": "@dcloudio/webpack-uni-mp-loader",
"version": "2.0.2-3070320230222001",
"version": "2.0.2-alpha-3070720230316001",
"description": "webpack-uni-mp-loader",
"main": "index.js",
"repository": {
......
......@@ -213,6 +213,19 @@ function getCondition (pagesJson) {
return false
}
function weixinSkyline (config) {
return config.renderer === 'skyline' && config.lazyCodeLoading === 'requiredComponents'
}
function openES62ES5 (config) {
if (!config.setting) {
config.setting = {}
}
if (!config.setting.es6) {
config.setting.es6 = true
}
}
module.exports = function (pagesJson, manifestJson, project = {}) {
const app = {
pages: [],
......@@ -291,8 +304,8 @@ module.exports = function (pagesJson, manifestJson, project = {}) {
}
if (
process.env.UNI_PLATFORM === 'mp-weixin' ||
process.env.UNI_PLATFORM === 'mp-qq'
platform === 'mp-weixin' ||
platform === 'mp-qq'
) {
// 微信不需要生成,其他平台做拷贝
return {
......@@ -354,6 +367,9 @@ module.exports = function (pagesJson, manifestJson, project = {}) {
}
}
// 使用了微信小程序手势系统,自动开启 ES6=>ES5
platform === 'mp-weixin' && weixinSkyline(manifestJson[platform]) && openES62ES5(project)
if (process.env.UNI_AUTOMATOR_WS_ENDPOINT) {
if (!project.setting) {
project.setting = {}
......
{
"name": "@dcloudio/webpack-uni-pages-loader",
"version": "2.0.2-3070320230222001",
"version": "2.0.2-alpha-3070720230316001",
"description": "uni-app pages.json loader",
"main": "lib/index.js",
"repository": {
......@@ -21,7 +21,7 @@
"strip-json-comments": "^2.0.1"
},
"uni-app": {
"compilerVersion": "3.7.3"
"compilerVersion": "3.7.7"
},
"gitHead": "4a974e44466ae58194372e446299cf83c7a3ad2c"
}
......@@ -81,6 +81,21 @@ export function lifecycleMixin (Vue) {
})
}
// script setup onPageScroll、onReachBottom not effective
const setup = extendOptions.setup
if (setup) {
const injectHooks = ['onPageScroll', 'onReachBottom']
let setupString = ''
try {
setupString = setup.toString()
} catch (error) {}
injectHooks.forEach(hook => {
if (setupString.indexOf(`uniApp.${hook}`) && !extendOptions[hook]) {
extendOptions[hook] = [() => {}]
}
})
}
return oldExtend.call(this, extendOptions)
}
......
......@@ -2,6 +2,10 @@ import {
getTargetDataset
} from 'uni-helpers/index'
import {
camelize
} from 'uni-shared'
import getWindowOffset from 'uni-platform/helpers/get-window-offset'
import {
......@@ -62,14 +66,18 @@ function getNodeInfo (el, fields) {
info.height = rect.height
}
}
// TODO 组件 props
if (Array.isArray(fields.properties)) {
fields.properties.forEach(prop => {
prop = prop.replace(/-([a-z])/g, function (e, t) {
return t.toUpperCase()
const props = el.__vue__ && el.__vue__.$props
if (props) {
fields.properties.forEach(prop => {
if (typeof prop === 'string') {
prop = camelize(prop)
if (props[prop] != null) {
info[prop] = props[prop]
}
}
})
// props
})
}
}
if (fields.scrollOffset) {
if (el.tagName === 'UNI-SCROLL-VIEW' && el.__vue__ && el.__vue__.getScrollPosition) {
......
......@@ -24,8 +24,12 @@ const createUploadTaskById = function (uploadTaskId, {
files,
header,
formData,
timeout = __uniConfig.networkTimeout.uploadFile ? __uniConfig.networkTimeout.uploadFile / 1000 : 120
timeout
} = {}) {
timeout =
(timeout ||
(__uniConfig.networkTimeout && __uniConfig.networkTimeout.uploadFile) ||
60 * 1000) / 1000
const uploader = plus.uploader.createUpload(url, {
timeout,
// 需要与其它平台上的表现保持一致,不走重试的逻辑。
......
......@@ -28,6 +28,9 @@ function getProxy() {
return proxy;
}
function resolveSyncResult(res) {
if ((process.env.NODE_ENV !== 'production')) {
console.log('uts.invokeSync.result', res);
}
if (res.errMsg) {
throw new Error(res.errMsg);
}
......@@ -38,6 +41,9 @@ function invokePropGetter(args) {
throw new Error(args.errMsg);
}
delete args.errMsg;
if ((process.env.NODE_ENV !== 'production')) {
console.log('uts.invokePropGetter.args', args);
}
return resolveSyncResult(getProxy().invokeSync(args, () => { }));
}
function initProxyFunction(async, { moduleName, moduleType, package: pkg, class: cls, name: propOrMethod, method, companion, params: methodParams, errMsg, }, instanceId) {
......@@ -79,7 +85,13 @@ function initProxyFunction(async, { moduleName, moduleType, package: pkg, class:
});
if (async) {
return new Promise((resolve, reject) => {
if ((process.env.NODE_ENV !== 'production')) {
console.log('uts.invokeAsync.args', invokeArgs);
}
getProxy().invokeAsync(invokeArgs, (res) => {
if ((process.env.NODE_ENV !== 'production')) {
console.log('uts.invokeAsync.result', res);
}
if (res.type !== 'return') {
invokeCallback(res);
}
......@@ -94,6 +106,9 @@ function initProxyFunction(async, { moduleName, moduleType, package: pkg, class:
});
});
}
if ((process.env.NODE_ENV !== 'production')) {
console.log('uts.invokeSync.args', invokeArgs);
}
return resolveSyncResult(getProxy().invokeSync(invokeArgs, invokeCallback));
};
}
......@@ -106,6 +121,12 @@ function initUTSStaticMethod(async, opts) {
return initProxyFunction(async, opts, 0);
}
const initUTSProxyFunction = initUTSStaticMethod;
function parseClassMethodName(name, methods) {
if (hasOwn(methods, name + 'ByJs')) {
return name + 'ByJs';
}
return name;
}
function initUTSProxyClass({ moduleName, moduleType, package: pkg, class: cls, constructor: { params: constructorParams }, methods, props, staticProps, staticMethods, errMsg, }) {
const baseOptions = {
moduleName,
......@@ -114,6 +135,12 @@ function initUTSProxyClass({ moduleName, moduleType, package: pkg, class: cls, c
class: cls,
errMsg,
};
// iOS 需要为 ByJs 的 class 构造函数(如果包含JSONObject或UTSCallback类型)补充最后一个参数
if (typeof plus !== 'undefined' && plus.os.name === 'iOS') {
if (constructorParams.find((p) => p.type === 'UTSCallback' || p.type.indexOf('JSONObject') > 0)) {
constructorParams.push({ name: '_byJs', type: 'boolean' });
}
}
const ProxyClass = class UTSClass {
constructor(...params) {
if (errMsg) {
......@@ -129,6 +156,7 @@ function initUTSProxyClass({ moduleName, moduleType, package: pkg, class: cls, c
get(_, name) {
if (!target[name]) {
//实例方法
name = parseClassMethodName(name, methods);
if (hasOwn(methods, name)) {
const { async, params } = methods[name];
target[name] = initUTSInstanceMethod(!!async, extend({
......@@ -155,6 +183,7 @@ function initUTSProxyClass({ moduleName, moduleType, package: pkg, class: cls, c
const staticMethodCache = {};
return new Proxy(ProxyClass, {
get(target, name, receiver) {
name = parseClassMethodName(name, staticMethods);
if (hasOwn(staticMethods, name)) {
if (!staticMethodCache[name]) {
const { async, params } = staticMethods[name];
......
......@@ -203,6 +203,10 @@ export default {
title: {
type: String,
default: ''
},
isLive: {
type: Boolean,
default: false
}
},
computed: {
......@@ -218,7 +222,13 @@ export default {
},
mounted () {
this._onParentReady(() => {
const video = this.video = plus.video.createVideoPlayer('video' + Date.now(), Object.assign({}, this.attrs, this.position))
const playStrategy = Number(this.isLive ? 3 : this.playStrategy)
const video = this.video = plus.video.createVideoPlayer(
'video' + Date.now(),
Object.assign({}, this.attrs, this.position, {
playStrategy: isNaN(playStrategy) ? 0 : playStrategy
})
)
plus.webview.currentWebview().append(video)
if (this.hidden) {
video.hide()
......
......@@ -424,13 +424,19 @@ export default {
causedBy: 'drag'
}, getMapInfo()))
})
maps.event.addListener(map, 'zoom_changed', () => {
const zoomChangedCallback = () => {
this.$emit('update:scale', map.getZoom())
this.$trigger('regionchange', {}, Object.assign({
type: 'end',
causedBy: 'scale'
}, getMapInfo()))
})
}
// QQ or Google
maps.event.addListener(map, 'zoom_changed', zoomChangedCallback)
// AMAP
maps.event.addListener(map, 'zoomend', zoomChangedCallback)
maps.event.addListener(map, 'center_changed', () => {
var latitude
var longitude
......
......@@ -101,8 +101,16 @@ export default {
marker.dom.addEventListener('click', e => {
this.handleAMapMarkerClick(e, marker)
})
// 地图缩放会触发touchend,故判断 touchstart 和 touchend touches[0] 是否相同确定是否点击
let touchStartTouch = {}
marker.dom.addEventListener('touchstart', e => {
touchStartTouch = e.touches[0]
})
marker.dom.addEventListener('touchend', e => {
this.handleAMapMarkerClick(e, marker)
const touchEndTouch = e.changedTouches[0]
if (touchStartTouch.clientX === touchEndTouch.clientX && touchStartTouch.clientY === touchEndTouch.clientY) {
this.handleAMapMarkerClick(e, marker)
}
})
} else {
maps.event.addListener(marker, 'click', (e) => {
......
......@@ -98,11 +98,6 @@ const canIUses = [
// 需要做转换的 API 列表
const protocols = {
chooseImage: {
args: {
sizeType: false
}
},
navigateTo,
redirectTo,
previewImage,
......
......@@ -10,6 +10,8 @@ import {
import parseComponent from 'uni-platform/runtime/wrapper/component-parser'
import { initWorkletMethods } from './util'
const hooks = [
'onShow',
'onHide',
......@@ -38,6 +40,9 @@ export default function parseBasePage (vuePageOptions) {
} else {
initUnknownHooks(pageOptions.methods, vuePageOptions, ['onReady'])
}
if (__PLATFORM__ === 'mp-weixin') {
initWorkletMethods(pageOptions.methods, vueOptions.methods)
}
return pageOptions
}
......@@ -134,3 +134,17 @@ export function toSkip (obj) {
}
return obj
}
const WORKLET_RE = /_(.*)_worklet_factory_/
export function initWorkletMethods (mpMethods, vueMethods) {
if (vueMethods) {
Object.keys(vueMethods).forEach((name) => {
const matches = name.match(WORKLET_RE)
if (matches) {
const workletName = matches[1]
mpMethods[name] = vueMethods[name]
mpMethods[workletName] = vueMethods[workletName]
}
})
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册