提交 406ee152 编写于 作者: Q qiang

Merge branch 'alpha'

...@@ -59,6 +59,7 @@ uni 统计配置项 ...@@ -59,6 +59,7 @@ uni 统计配置项
|distribute|Object|App 发布信息,[详见](/collocation/manifest?id=distribute)|| |distribute|Object|App 发布信息,[详见](/collocation/manifest?id=distribute)||
|usingComponents|Boolean|是否启用自定义组件模式,默认为false,[编译模式区别详情](https://ask.dcloud.net.cn/article/35843)|1.9.0+| |usingComponents|Boolean|是否启用自定义组件模式,默认为false,[编译模式区别详情](https://ask.dcloud.net.cn/article/35843)|1.9.0+|
|nvueCompiler|String|切换 nvue 编译模式,可选值,`weex` :老编译模式,`uni-app`: 新编译模式,默认为 `weex`[编译模式区别详情](http://ask.dcloud.net.cn/article/36074)|2.0.3+| |nvueCompiler|String|切换 nvue 编译模式,可选值,`weex` :老编译模式,`uni-app`: 新编译模式,默认为 `weex`[编译模式区别详情](http://ask.dcloud.net.cn/article/36074)|2.0.3+|
|nvueStyleCompiler|String|切换 nvue 样式编译模式,可选值,`weex` :老编译模式,`uni-app`: 新编译模式,默认为 `weex`[编译模式区别详情](https://ask.dcloud.net.cn/article/38751)|3.1.1+|
|renderer|String|可不加载基于 webview 的运行框架,减少包体积、提升启动速度。可选值 `native`| App-nvue 2.2.0+| |renderer|String|可不加载基于 webview 的运行框架,减少包体积、提升启动速度。可选值 `native`| App-nvue 2.2.0+|
|compilerVersion|Number|编译器版本,可选值:2、3 默认 2 [详见](https://ask.dcloud.net.cn/article/36599)|HBuilderX alpha 2.4.4+或HBuilderX 2.5.0+| |compilerVersion|Number|编译器版本,可选值:2、3 默认 2 [详见](https://ask.dcloud.net.cn/article/36599)|HBuilderX alpha 2.4.4+或HBuilderX 2.5.0+|
|nvueLaunchMode|Number|Nvue 首页启动模式,在 compilerVersion 值为 3 时生效,可选值:normal、fast 默认 normal(HBuilderX alpha 2.4.4-2.4.9 固定为 fast) [详见](https://ask.dcloud.net.cn/article/36749)|2.5.0+| |nvueLaunchMode|Number|Nvue 首页启动模式,在 compilerVersion 值为 3 时生效,可选值:normal、fast 默认 normal(HBuilderX alpha 2.4.4-2.4.9 固定为 fast) [详见](https://ask.dcloud.net.cn/article/36749)|2.5.0+|
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
|fade-show|Boolean|true|图片显示动画效果|仅App-nvue 2.3.4+ Android有效| |fade-show|Boolean|true|图片显示动画效果|仅App-nvue 2.3.4+ Android有效|
|webp|boolean|false|默认不解析 webP 格式,只支持网络资源|微信小程序2.9.0| |webp|boolean|false|默认不解析 webP 格式,只支持网络资源|微信小程序2.9.0|
|show-menu-by-longpress|boolean|false|开启长按图片显示识别小程序码菜单|微信小程序2.7.0| |show-menu-by-longpress|boolean|false|开启长按图片显示识别小程序码菜单|微信小程序2.7.0|
|draggable|boolean|true|鼠标长按是否能拖动图片|仅 H5 平台 3.1.1+ 有效|
|@error|HandleEvent||当错误发生时,发布到 AppService 的事件名,事件对象event.detail = {errMsg: 'something wrong'}|| |@error|HandleEvent||当错误发生时,发布到 AppService 的事件名,事件对象event.detail = {errMsg: 'something wrong'}||
|@load|HandleEvent||当图片载入完毕时,发布到 AppService 的事件名,事件对象event.detail = {height:'图片高度px', width:'图片宽度px'}| | |@load|HandleEvent||当图片载入完毕时,发布到 AppService 的事件名,事件对象event.detail = {height:'图片高度px', width:'图片宽度px'}| |
......
...@@ -12,5 +12,5 @@ ...@@ -12,5 +12,5 @@
"message": "chore(release): publish %s" "message": "chore(release): publish %s"
} }
}, },
"version": "2.0.0-alpha-31020210201001" "version": "2.0.0-alpha-31120210204001"
} }
{ {
"name": "@dcloudio/uni-app-plus-nvue", "name": "@dcloudio/uni-app-plus-nvue",
"version": "2.0.0-alpha-31020210201001", "version": "2.0.0-alpha-31120210204001",
"description": "uni-app app-plus-nvue", "description": "uni-app app-plus-nvue",
"main": "dist/index.js", "main": "dist/index.js",
"repository": { "repository": {
...@@ -13,5 +13,5 @@ ...@@ -13,5 +13,5 @@
}, },
"author": "fxy060608", "author": "fxy060608",
"license": "Apache-2.0", "license": "Apache-2.0",
"gitHead": "e43df719e16464b00873adb52ac6a64c91036a79" "gitHead": "b366367ac0b63f41ef205dc93eee55d8e9f8f3ed"
} }
...@@ -639,74 +639,6 @@ if (!MPPage.__$wrappered) { ...@@ -639,74 +639,6 @@ if (!MPPage.__$wrappered) {
}; };
} }
class EventChannel {
constructor (id, events) {
this.id = id;
this.listener = {};
this.emitCache = {};
if (events) {
Object.keys(events).forEach(name => {
this.on(name, events[name]);
});
}
}
emit (eventName, ...args) {
const fns = this.listener[eventName];
if (!fns) {
return (this.emitCache[eventName] || (this.emitCache[eventName] = [])).push(args)
}
fns.forEach(opt => {
opt.fn.apply(opt.fn, args);
});
this.listener[eventName] = fns.filter(opt => opt.type !== 'once');
}
on (eventName, fn) {
this._addListener(eventName, 'on', fn);
this._clearCache(eventName);
}
once (eventName, fn) {
this._addListener(eventName, 'once', fn);
this._clearCache(eventName);
}
off (eventName, fn) {
const fns = this.listener[eventName];
if (!fns) {
return
}
if (fn) {
for (let i = 0; i < fns.length;) {
if (fns[i].fn === fn) {
fns.splice(i, 1);
i--;
}
i++;
}
} else {
delete this.listener[eventName];
}
}
_clearCache (eventName) {
const cacheArgs = this.emitCache[eventName];
if (cacheArgs) {
for (; cacheArgs.length > 0;) {
this.emit.apply(this, [eventName].concat(cacheArgs.shift()));
}
}
}
_addListener (eventName, type, fn) {
(this.listener[eventName] || (this.listener[eventName] = [])).push({
fn,
type
});
}
}
const PAGE_EVENT_HOOKS = [ const PAGE_EVENT_HOOKS = [
'onPullDownRefresh', 'onPullDownRefresh',
'onReachBottom', 'onReachBottom',
...@@ -1245,19 +1177,118 @@ function handleEvent (event) { ...@@ -1245,19 +1177,118 @@ function handleEvent (event) {
} }
} }
class EventChannel {
constructor (id, events) {
this.id = id;
this.listener = {};
this.emitCache = {};
if (events) {
Object.keys(events).forEach(name => {
this.on(name, events[name]);
});
}
}
emit (eventName, ...args) {
const fns = this.listener[eventName];
if (!fns) {
return (this.emitCache[eventName] || (this.emitCache[eventName] = [])).push(args)
}
fns.forEach(opt => {
opt.fn.apply(opt.fn, args);
});
this.listener[eventName] = fns.filter(opt => opt.type !== 'once');
}
on (eventName, fn) {
this._addListener(eventName, 'on', fn);
this._clearCache(eventName);
}
once (eventName, fn) {
this._addListener(eventName, 'once', fn);
this._clearCache(eventName);
}
off (eventName, fn) {
const fns = this.listener[eventName];
if (!fns) {
return
}
if (fn) {
for (let i = 0; i < fns.length;) {
if (fns[i].fn === fn) {
fns.splice(i, 1);
i--;
}
i++;
}
} else {
delete this.listener[eventName];
}
}
_clearCache (eventName) {
const cacheArgs = this.emitCache[eventName];
if (cacheArgs) {
for (; cacheArgs.length > 0;) {
this.emit.apply(this, [eventName].concat(cacheArgs.shift()));
}
}
}
_addListener (eventName, type, fn) {
(this.listener[eventName] || (this.listener[eventName] = [])).push({
fn,
type
});
}
}
const eventChannels = {};
const eventChannelStack = [];
function getEventChannel (id) {
if (id) {
const eventChannel = eventChannels[id];
delete eventChannels[id];
return eventChannel
}
return eventChannelStack.shift()
}
const hooks = [ const hooks = [
'onShow', 'onShow',
'onHide', 'onHide',
'onError', 'onError',
'onPageNotFound', 'onPageNotFound',
'onThemeChange', 'onThemeChange',
'onUnhandledRejection' 'onUnhandledRejection'
]; ];
function initEventChannel () {
Vue.prototype.getOpenerEventChannel = function () {
if (!this.__eventChannel__) {
this.__eventChannel__ = new EventChannel();
}
return this.__eventChannel__
};
const callHook = Vue.prototype.__call_hook;
Vue.prototype.__call_hook = function (hook, args) {
if (hook === 'onLoad' && args && args.__id__) {
this.__eventChannel__ = getEventChannel(args.__id__);
delete args.__id__;
}
return callHook.call(this, hook, args)
};
}
function parseBaseApp (vm, { function parseBaseApp (vm, {
mocks, mocks,
initRefs initRefs
}) { }) {
initEventChannel();
if (vm.$options.store) { if (vm.$options.store) {
Vue.prototype.$store = vm.$options.store; Vue.prototype.$store = vm.$options.store;
} }
...@@ -1426,34 +1457,7 @@ function parseApp$1 (vm) { ...@@ -1426,34 +1457,7 @@ function parseApp$1 (vm) {
return appOptions return appOptions
} }
const eventChannels = {};
const eventChannelStack = [];
function getEventChannel (id) {
if (id) {
const eventChannel = eventChannels[id];
delete eventChannels[id];
return eventChannel
}
return eventChannelStack.shift()
}
function createApp (vm) { function createApp (vm) {
Vue.prototype.getOpenerEventChannel = function () {
if (!this.__eventChannel__) {
this.__eventChannel__ = new EventChannel();
}
return this.__eventChannel__
};
const callHook = Vue.prototype.__call_hook;
Vue.prototype.__call_hook = function (hook, args) {
if (hook === 'onLoad' && args && args.__id__) {
this.__eventChannel__ = getEventChannel(args.__id__);
delete args.__id__;
}
return callHook.call(this, hook, args)
};
App(parseApp$1(vm)); App(parseApp$1(vm));
return vm return vm
} }
...@@ -1675,6 +1679,41 @@ function createComponent (vueOptions) { ...@@ -1675,6 +1679,41 @@ function createComponent (vueOptions) {
} }
} }
function createSubpackageApp (vm) {
const appOptions = parseApp$1(vm);
const app = getApp({
allowDefault: true
});
const globalData = app.globalData;
if (globalData) {
Object.keys(appOptions.globalData).forEach(name => {
if (!hasOwn(globalData, name)) {
globalData[name] = appOptions.globalData[name];
}
});
}
Object.keys(appOptions).forEach(name => {
if (!hasOwn(app, name)) {
app[name] = appOptions[name];
}
});
if (isFn(appOptions.onShow) && wx.onAppShow) {
wx.onAppShow((...args) => {
appOptions.onShow.apply(app, args);
});
}
if (isFn(appOptions.onHide) && wx.onAppHide) {
wx.onAppHide((...args) => {
appOptions.onHide.apply(app, args);
});
}
if (isFn(appOptions.onLaunch)) {
const args = wx.getLaunchOptionsSync && wx.getLaunchOptionsSync();
appOptions.onLaunch.call(app, args);
}
return vm
}
todos.forEach(todoApi => { todos.forEach(todoApi => {
protocols[todoApi] = false; protocols[todoApi] = false;
}); });
...@@ -1744,8 +1783,9 @@ if (typeof Proxy !== 'undefined' && "app-plus" !== 'app-plus') { ...@@ -1744,8 +1783,9 @@ if (typeof Proxy !== 'undefined' && "app-plus" !== 'app-plus') {
wx.createApp = createApp; wx.createApp = createApp;
wx.createPage = createPage; wx.createPage = createPage;
wx.createComponent = createComponent; wx.createComponent = createComponent;
wx.createSubpackageApp = createSubpackageApp;
var uni$1 = uni; var uni$1 = uni;
export default uni$1; export default uni$1;
export { createApp, createComponent, createPage }; export { createApp, createComponent, createPage, createSubpackageApp };
...@@ -1356,7 +1356,10 @@ var serviceContext = (function () { ...@@ -1356,7 +1356,10 @@ var serviceContext = (function () {
}, },
extension: { extension: {
type: Array, type: Array,
default: [''] default: [''],
validator (extension, params) {
if (extension.length === 0) { return 'param extension should not be empty.' }
}
} }
}; };
...@@ -1402,7 +1405,7 @@ var serviceContext = (function () { ...@@ -1402,7 +1405,7 @@ var serviceContext = (function () {
type: Array, type: Array,
default: ['*'], default: ['*'],
validator (extension, params) { validator (extension, params) {
if (extension.length === 0) params.extension = ['*']; if (extension.length === 0) { return 'param extension should not be empty.' }
} }
} }
}; };
...@@ -1436,7 +1439,7 @@ var serviceContext = (function () { ...@@ -1436,7 +1439,7 @@ var serviceContext = (function () {
type: Array, type: Array,
default: ['*'], default: ['*'],
validator (extension, params) { validator (extension, params) {
if (extension.length === 0) params.extension = ['*']; if (extension.length === 0) { return 'param extension should not be empty.' }
} }
} }
}; };
......
{ {
"name": "@dcloudio/uni-app-plus", "name": "@dcloudio/uni-app-plus",
"version": "2.0.0-alpha-31020210201001", "version": "2.0.0-alpha-31120210204001",
"description": "uni-app app-plus", "description": "uni-app app-plus",
"main": "dist/index.js", "main": "dist/index.js",
"repository": { "repository": {
...@@ -17,5 +17,5 @@ ...@@ -17,5 +17,5 @@
"name": "app-plus", "name": "app-plus",
"title": "APP-PLUS" "title": "APP-PLUS"
}, },
"gitHead": "e43df719e16464b00873adb52ac6a64c91036a79" "gitHead": "b366367ac0b63f41ef205dc93eee55d8e9f8f3ed"
} }
{ {
"name": "@dcloudio/uni-automator", "name": "@dcloudio/uni-automator",
"version": "2.0.0-alpha-31020210201001", "version": "2.0.0-alpha-31120210204001",
"description": "uni-app automator", "description": "uni-app automator",
"main": "dist/index.js", "main": "dist/index.js",
"repository": { "repository": {
...@@ -30,5 +30,5 @@ ...@@ -30,5 +30,5 @@
"node-simctl": "^6.1.0", "node-simctl": "^6.1.0",
"puppeteer": "^3.0.1" "puppeteer": "^3.0.1"
}, },
"gitHead": "e43df719e16464b00873adb52ac6a64c91036a79" "gitHead": "b366367ac0b63f41ef205dc93eee55d8e9f8f3ed"
} }
{ {
"name": "@dcloudio/uni-cli-shared", "name": "@dcloudio/uni-cli-shared",
"version": "2.0.0-alpha-31020210201001", "version": "2.0.0-alpha-31120210204001",
"description": "uni-cli-shared", "description": "uni-cli-shared",
"main": "lib/index.js", "main": "lib/index.js",
"repository": { "repository": {
...@@ -23,5 +23,5 @@ ...@@ -23,5 +23,5 @@
"postcss-urlrewrite": "^0.2.2", "postcss-urlrewrite": "^0.2.2",
"strip-json-comments": "^2.0.1" "strip-json-comments": "^2.0.1"
}, },
"gitHead": "e43df719e16464b00873adb52ac6a64c91036a79" "gitHead": "b366367ac0b63f41ef205dc93eee55d8e9f8f3ed"
} }
{ {
"name": "@dcloudio/uni-h5-ui", "name": "@dcloudio/uni-h5-ui",
"version": "2.0.0-alpha-31020210201001", "version": "2.0.0-alpha-31120210204001",
"description": "uni-app h5 ui", "description": "uni-app h5 ui",
"main": "dist/index.umd.min.js", "main": "dist/index.umd.min.js",
"repository": { "repository": {
...@@ -13,5 +13,5 @@ ...@@ -13,5 +13,5 @@
}, },
"author": "fxy060608", "author": "fxy060608",
"license": "Apache-2.0", "license": "Apache-2.0",
"gitHead": "e43df719e16464b00873adb52ac6a64c91036a79" "gitHead": "b366367ac0b63f41ef205dc93eee55d8e9f8f3ed"
} }
{ {
"name": "@dcloudio/uni-h5", "name": "@dcloudio/uni-h5",
"version": "2.0.0-alpha-31020210201001", "version": "2.0.0-alpha-31120210204001",
"description": "uni-app h5", "description": "uni-app h5",
"main": "dist/index.umd.min.js", "main": "dist/index.umd.min.js",
"repository": { "repository": {
...@@ -24,5 +24,5 @@ ...@@ -24,5 +24,5 @@
"title": "H5", "title": "H5",
"main": "lib/h5/uni.config.js" "main": "lib/h5/uni.config.js"
}, },
"gitHead": "e43df719e16464b00873adb52ac6a64c91036a79" "gitHead": "b366367ac0b63f41ef205dc93eee55d8e9f8f3ed"
} }
{ {
"name": "@dcloudio/uni-migration", "name": "@dcloudio/uni-migration",
"version": "2.0.0-alpha-31020210201001", "version": "2.0.0-alpha-31120210204001",
"description": "uni-app migration", "description": "uni-app migration",
"main": "lib/index.js", "main": "lib/index.js",
"repository": { "repository": {
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
}, },
"author": "fxy060608", "author": "fxy060608",
"license": "Apache-2.0", "license": "Apache-2.0",
"gitHead": "e43df719e16464b00873adb52ac6a64c91036a79", "gitHead": "b366367ac0b63f41ef205dc93eee55d8e9f8f3ed",
"dependencies": { "dependencies": {
"commander": "^4.0.1", "commander": "^4.0.1",
"fs-extra": "^8.1.0", "fs-extra": "^8.1.0",
......
...@@ -1904,15 +1904,33 @@ const hooks = [ ...@@ -1904,15 +1904,33 @@ const hooks = [
'onShow', 'onShow',
'onHide', 'onHide',
'onError', 'onError',
'onPageNotFound', 'onPageNotFound',
'onThemeChange', 'onThemeChange',
'onUnhandledRejection' 'onUnhandledRejection'
]; ];
function initEventChannel$1 () {
Vue.prototype.getOpenerEventChannel = function () {
if (!this.__eventChannel__) {
this.__eventChannel__ = new EventChannel();
}
return this.__eventChannel__
};
const callHook = Vue.prototype.__call_hook;
Vue.prototype.__call_hook = function (hook, args) {
if (hook === 'onLoad' && args && args.__id__) {
this.__eventChannel__ = getEventChannel(args.__id__);
delete args.__id__;
}
return callHook.call(this, hook, args)
};
}
function parseBaseApp (vm, { function parseBaseApp (vm, {
mocks, mocks,
initRefs initRefs
}) { }) {
initEventChannel$1();
if (vm.$options.store) { if (vm.$options.store) {
Vue.prototype.$store = vm.$options.store; Vue.prototype.$store = vm.$options.store;
} }
...@@ -2316,20 +2334,6 @@ function parseApp (vm) { ...@@ -2316,20 +2334,6 @@ function parseApp (vm) {
} }
function createApp (vm) { function createApp (vm) {
Vue.prototype.getOpenerEventChannel = function () {
if (!this.__eventChannel__) {
this.__eventChannel__ = new EventChannel();
}
return this.__eventChannel__
};
const callHook = Vue.prototype.__call_hook;
Vue.prototype.__call_hook = function (hook, args) {
if (hook === 'onLoad' && args && args.__id__) {
this.__eventChannel__ = getEventChannel(args.__id__);
delete args.__id__;
}
return callHook.call(this, hook, args)
};
App(parseApp(vm)); App(parseApp(vm));
return vm return vm
} }
...@@ -2588,6 +2592,41 @@ function createComponent (vueOptions) { ...@@ -2588,6 +2592,41 @@ function createComponent (vueOptions) {
} }
} }
function createSubpackageApp (vm) {
const appOptions = parseApp(vm);
const app = getApp({
allowDefault: true
});
const globalData = app.globalData;
if (globalData) {
Object.keys(appOptions.globalData).forEach(name => {
if (!hasOwn(globalData, name)) {
globalData[name] = appOptions.globalData[name];
}
});
}
Object.keys(appOptions).forEach(name => {
if (!hasOwn(app, name)) {
app[name] = appOptions[name];
}
});
if (isFn(appOptions.onShow) && my.onAppShow) {
my.onAppShow((...args) => {
appOptions.onShow.apply(app, args);
});
}
if (isFn(appOptions.onHide) && my.onAppHide) {
my.onAppHide((...args) => {
appOptions.onHide.apply(app, args);
});
}
if (isFn(appOptions.onLaunch)) {
const args = my.getLaunchOptionsSync && my.getLaunchOptionsSync();
appOptions.onLaunch.call(app, args);
}
return vm
}
todos.forEach(todoApi => { todos.forEach(todoApi => {
protocols[todoApi] = false; protocols[todoApi] = false;
}); });
...@@ -2667,8 +2706,9 @@ if (typeof Proxy !== 'undefined' && "mp-alipay" !== 'app-plus') { ...@@ -2667,8 +2706,9 @@ if (typeof Proxy !== 'undefined' && "mp-alipay" !== 'app-plus') {
my.createApp = createApp; my.createApp = createApp;
my.createPage = createPage; my.createPage = createPage;
my.createComponent = createComponent; my.createComponent = createComponent;
my.createSubpackageApp = createSubpackageApp;
var uni$1 = uni; var uni$1 = uni;
export default uni$1; export default uni$1;
export { createApp, createComponent, createPage }; export { createApp, createComponent, createPage, createSubpackageApp };
{ {
"name": "@dcloudio/uni-mp-alipay", "name": "@dcloudio/uni-mp-alipay",
"version": "2.0.0-alpha-31020210201001", "version": "2.0.0-alpha-31120210204001",
"description": "uni-app mp-alipay", "description": "uni-app mp-alipay",
"main": "dist/index.js", "main": "dist/index.js",
"repository": { "repository": {
...@@ -17,5 +17,5 @@ ...@@ -17,5 +17,5 @@
"name": "mp-alipay", "name": "mp-alipay",
"title": "支付宝小程序" "title": "支付宝小程序"
}, },
"gitHead": "e43df719e16464b00873adb52ac6a64c91036a79" "gitHead": "b366367ac0b63f41ef205dc93eee55d8e9f8f3ed"
} }
...@@ -1593,15 +1593,33 @@ const hooks = [ ...@@ -1593,15 +1593,33 @@ const hooks = [
'onShow', 'onShow',
'onHide', 'onHide',
'onError', 'onError',
'onPageNotFound', 'onPageNotFound',
'onThemeChange', 'onThemeChange',
'onUnhandledRejection' 'onUnhandledRejection'
]; ];
function initEventChannel$1 () {
Vue.prototype.getOpenerEventChannel = function () {
if (!this.__eventChannel__) {
this.__eventChannel__ = new EventChannel();
}
return this.__eventChannel__
};
const callHook = Vue.prototype.__call_hook;
Vue.prototype.__call_hook = function (hook, args) {
if (hook === 'onLoad' && args && args.__id__) {
this.__eventChannel__ = getEventChannel(args.__id__);
delete args.__id__;
}
return callHook.call(this, hook, args)
};
}
function parseBaseApp (vm, { function parseBaseApp (vm, {
mocks, mocks,
initRefs initRefs
}) { }) {
initEventChannel$1();
if (vm.$options.store) { if (vm.$options.store) {
Vue.prototype.$store = vm.$options.store; Vue.prototype.$store = vm.$options.store;
} }
...@@ -1769,20 +1787,6 @@ function parseApp (vm) { ...@@ -1769,20 +1787,6 @@ function parseApp (vm) {
} }
function createApp (vm) { function createApp (vm) {
Vue.prototype.getOpenerEventChannel = function () {
if (!this.__eventChannel__) {
this.__eventChannel__ = new EventChannel();
}
return this.__eventChannel__
};
const callHook = Vue.prototype.__call_hook;
Vue.prototype.__call_hook = function (hook, args) {
if (hook === 'onLoad' && args && args.__id__) {
this.__eventChannel__ = getEventChannel(args.__id__);
delete args.__id__;
}
return callHook.call(this, hook, args)
};
App(parseApp(vm)); App(parseApp(vm));
return vm return vm
} }
...@@ -2074,6 +2078,41 @@ function createComponent (vueOptions) { ...@@ -2074,6 +2078,41 @@ function createComponent (vueOptions) {
} }
} }
function createSubpackageApp (vm) {
const appOptions = parseApp(vm);
const app = getApp({
allowDefault: true
});
const globalData = app.globalData;
if (globalData) {
Object.keys(appOptions.globalData).forEach(name => {
if (!hasOwn(globalData, name)) {
globalData[name] = appOptions.globalData[name];
}
});
}
Object.keys(appOptions).forEach(name => {
if (!hasOwn(app, name)) {
app[name] = appOptions[name];
}
});
if (isFn(appOptions.onShow) && swan.onAppShow) {
swan.onAppShow((...args) => {
appOptions.onShow.apply(app, args);
});
}
if (isFn(appOptions.onHide) && swan.onAppHide) {
swan.onAppHide((...args) => {
appOptions.onHide.apply(app, args);
});
}
if (isFn(appOptions.onLaunch)) {
const args = swan.getLaunchOptionsSync && swan.getLaunchOptionsSync();
appOptions.onLaunch.call(app, args);
}
return vm
}
todos.forEach(todoApi => { todos.forEach(todoApi => {
protocols[todoApi] = false; protocols[todoApi] = false;
}); });
...@@ -2153,8 +2192,9 @@ if (typeof Proxy !== 'undefined' && "mp-baidu" !== 'app-plus') { ...@@ -2153,8 +2192,9 @@ if (typeof Proxy !== 'undefined' && "mp-baidu" !== 'app-plus') {
swan.createApp = createApp; swan.createApp = createApp;
swan.createPage = createPage; swan.createPage = createPage;
swan.createComponent = createComponent; swan.createComponent = createComponent;
swan.createSubpackageApp = createSubpackageApp;
var uni$1 = uni; var uni$1 = uni;
export default uni$1; export default uni$1;
export { createApp, createComponent, createPage }; export { createApp, createComponent, createPage, createSubpackageApp };
{ {
"name": "@dcloudio/uni-mp-baidu", "name": "@dcloudio/uni-mp-baidu",
"version": "2.0.0-alpha-31020210201001", "version": "2.0.0-alpha-31120210204001",
"description": "uni-app mp-baidu", "description": "uni-app mp-baidu",
"main": "dist/index.js", "main": "dist/index.js",
"repository": { "repository": {
...@@ -17,5 +17,5 @@ ...@@ -17,5 +17,5 @@
"name": "mp-baidu", "name": "mp-baidu",
"title": "百度小程序" "title": "百度小程序"
}, },
"gitHead": "e43df719e16464b00873adb52ac6a64c91036a79" "gitHead": "b366367ac0b63f41ef205dc93eee55d8e9f8f3ed"
} }
...@@ -1345,15 +1345,33 @@ const hooks = [ ...@@ -1345,15 +1345,33 @@ const hooks = [
'onShow', 'onShow',
'onHide', 'onHide',
'onError', 'onError',
'onPageNotFound', 'onPageNotFound',
'onThemeChange', 'onThemeChange',
'onUnhandledRejection' 'onUnhandledRejection'
]; ];
function initEventChannel$1 () {
Vue.prototype.getOpenerEventChannel = function () {
if (!this.__eventChannel__) {
this.__eventChannel__ = new EventChannel();
}
return this.__eventChannel__
};
const callHook = Vue.prototype.__call_hook;
Vue.prototype.__call_hook = function (hook, args) {
if (hook === 'onLoad' && args && args.__id__) {
this.__eventChannel__ = getEventChannel(args.__id__);
delete args.__id__;
}
return callHook.call(this, hook, args)
};
}
function parseBaseApp (vm, { function parseBaseApp (vm, {
mocks, mocks,
initRefs initRefs
}) { }) {
initEventChannel$1();
if (vm.$options.store) { if (vm.$options.store) {
Vue.prototype.$store = vm.$options.store; Vue.prototype.$store = vm.$options.store;
} }
...@@ -1515,20 +1533,6 @@ function parseApp$1 (vm) { ...@@ -1515,20 +1533,6 @@ function parseApp$1 (vm) {
} }
function createApp (vm) { function createApp (vm) {
Vue.prototype.getOpenerEventChannel = function () {
if (!this.__eventChannel__) {
this.__eventChannel__ = new EventChannel();
}
return this.__eventChannel__
};
const callHook = Vue.prototype.__call_hook;
Vue.prototype.__call_hook = function (hook, args) {
if (hook === 'onLoad' && args && args.__id__) {
this.__eventChannel__ = getEventChannel(args.__id__);
delete args.__id__;
}
return callHook.call(this, hook, args)
};
App(parseApp$1(vm)); App(parseApp$1(vm));
return vm return vm
} }
...@@ -1732,6 +1736,41 @@ function createComponent (vueOptions) { ...@@ -1732,6 +1736,41 @@ function createComponent (vueOptions) {
} }
} }
function createSubpackageApp (vm) {
const appOptions = parseApp$1(vm);
const app = getApp({
allowDefault: true
});
const globalData = app.globalData;
if (globalData) {
Object.keys(appOptions.globalData).forEach(name => {
if (!hasOwn(globalData, name)) {
globalData[name] = appOptions.globalData[name];
}
});
}
Object.keys(appOptions).forEach(name => {
if (!hasOwn(app, name)) {
app[name] = appOptions[name];
}
});
if (isFn(appOptions.onShow) && ks.onAppShow) {
ks.onAppShow((...args) => {
appOptions.onShow.apply(app, args);
});
}
if (isFn(appOptions.onHide) && ks.onAppHide) {
ks.onAppHide((...args) => {
appOptions.onHide.apply(app, args);
});
}
if (isFn(appOptions.onLaunch)) {
const args = ks.getLaunchOptionsSync && ks.getLaunchOptionsSync();
appOptions.onLaunch.call(app, args);
}
return vm
}
todos.forEach(todoApi => { todos.forEach(todoApi => {
protocols[todoApi] = false; protocols[todoApi] = false;
}); });
...@@ -1811,8 +1850,9 @@ if (typeof Proxy !== 'undefined' && "mp-kuaishou" !== 'app-plus') { ...@@ -1811,8 +1850,9 @@ if (typeof Proxy !== 'undefined' && "mp-kuaishou" !== 'app-plus') {
ks.createApp = createApp; ks.createApp = createApp;
ks.createPage = createPage; ks.createPage = createPage;
ks.createComponent = createComponent; ks.createComponent = createComponent;
ks.createSubpackageApp = createSubpackageApp;
var uni$1 = uni; var uni$1 = uni;
export default uni$1; export default uni$1;
export { createApp, createComponent, createPage }; export { createApp, createComponent, createPage, createSubpackageApp };
{ {
"name": "@dcloudio/uni-mp-kuaishou", "name": "@dcloudio/uni-mp-kuaishou",
"version": "2.0.0-alpha-31020210201001", "version": "2.0.0-alpha-31120210204001",
"description": "uni-app mp-kuaishou", "description": "uni-app mp-kuaishou",
"main": "dist/index.js", "main": "dist/index.js",
"repository": { "repository": {
...@@ -17,5 +17,5 @@ ...@@ -17,5 +17,5 @@
"name": "mp-kuaishou", "name": "mp-kuaishou",
"title": "快手小程序" "title": "快手小程序"
}, },
"gitHead": "e43df719e16464b00873adb52ac6a64c91036a79" "gitHead": "b366367ac0b63f41ef205dc93eee55d8e9f8f3ed"
} }
...@@ -1506,15 +1506,33 @@ const hooks = [ ...@@ -1506,15 +1506,33 @@ const hooks = [
'onShow', 'onShow',
'onHide', 'onHide',
'onError', 'onError',
'onPageNotFound', 'onPageNotFound',
'onThemeChange', 'onThemeChange',
'onUnhandledRejection' 'onUnhandledRejection'
]; ];
function initEventChannel$1 () {
Vue.prototype.getOpenerEventChannel = function () {
if (!this.__eventChannel__) {
this.__eventChannel__ = new EventChannel();
}
return this.__eventChannel__
};
const callHook = Vue.prototype.__call_hook;
Vue.prototype.__call_hook = function (hook, args) {
if (hook === 'onLoad' && args && args.__id__) {
this.__eventChannel__ = getEventChannel(args.__id__);
delete args.__id__;
}
return callHook.call(this, hook, args)
};
}
function parseBaseApp (vm, { function parseBaseApp (vm, {
mocks, mocks,
initRefs initRefs
}) { }) {
initEventChannel$1();
if (vm.$options.store) { if (vm.$options.store) {
Vue.prototype.$store = vm.$options.store; Vue.prototype.$store = vm.$options.store;
} }
...@@ -1681,20 +1699,6 @@ function parseApp$1 (vm) { ...@@ -1681,20 +1699,6 @@ function parseApp$1 (vm) {
} }
function createApp (vm) { function createApp (vm) {
Vue.prototype.getOpenerEventChannel = function () {
if (!this.__eventChannel__) {
this.__eventChannel__ = new EventChannel();
}
return this.__eventChannel__
};
const callHook = Vue.prototype.__call_hook;
Vue.prototype.__call_hook = function (hook, args) {
if (hook === 'onLoad' && args && args.__id__) {
this.__eventChannel__ = getEventChannel(args.__id__);
delete args.__id__;
}
return callHook.call(this, hook, args)
};
App(parseApp$1(vm)); App(parseApp$1(vm));
return vm return vm
} }
...@@ -1905,6 +1909,41 @@ function createComponent (vueOptions) { ...@@ -1905,6 +1909,41 @@ function createComponent (vueOptions) {
} }
} }
function createSubpackageApp (vm) {
const appOptions = parseApp$1(vm);
const app = getApp({
allowDefault: true
});
const globalData = app.globalData;
if (globalData) {
Object.keys(appOptions.globalData).forEach(name => {
if (!hasOwn(globalData, name)) {
globalData[name] = appOptions.globalData[name];
}
});
}
Object.keys(appOptions).forEach(name => {
if (!hasOwn(app, name)) {
app[name] = appOptions[name];
}
});
if (isFn(appOptions.onShow) && wx.onAppShow) {
wx.onAppShow((...args) => {
appOptions.onShow.apply(app, args);
});
}
if (isFn(appOptions.onHide) && wx.onAppHide) {
wx.onAppHide((...args) => {
appOptions.onHide.apply(app, args);
});
}
if (isFn(appOptions.onLaunch)) {
const args = wx.getLaunchOptionsSync && wx.getLaunchOptionsSync();
appOptions.onLaunch.call(app, args);
}
return vm
}
todos.forEach(todoApi => { todos.forEach(todoApi => {
protocols[todoApi] = false; protocols[todoApi] = false;
}); });
...@@ -1984,8 +2023,9 @@ if (typeof Proxy !== 'undefined' && "mp-qq" !== 'app-plus') { ...@@ -1984,8 +2023,9 @@ if (typeof Proxy !== 'undefined' && "mp-qq" !== 'app-plus') {
wx.createApp = createApp; wx.createApp = createApp;
wx.createPage = createPage; wx.createPage = createPage;
wx.createComponent = createComponent; wx.createComponent = createComponent;
wx.createSubpackageApp = createSubpackageApp;
var uni$1 = uni; var uni$1 = uni;
export default uni$1; export default uni$1;
export { createApp, createComponent, createPage }; export { createApp, createComponent, createPage, createSubpackageApp };
{ {
"name": "@dcloudio/uni-mp-qq", "name": "@dcloudio/uni-mp-qq",
"version": "2.0.0-alpha-31020210201001", "version": "2.0.0-alpha-31120210204001",
"description": "uni-app mp-qq", "description": "uni-app mp-qq",
"main": "dist/index.js", "main": "dist/index.js",
"repository": { "repository": {
...@@ -17,5 +17,5 @@ ...@@ -17,5 +17,5 @@
"name": "mp-qq", "name": "mp-qq",
"title": "QQ小程序" "title": "QQ小程序"
}, },
"gitHead": "e43df719e16464b00873adb52ac6a64c91036a79" "gitHead": "b366367ac0b63f41ef205dc93eee55d8e9f8f3ed"
} }
...@@ -1598,15 +1598,33 @@ const hooks = [ ...@@ -1598,15 +1598,33 @@ const hooks = [
'onShow', 'onShow',
'onHide', 'onHide',
'onError', 'onError',
'onPageNotFound', 'onPageNotFound',
'onThemeChange', 'onThemeChange',
'onUnhandledRejection' 'onUnhandledRejection'
]; ];
function initEventChannel$1 () {
Vue.prototype.getOpenerEventChannel = function () {
if (!this.__eventChannel__) {
this.__eventChannel__ = new EventChannel();
}
return this.__eventChannel__
};
const callHook = Vue.prototype.__call_hook;
Vue.prototype.__call_hook = function (hook, args) {
if (hook === 'onLoad' && args && args.__id__) {
this.__eventChannel__ = getEventChannel(args.__id__);
delete args.__id__;
}
return callHook.call(this, hook, args)
};
}
function parseBaseApp (vm, { function parseBaseApp (vm, {
mocks, mocks,
initRefs initRefs
}) { }) {
initEventChannel$1();
if (vm.$options.store) { if (vm.$options.store) {
Vue.prototype.$store = vm.$options.store; Vue.prototype.$store = vm.$options.store;
} }
...@@ -1848,20 +1866,6 @@ function parseApp (vm) { ...@@ -1848,20 +1866,6 @@ function parseApp (vm) {
} }
function createApp (vm) { function createApp (vm) {
Vue.prototype.getOpenerEventChannel = function () {
if (!this.__eventChannel__) {
this.__eventChannel__ = new EventChannel();
}
return this.__eventChannel__
};
const callHook = Vue.prototype.__call_hook;
Vue.prototype.__call_hook = function (hook, args) {
if (hook === 'onLoad' && args && args.__id__) {
this.__eventChannel__ = getEventChannel(args.__id__);
delete args.__id__;
}
return callHook.call(this, hook, args)
};
App(parseApp(vm)); App(parseApp(vm));
return vm return vm
} }
...@@ -2113,6 +2117,41 @@ function createComponent (vueOptions) { ...@@ -2113,6 +2117,41 @@ function createComponent (vueOptions) {
} }
} }
function createSubpackageApp (vm) {
const appOptions = parseApp(vm);
const app = getApp({
allowDefault: true
});
const globalData = app.globalData;
if (globalData) {
Object.keys(appOptions.globalData).forEach(name => {
if (!hasOwn(globalData, name)) {
globalData[name] = appOptions.globalData[name];
}
});
}
Object.keys(appOptions).forEach(name => {
if (!hasOwn(app, name)) {
app[name] = appOptions[name];
}
});
if (isFn(appOptions.onShow) && tt.onAppShow) {
tt.onAppShow((...args) => {
appOptions.onShow.apply(app, args);
});
}
if (isFn(appOptions.onHide) && tt.onAppHide) {
tt.onAppHide((...args) => {
appOptions.onHide.apply(app, args);
});
}
if (isFn(appOptions.onLaunch)) {
const args = tt.getLaunchOptionsSync && tt.getLaunchOptionsSync();
appOptions.onLaunch.call(app, args);
}
return vm
}
todos.forEach(todoApi => { todos.forEach(todoApi => {
protocols[todoApi] = false; protocols[todoApi] = false;
}); });
...@@ -2192,8 +2231,9 @@ if (typeof Proxy !== 'undefined' && "mp-toutiao" !== 'app-plus') { ...@@ -2192,8 +2231,9 @@ if (typeof Proxy !== 'undefined' && "mp-toutiao" !== 'app-plus') {
tt.createApp = createApp; tt.createApp = createApp;
tt.createPage = createPage; tt.createPage = createPage;
tt.createComponent = createComponent; tt.createComponent = createComponent;
tt.createSubpackageApp = createSubpackageApp;
var uni$1 = uni; var uni$1 = uni;
export default uni$1; export default uni$1;
export { createApp, createComponent, createPage }; export { createApp, createComponent, createPage, createSubpackageApp };
{ {
"name": "@dcloudio/uni-mp-toutiao", "name": "@dcloudio/uni-mp-toutiao",
"version": "2.0.0-alpha-31020210201001", "version": "2.0.0-alpha-31120210204001",
"description": "uni-app mp-toutiao", "description": "uni-app mp-toutiao",
"main": "dist/index.js", "main": "dist/index.js",
"repository": { "repository": {
...@@ -17,5 +17,5 @@ ...@@ -17,5 +17,5 @@
"name": "mp-toutiao", "name": "mp-toutiao",
"title": "字节跳动小程序" "title": "字节跳动小程序"
}, },
"gitHead": "e43df719e16464b00873adb52ac6a64c91036a79" "gitHead": "b366367ac0b63f41ef205dc93eee55d8e9f8f3ed"
} }
...@@ -2990,6 +2990,7 @@ function createComponentInstance(vnode, parent, suspense) { ...@@ -2990,6 +2990,7 @@ function createComponentInstance(vnode, parent, suspense) {
return instance; return instance;
} }
let currentInstance = null; let currentInstance = null;
const getCurrentInstance = () => currentInstance || currentRenderingInstance;
const setCurrentInstance = (instance) => { const setCurrentInstance = (instance) => {
currentInstance = instance; currentInstance = instance;
}; };
...@@ -3247,7 +3248,7 @@ function defineEmit() { ...@@ -3247,7 +3248,7 @@ function defineEmit() {
} }
// Core API ------------------------------------------------------------------ // Core API ------------------------------------------------------------------
const version = "3.0.4"; const version = "3.0.5";
// import deepCopy from './deepCopy' // import deepCopy from './deepCopy'
/** /**
...@@ -3661,7 +3662,7 @@ function createVueApp(rootComponent, rootProps = null) { ...@@ -3661,7 +3662,7 @@ function createVueApp(rootComponent, rootProps = null) {
} }
function applyOptions$1(options, instance, publicThis) { function applyOptions$1(options, instance, publicThis) {
Object.keys(options).forEach(name => { Object.keys(options).forEach((name) => {
if (name.indexOf('on') === 0) { if (name.indexOf('on') === 0) {
const hook = options[name]; const hook = options[name];
if (isFunction(hook)) { if (isFunction(hook)) {
...@@ -3737,7 +3738,7 @@ var plugin = { ...@@ -3737,7 +3738,7 @@ var plugin = {
createMiniProgramApp(instance); createMiniProgramApp(instance);
return instance; return instance;
}; };
} },
}; };
// @ts-ignore // @ts-ignore
...@@ -3773,4 +3774,4 @@ function createApp(rootComponent, rootProps = null) { ...@@ -3773,4 +3774,4 @@ function createApp(rootComponent, rootProps = null) {
return createVueApp(rootComponent, rootProps).use(plugin); return createVueApp(rootComponent, rootProps).use(plugin);
} }
export { callWithAsyncErrorHandling, callWithErrorHandling, computed$1 as computed, createApp, createHook$1 as createHook, createVueApp, customRef, defineComponent, defineEmit, defineProps, inject, injectHook, isInSSRComponentSetup, isProxy, isReactive, isReadonly, isRef, logError, markRaw, nextTick, onActivated, onAddToFavorites, onBackPress, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onError, onErrorCaptured, onHide, onLaunch, onLoad, onMounted, onNavigationBarButtonTap, onNavigationBarSearchInputChanged, onNavigationBarSearchInputClicked, onNavigationBarSearchInputConfirmed, onNavigationBarSearchInputFocusChanged, onPageNotFound, onPageScroll, onPullDownRefresh, onReachBottom, onReady, onRenderTracked, onRenderTriggered, onResize, onShareAppMessage, onShareTimeline, onShow, onTabItemTap, onThemeChange, onUnhandledRejection, onUnload, onUnmounted, onUpdated, provide, reactive, readonly, ref, resolveDirective, shallowReactive, shallowReadonly, shallowRef, toRaw, toRef, toRefs, triggerRef, unref, version, warn, watch, watchEffect, withDirectives }; export { callWithAsyncErrorHandling, callWithErrorHandling, computed$1 as computed, createApp, createHook$1 as createHook, createVueApp, customRef, defineComponent, defineEmit, defineProps, getCurrentInstance, inject, injectHook, isInSSRComponentSetup, isProxy, isReactive, isReadonly, isRef, logError, markRaw, nextTick, onActivated, onAddToFavorites, onBackPress, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onError, onErrorCaptured, onHide, onLaunch, onLoad, onMounted, onNavigationBarButtonTap, onNavigationBarSearchInputChanged, onNavigationBarSearchInputClicked, onNavigationBarSearchInputConfirmed, onNavigationBarSearchInputFocusChanged, onPageNotFound, onPageScroll, onPullDownRefresh, onReachBottom, onReady, onRenderTracked, onRenderTriggered, onResize, onShareAppMessage, onShareTimeline, onShow, onTabItemTap, onThemeChange, onUnhandledRejection, onUnload, onUnmounted, onUpdated, provide, reactive, readonly, ref, resolveDirective, shallowReactive, shallowReadonly, shallowRef, toRaw, toRef, toRefs, triggerRef, unref, version, warn, watch, watchEffect, withDirectives };
{ {
"name": "@dcloudio/uni-mp-vue", "name": "@dcloudio/uni-mp-vue",
"version": "2.0.0-alpha-31020210201001", "version": "2.0.0-alpha-31120210204001",
"description": "@dcloudio/uni-mp-vue", "description": "@dcloudio/uni-mp-vue",
"main": "dist/vue.runtime.esm.js", "main": "dist/vue.runtime.esm.js",
"module": "dist/vue.runtime.esm.js", "module": "dist/vue.runtime.esm.js",
...@@ -23,5 +23,5 @@ ...@@ -23,5 +23,5 @@
"bugs": { "bugs": {
"url": "https://github.com/dcloudio/uni-app/issues" "url": "https://github.com/dcloudio/uni-app/issues"
}, },
"gitHead": "e43df719e16464b00873adb52ac6a64c91036a79" "gitHead": "b366367ac0b63f41ef205dc93eee55d8e9f8f3ed"
} }
...@@ -1246,19 +1246,50 @@ function handleEvent (event) { ...@@ -1246,19 +1246,50 @@ function handleEvent (event) {
} }
} }
const eventChannels = {};
const eventChannelStack = [];
function getEventChannel (id) {
if (id) {
const eventChannel = eventChannels[id];
delete eventChannels[id];
return eventChannel
}
return eventChannelStack.shift()
}
const hooks = [ const hooks = [
'onShow', 'onShow',
'onHide', 'onHide',
'onError', 'onError',
'onPageNotFound', 'onPageNotFound',
'onThemeChange', 'onThemeChange',
'onUnhandledRejection' 'onUnhandledRejection'
]; ];
function initEventChannel () {
Vue.prototype.getOpenerEventChannel = function () {
// 微信小程序使用自身getOpenerEventChannel
{
return this.$scope.getOpenerEventChannel()
}
};
const callHook = Vue.prototype.__call_hook;
Vue.prototype.__call_hook = function (hook, args) {
if (hook === 'onLoad' && args && args.__id__) {
this.__eventChannel__ = getEventChannel(args.__id__);
delete args.__id__;
}
return callHook.call(this, hook, args)
};
}
function parseBaseApp (vm, { function parseBaseApp (vm, {
mocks, mocks,
initRefs initRefs
}) { }) {
initEventChannel();
if (vm.$options.store) { if (vm.$options.store) {
Vue.prototype.$store = vm.$options.store; Vue.prototype.$store = vm.$options.store;
} }
...@@ -1427,34 +1458,7 @@ function parseApp (vm) { ...@@ -1427,34 +1458,7 @@ function parseApp (vm) {
}) })
} }
const eventChannels = {};
const eventChannelStack = [];
function getEventChannel (id) {
if (id) {
const eventChannel = eventChannels[id];
delete eventChannels[id];
return eventChannel
}
return eventChannelStack.shift()
}
function createApp (vm) { function createApp (vm) {
Vue.prototype.getOpenerEventChannel = function () {
// 微信小程序使用自身getOpenerEventChannel
{
return this.$scope.getOpenerEventChannel()
}
};
const callHook = Vue.prototype.__call_hook;
Vue.prototype.__call_hook = function (hook, args) {
if (hook === 'onLoad' && args && args.__id__) {
this.__eventChannel__ = getEventChannel(args.__id__);
delete args.__id__;
}
return callHook.call(this, hook, args)
};
App(parseApp(vm)); App(parseApp(vm));
return vm return vm
} }
...@@ -1657,6 +1661,41 @@ function createComponent (vueOptions) { ...@@ -1657,6 +1661,41 @@ function createComponent (vueOptions) {
} }
} }
function createSubpackageApp (vm) {
const appOptions = parseApp(vm);
const app = getApp({
allowDefault: true
});
const globalData = app.globalData;
if (globalData) {
Object.keys(appOptions.globalData).forEach(name => {
if (!hasOwn(globalData, name)) {
globalData[name] = appOptions.globalData[name];
}
});
}
Object.keys(appOptions).forEach(name => {
if (!hasOwn(app, name)) {
app[name] = appOptions[name];
}
});
if (isFn(appOptions.onShow) && wx.onAppShow) {
wx.onAppShow((...args) => {
appOptions.onShow.apply(app, args);
});
}
if (isFn(appOptions.onHide) && wx.onAppHide) {
wx.onAppHide((...args) => {
appOptions.onHide.apply(app, args);
});
}
if (isFn(appOptions.onLaunch)) {
const args = wx.getLaunchOptionsSync && wx.getLaunchOptionsSync();
appOptions.onLaunch.call(app, args);
}
return vm
}
todos.forEach(todoApi => { todos.forEach(todoApi => {
protocols[todoApi] = false; protocols[todoApi] = false;
}); });
...@@ -1736,8 +1775,9 @@ if (typeof Proxy !== 'undefined' && "mp-weixin" !== 'app-plus') { ...@@ -1736,8 +1775,9 @@ if (typeof Proxy !== 'undefined' && "mp-weixin" !== 'app-plus') {
wx.createApp = createApp; wx.createApp = createApp;
wx.createPage = createPage; wx.createPage = createPage;
wx.createComponent = createComponent; wx.createComponent = createComponent;
wx.createSubpackageApp = createSubpackageApp;
var uni$1 = uni; var uni$1 = uni;
export default uni$1; export default uni$1;
export { createApp, createComponent, createPage }; export { createApp, createComponent, createPage, createSubpackageApp };
{ {
"name": "@dcloudio/uni-mp-weixin", "name": "@dcloudio/uni-mp-weixin",
"version": "2.0.0-alpha-31020210201001", "version": "2.0.0-alpha-31120210204001",
"description": "uni-app mp-weixin", "description": "uni-app mp-weixin",
"main": "dist/index.js", "main": "dist/index.js",
"repository": { "repository": {
...@@ -17,5 +17,5 @@ ...@@ -17,5 +17,5 @@
"name": "mp-weixin", "name": "mp-weixin",
"title": "微信小程序" "title": "微信小程序"
}, },
"gitHead": "e43df719e16464b00873adb52ac6a64c91036a79" "gitHead": "b366367ac0b63f41ef205dc93eee55d8e9f8f3ed"
} }
{ {
"name": "@dcloudio/uni-quickapp-native", "name": "@dcloudio/uni-quickapp-native",
"version": "2.0.0-alpha-31020210201001", "version": "2.0.0-alpha-31120210204001",
"description": "uni-app quickapp-native", "description": "uni-app quickapp-native",
"main": "dist/vue.prod.js", "main": "dist/vue.prod.js",
"repository": { "repository": {
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
}, },
"author": "fxy060608", "author": "fxy060608",
"license": "Apache-2.0", "license": "Apache-2.0",
"gitHead": "e43df719e16464b00873adb52ac6a64c91036a79", "gitHead": "b366367ac0b63f41ef205dc93eee55d8e9f8f3ed",
"uni-app": { "uni-app": {
"name": "quickapp-native", "name": "quickapp-native",
"title": "快应用(Native)版" "title": "快应用(Native)版"
......
...@@ -1320,15 +1320,33 @@ const hooks = [ ...@@ -1320,15 +1320,33 @@ const hooks = [
'onShow', 'onShow',
'onHide', 'onHide',
'onError', 'onError',
'onPageNotFound', 'onPageNotFound',
'onThemeChange', 'onThemeChange',
'onUnhandledRejection' 'onUnhandledRejection'
]; ];
function initEventChannel$1 () {
Vue.prototype.getOpenerEventChannel = function () {
if (!this.__eventChannel__) {
this.__eventChannel__ = new EventChannel();
}
return this.__eventChannel__
};
const callHook = Vue.prototype.__call_hook;
Vue.prototype.__call_hook = function (hook, args) {
if (hook === 'onLoad' && args && args.__id__) {
this.__eventChannel__ = getEventChannel(args.__id__);
delete args.__id__;
}
return callHook.call(this, hook, args)
};
}
function parseBaseApp (vm, { function parseBaseApp (vm, {
mocks, mocks,
initRefs initRefs
}) { }) {
initEventChannel$1();
if (vm.$options.store) { if (vm.$options.store) {
Vue.prototype.$store = vm.$options.store; Vue.prototype.$store = vm.$options.store;
} }
...@@ -1558,20 +1576,6 @@ function parseApp (vm) { ...@@ -1558,20 +1576,6 @@ function parseApp (vm) {
} }
function createApp (vm) { function createApp (vm) {
Vue.prototype.getOpenerEventChannel = function () {
if (!this.__eventChannel__) {
this.__eventChannel__ = new EventChannel();
}
return this.__eventChannel__
};
const callHook = Vue.prototype.__call_hook;
Vue.prototype.__call_hook = function (hook, args) {
if (hook === 'onLoad' && args && args.__id__) {
this.__eventChannel__ = getEventChannel(args.__id__);
delete args.__id__;
}
return callHook.call(this, hook, args)
};
App(parseApp(vm)); App(parseApp(vm));
return vm return vm
} }
...@@ -1823,6 +1827,41 @@ function createComponent (vueOptions) { ...@@ -1823,6 +1827,41 @@ function createComponent (vueOptions) {
} }
} }
function createSubpackageApp (vm) {
const appOptions = parseApp(vm);
const app = getApp({
allowDefault: true
});
const globalData = app.globalData;
if (globalData) {
Object.keys(appOptions.globalData).forEach(name => {
if (!hasOwn(globalData, name)) {
globalData[name] = appOptions.globalData[name];
}
});
}
Object.keys(appOptions).forEach(name => {
if (!hasOwn(app, name)) {
app[name] = appOptions[name];
}
});
if (isFn(appOptions.onShow) && qa.onAppShow) {
qa.onAppShow((...args) => {
appOptions.onShow.apply(app, args);
});
}
if (isFn(appOptions.onHide) && qa.onAppHide) {
qa.onAppHide((...args) => {
appOptions.onHide.apply(app, args);
});
}
if (isFn(appOptions.onLaunch)) {
const args = qa.getLaunchOptionsSync && qa.getLaunchOptionsSync();
appOptions.onLaunch.call(app, args);
}
return vm
}
todos.forEach(todoApi => { todos.forEach(todoApi => {
protocols[todoApi] = false; protocols[todoApi] = false;
}); });
...@@ -1902,8 +1941,9 @@ if (typeof Proxy !== 'undefined' && "quickapp-webview" !== 'app-plus') { ...@@ -1902,8 +1941,9 @@ if (typeof Proxy !== 'undefined' && "quickapp-webview" !== 'app-plus') {
qa.createApp = createApp; qa.createApp = createApp;
qa.createPage = createPage; qa.createPage = createPage;
qa.createComponent = createComponent; qa.createComponent = createComponent;
qa.createSubpackageApp = createSubpackageApp;
var uni$1 = uni; var uni$1 = uni;
export default uni$1; export default uni$1;
export { createApp, createComponent, createPage }; export { createApp, createComponent, createPage, createSubpackageApp };
{ {
"name": "@dcloudio/uni-quickapp-webview", "name": "@dcloudio/uni-quickapp-webview",
"version": "2.0.0-alpha-31020210201001", "version": "2.0.0-alpha-31120210204001",
"description": "uni-app quickapp-webview", "description": "uni-app quickapp-webview",
"main": "dist/index.js", "main": "dist/index.js",
"repository": { "repository": {
...@@ -17,5 +17,5 @@ ...@@ -17,5 +17,5 @@
"name": "quickapp-webview", "name": "quickapp-webview",
"title": "快应用(Webview)版" "title": "快应用(Webview)版"
}, },
"gitHead": "e43df719e16464b00873adb52ac6a64c91036a79" "gitHead": "b366367ac0b63f41ef205dc93eee55d8e9f8f3ed"
} }
{ {
"name": "@dcloudio/uni-stat", "name": "@dcloudio/uni-stat",
"version": "2.0.0-alpha-31020210201001", "version": "2.0.0-alpha-31120210204001",
"description": "", "description": "",
"main": "dist/index.js", "main": "dist/index.js",
"repository": { "repository": {
...@@ -34,5 +34,5 @@ ...@@ -34,5 +34,5 @@
"rollup-plugin-replace": "^2.2.0", "rollup-plugin-replace": "^2.2.0",
"rollup-plugin-uglify": "^6.0.2" "rollup-plugin-uglify": "^6.0.2"
}, },
"gitHead": "e43df719e16464b00873adb52ac6a64c91036a79" "gitHead": "b366367ac0b63f41ef205dc93eee55d8e9f8f3ed"
} }
{ {
"name": "@dcloudio/uni-template-compiler", "name": "@dcloudio/uni-template-compiler",
"version": "2.0.0-alpha-31020210201001", "version": "2.0.0-alpha-31120210204001",
"description": "uni-template-compiler", "description": "uni-template-compiler",
"main": "lib/index.js", "main": "lib/index.js",
"repository": { "repository": {
...@@ -22,5 +22,5 @@ ...@@ -22,5 +22,5 @@
"@babel/types": "^7.3.3", "@babel/types": "^7.3.3",
"vue-template-compiler": "^2.6.10" "vue-template-compiler": "^2.6.10"
}, },
"gitHead": "e43df719e16464b00873adb52ac6a64c91036a79" "gitHead": "b366367ac0b63f41ef205dc93eee55d8e9f8f3ed"
} }
{ {
"name": "@dcloudio/vue-cli-plugin-hbuilderx", "name": "@dcloudio/vue-cli-plugin-hbuilderx",
"version": "2.0.0-alpha-31020210201001", "version": "2.0.0-alpha-31120210204001",
"description": "HBuilderX plugin for vue-cli 3", "description": "HBuilderX plugin for vue-cli 3",
"main": "index.js", "main": "index.js",
"repository": { "repository": {
...@@ -18,5 +18,5 @@ ...@@ -18,5 +18,5 @@
"css": "~2.2.1", "css": "~2.2.1",
"escodegen": "^1.8.1" "escodegen": "^1.8.1"
}, },
"gitHead": "e43df719e16464b00873adb52ac6a64c91036a79" "gitHead": "b366367ac0b63f41ef205dc93eee55d8e9f8f3ed"
} }
...@@ -69,6 +69,7 @@ module.exports = function (content, map) { ...@@ -69,6 +69,7 @@ module.exports = function (content, map) {
} }
Object.assign(appJson.globalStyle, appJson.globalStyle['app-plus'] || {}) Object.assign(appJson.globalStyle, appJson.globalStyle['app-plus'] || {})
pageJson.style = pageJson.style || {}
Object.assign(pageJson.style, pageJson.style['app-plus'] || {}) Object.assign(pageJson.style, pageJson.style['app-plus'] || {})
const pageJsonStyle = Object.assign(appJson.globalStyle, pageJson.style) const pageJsonStyle = Object.assign(appJson.globalStyle, pageJson.style)
if (pageJsonStyle.disableScroll === true) { if (pageJsonStyle.disableScroll === true) {
...@@ -78,4 +79,4 @@ module.exports = function (content, map) { ...@@ -78,4 +79,4 @@ module.exports = function (content, map) {
this.callback(null, this.callback(null,
`<scroll-view :scroll-y="true" :show-scrollbar="${pageJsonStyle.scrollIndicator === 'none' ? 'false' : 'true'}" :enableBackToTop="true" bubble="true" style="flex-direction:column">${content}</scroll-view>`, `<scroll-view :scroll-y="true" :show-scrollbar="${pageJsonStyle.scrollIndicator === 'none' ? 'false' : 'true'}" :enableBackToTop="true" bubble="true" style="flex-direction:column">${content}</scroll-view>`,
map) map)
} }
...@@ -76,7 +76,7 @@ function borderProperty (declaration) { ...@@ -76,7 +76,7 @@ function borderProperty (declaration) {
var { value, important } = clearImportant(declaration.value) var { value, important } = clearImportant(declaration.value)
var position = declaration.position var position = declaration.position
var property = declaration.property.split('-')[1] var property = declaration.property.split('-')[1]
var splitResult = value.split(/\s+/) var splitResult = value.replace(/\s*,\s*/g, ',').split(/\s+/)
var result = [] var result = []
switch (splitResult.length) { switch (splitResult.length) {
case 1: case 1:
......
{ {
"name": "@dcloudio/vue-cli-plugin-uni-optimize", "name": "@dcloudio/vue-cli-plugin-uni-optimize",
"version": "2.0.0-alpha-31020210201001", "version": "2.0.0-alpha-31120210204001",
"description": "uni-app optimize plugin for vue-cli 3", "description": "uni-app optimize plugin for vue-cli 3",
"main": "index.js", "main": "index.js",
"repository": { "repository": {
...@@ -13,5 +13,5 @@ ...@@ -13,5 +13,5 @@
}, },
"author": "fxy060608", "author": "fxy060608",
"license": "Apache-2.0", "license": "Apache-2.0",
"gitHead": "e43df719e16464b00873adb52ac6a64c91036a79" "gitHead": "b366367ac0b63f41ef205dc93eee55d8e9f8f3ed"
} }
...@@ -83,7 +83,7 @@ if ( ...@@ -83,7 +83,7 @@ if (
const defaultOutputDir = '../../../../dist/' + const defaultOutputDir = '../../../../dist/' +
(process.env.NODE_ENV === 'production' ? 'build' : 'dev') + '/' + (process.env.NODE_ENV === 'production' ? 'build' : 'dev') + '/' +
(process.env.UNI_SUB_PLATFORM || process.env.UNI_PLATFORM) (process.env.UNI_SUB_PLATFORM || process.env.UNI_PLATFORM)
process.env.UNI_OUTPUT_DEFAULT_DIR = path.resolve(__dirname, defaultOutputDir) process.env.UNI_OUTPUT_DEFAULT_DIR = path.resolve(__dirname, defaultOutputDir)
if (process.env.UNI_OUTPUT_DIR && process.env.UNI_OUTPUT_DIR.indexOf('./') === 0) { if (process.env.UNI_OUTPUT_DIR && process.env.UNI_OUTPUT_DIR.indexOf('./') === 0) {
process.env.UNI_OUTPUT_DIR = path.resolve(process.cwd(), process.env.UNI_OUTPUT_DIR) process.env.UNI_OUTPUT_DIR = path.resolve(process.cwd(), process.env.UNI_OUTPUT_DIR)
...@@ -243,8 +243,10 @@ if (isNVueCompiler) { ...@@ -243,8 +243,10 @@ if (isNVueCompiler) {
process.env.UNI_USING_NVUE_COMPILER = true process.env.UNI_USING_NVUE_COMPILER = true
} }
if (platformOptions.nvueStyleCompiler !== 'weex') { if (platformOptions.nvueStyleCompiler === 'uni-app') {
process.env.UNI_USING_NVUE_STYLE_COMPILER = true process.env.UNI_USING_NVUE_STYLE_COMPILER = true
} else {
platformOptions.nvueStyleCompiler = 'weex'
} }
if (platformOptions.usingComponents === true) { if (platformOptions.usingComponents === true) {
...@@ -451,4 +453,4 @@ runByHBuilderX && console.log('正在编译中...') ...@@ -451,4 +453,4 @@ runByHBuilderX && console.log('正在编译中...')
module.exports = { module.exports = {
manifestPlatformOptions: platformOptions manifestPlatformOptions: platformOptions
} }
...@@ -36,7 +36,11 @@ function getProvides () { ...@@ -36,7 +36,11 @@ function getProvides () {
} }
if (process.env.UNI_USING_COMPONENTS) { if (process.env.UNI_USING_COMPONENTS) {
provides.createApp = [uniPath, 'createApp'] if (process.env.UNI_SUBPACKGE) {
provides.createApp = [uniPath, 'createSubpackageApp']
} else {
provides.createApp = [uniPath, 'createApp']
}
provides.createPage = [uniPath, 'createPage'] provides.createPage = [uniPath, 'createPage']
provides.createComponent = [uniPath, 'createComponent'] provides.createComponent = [uniPath, 'createComponent']
} }
......
{ {
"name": "@dcloudio/vue-cli-plugin-uni", "name": "@dcloudio/vue-cli-plugin-uni",
"version": "2.0.0-alpha-31020210201001", "version": "2.0.0-alpha-31120210204001",
"description": "uni-app plugin for vue-cli 3", "description": "uni-app plugin for vue-cli 3",
"main": "index.js", "main": "index.js",
"repository": { "repository": {
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
"author": "fxy060608", "author": "fxy060608",
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"@dcloudio/uni-stat": "^2.0.0-alpha-31020210201001", "@dcloudio/uni-stat": "^2.0.0-alpha-31120210204001",
"buffer-json": "^2.0.0", "buffer-json": "^2.0.0",
"copy-webpack-plugin": "^5.1.1", "copy-webpack-plugin": "^5.1.1",
"cross-env": "^5.2.0", "cross-env": "^5.2.0",
...@@ -37,5 +37,5 @@ ...@@ -37,5 +37,5 @@
"wrap-loader": "^0.2.0", "wrap-loader": "^0.2.0",
"xregexp": "4.0.0" "xregexp": "4.0.0"
}, },
"gitHead": "e43df719e16464b00873adb52ac6a64c91036a79" "gitHead": "b366367ac0b63f41ef205dc93eee55d8e9f8f3ed"
} }
{ {
"name": "@dcloudio/webpack-uni-mp-loader", "name": "@dcloudio/webpack-uni-mp-loader",
"version": "2.0.0-alpha-31020210201001", "version": "2.0.0-alpha-31120210204001",
"description": "webpack-uni-mp-loader", "description": "webpack-uni-mp-loader",
"main": "index.js", "main": "index.js",
"repository": { "repository": {
...@@ -16,5 +16,5 @@ ...@@ -16,5 +16,5 @@
}, },
"author": "fxy060608", "author": "fxy060608",
"license": "Apache-2.0", "license": "Apache-2.0",
"gitHead": "e43df719e16464b00873adb52ac6a64c91036a79" "gitHead": "b366367ac0b63f41ef205dc93eee55d8e9f8f3ed"
} }
{ {
"name": "@dcloudio/webpack-uni-pages-loader", "name": "@dcloudio/webpack-uni-pages-loader",
"version": "2.0.0-alpha-31020210201001", "version": "2.0.0-alpha-31120210204001",
"description": "uni-app pages.json loader", "description": "uni-app pages.json loader",
"main": "lib/index.js", "main": "lib/index.js",
"repository": { "repository": {
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
"strip-json-comments": "^2.0.1" "strip-json-comments": "^2.0.1"
}, },
"uni-app": { "uni-app": {
"compilerVersion": "3.1.0" "compilerVersion": "3.1.1"
}, },
"gitHead": "e43df719e16464b00873adb52ac6a64c91036a79" "gitHead": "b366367ac0b63f41ef205dc93eee55d8e9f8f3ed"
} }
...@@ -32,6 +32,9 @@ export const chooseFile = { ...@@ -32,6 +32,9 @@ export const chooseFile = {
}, },
extension: { extension: {
type: Array, type: Array,
default: [''] default: [''],
validator (extension, params) {
if (extension.length === 0) { return 'param extension should not be empty.' }
}
} }
} }
...@@ -35,7 +35,7 @@ export const chooseImage = { ...@@ -35,7 +35,7 @@ export const chooseImage = {
type: Array, type: Array,
default: ['*'], default: ['*'],
validator (extension, params) { validator (extension, params) {
if (extension.length === 0) params.extension = ['*'] if (extension.length === 0) { return 'param extension should not be empty.' }
} }
} }
} }
...@@ -22,7 +22,7 @@ export const chooseVideo = { ...@@ -22,7 +22,7 @@ export const chooseVideo = {
type: Array, type: Array,
default: ['*'], default: ['*'],
validator (extension, params) { validator (extension, params) {
if (extension.length === 0) params.extension = ['*'] if (extension.length === 0) { return 'param extension should not be empty.' }
} }
} }
} }
...@@ -26,7 +26,8 @@ import { ...@@ -26,7 +26,8 @@ import {
import createApp from './wrapper/create-app' import createApp from './wrapper/create-app'
import createPage from './wrapper/create-page' import createPage from './wrapper/create-page'
import createComponent from './wrapper/create-component' import createComponent from './wrapper/create-component'
import createSubpackageApp from './wrapper/create-subpackage-app'
todos.forEach(todoApi => { todos.forEach(todoApi => {
protocols[todoApi] = false protocols[todoApi] = false
...@@ -114,11 +115,13 @@ if (__PLATFORM__ === 'app-plus') { ...@@ -114,11 +115,13 @@ if (__PLATFORM__ === 'app-plus') {
__GLOBAL__.createApp = createApp __GLOBAL__.createApp = createApp
__GLOBAL__.createPage = createPage __GLOBAL__.createPage = createPage
__GLOBAL__.createComponent = createComponent __GLOBAL__.createComponent = createComponent
__GLOBAL__.createSubpackageApp = createSubpackageApp
export { export {
createApp, createApp,
createPage, createPage,
createComponent createComponent,
createSubpackageApp
} }
export default uni export default uni
import Vue from 'vue'
import 'uni-platform/runtime/index' import 'uni-platform/runtime/index'
import EventChannel from 'uni-helpers/EventChannel'
import parseApp from 'uni-platform/runtime/wrapper/app-parser' import parseApp from 'uni-platform/runtime/wrapper/app-parser'
import {
getEventChannel
} from 'uni-helpers/navigate-to'
export default function createApp (vm) { export default function createApp (vm) {
Vue.prototype.getOpenerEventChannel = function () {
// 微信小程序使用自身getOpenerEventChannel
if (__PLATFORM__ === 'mp-weixin') {
return this.$scope.getOpenerEventChannel()
}
if (!this.__eventChannel__) {
this.__eventChannel__ = new EventChannel()
}
return this.__eventChannel__
}
const callHook = Vue.prototype.__call_hook
Vue.prototype.__call_hook = function (hook, args) {
if (hook === 'onLoad' && args && args.__id__) {
this.__eventChannel__ = getEventChannel(args.__id__)
delete args.__id__
}
return callHook.call(this, hook, args)
}
App(parseApp(vm)) App(parseApp(vm))
return vm return vm
} }
import 'uni-platform/runtime/index'
import {
isFn,
hasOwn
} from 'uni-shared'
import parseApp from 'uni-platform/runtime/wrapper/app-parser'
export default function createSubpackageApp (vm) {
const appOptions = parseApp(vm)
const app = getApp({
allowDefault: true
})
const globalData = app.globalData
if (globalData) {
Object.keys(appOptions.globalData).forEach(name => {
if (!hasOwn(globalData, name)) {
globalData[name] = appOptions.globalData[name]
}
})
}
Object.keys(appOptions).forEach(name => {
if (!hasOwn(app, name)) {
app[name] = appOptions[name]
}
})
if (isFn(appOptions.onShow) && __GLOBAL__.onAppShow) {
__GLOBAL__.onAppShow((...args) => {
appOptions.onShow.apply(app, args)
})
}
if (isFn(appOptions.onHide) && __GLOBAL__.onAppHide) {
__GLOBAL__.onAppHide((...args) => {
appOptions.onHide.apply(app, args)
})
}
if (isFn(appOptions.onLaunch)) {
const args = __GLOBAL__.getLaunchOptionsSync && __GLOBAL__.getLaunchOptionsSync()
appOptions.onLaunch.call(app, args)
}
return vm
}
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册