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

Merge branch 'alpha'

......@@ -59,6 +59,7 @@ uni 统计配置项
|distribute|Object|App 发布信息,[详见](/collocation/manifest?id=distribute)||
|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+|
|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+|
|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+|
......
......@@ -10,6 +10,7 @@
|fade-show|Boolean|true|图片显示动画效果|仅App-nvue 2.3.4+ Android有效|
|webp|boolean|false|默认不解析 webP 格式,只支持网络资源|微信小程序2.9.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'}||
|@load|HandleEvent||当图片载入完毕时,发布到 AppService 的事件名,事件对象event.detail = {height:'图片高度px', width:'图片宽度px'}| |
......
......@@ -12,5 +12,5 @@
"message": "chore(release): publish %s"
}
},
"version": "2.0.0-alpha-31020210201001"
"version": "2.0.0-alpha-31120210204001"
}
{
"name": "@dcloudio/uni-app-plus-nvue",
"version": "2.0.0-alpha-31020210201001",
"version": "2.0.0-alpha-31120210204001",
"description": "uni-app app-plus-nvue",
"main": "dist/index.js",
"repository": {
......@@ -13,5 +13,5 @@
},
"author": "fxy060608",
"license": "Apache-2.0",
"gitHead": "e43df719e16464b00873adb52ac6a64c91036a79"
"gitHead": "b366367ac0b63f41ef205dc93eee55d8e9f8f3ed"
}
......@@ -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 = [
'onPullDownRefresh',
'onReachBottom',
......@@ -1245,6 +1177,87 @@ 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 = [
'onShow',
'onHide',
......@@ -1254,10 +1267,28 @@ const hooks = [
'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, {
mocks,
initRefs
}) {
initEventChannel();
if (vm.$options.store) {
Vue.prototype.$store = vm.$options.store;
}
......@@ -1426,34 +1457,7 @@ function parseApp$1 (vm) {
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) {
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));
return vm
}
......@@ -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 => {
protocols[todoApi] = false;
});
......@@ -1744,8 +1783,9 @@ if (typeof Proxy !== 'undefined' && "app-plus" !== 'app-plus') {
wx.createApp = createApp;
wx.createPage = createPage;
wx.createComponent = createComponent;
wx.createSubpackageApp = createSubpackageApp;
var uni$1 = uni;
export default uni$1;
export { createApp, createComponent, createPage };
export { createApp, createComponent, createPage, createSubpackageApp };
......@@ -1356,7 +1356,10 @@ var serviceContext = (function () {
},
extension: {
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 () {
type: Array,
default: ['*'],
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 () {
type: Array,
default: ['*'],
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",
"version": "2.0.0-alpha-31020210201001",
"version": "2.0.0-alpha-31120210204001",
"description": "uni-app app-plus",
"main": "dist/index.js",
"repository": {
......@@ -17,5 +17,5 @@
"name": "app-plus",
"title": "APP-PLUS"
},
"gitHead": "e43df719e16464b00873adb52ac6a64c91036a79"
"gitHead": "b366367ac0b63f41ef205dc93eee55d8e9f8f3ed"
}
{
"name": "@dcloudio/uni-automator",
"version": "2.0.0-alpha-31020210201001",
"version": "2.0.0-alpha-31120210204001",
"description": "uni-app automator",
"main": "dist/index.js",
"repository": {
......@@ -30,5 +30,5 @@
"node-simctl": "^6.1.0",
"puppeteer": "^3.0.1"
},
"gitHead": "e43df719e16464b00873adb52ac6a64c91036a79"
"gitHead": "b366367ac0b63f41ef205dc93eee55d8e9f8f3ed"
}
{
"name": "@dcloudio/uni-cli-shared",
"version": "2.0.0-alpha-31020210201001",
"version": "2.0.0-alpha-31120210204001",
"description": "uni-cli-shared",
"main": "lib/index.js",
"repository": {
......@@ -23,5 +23,5 @@
"postcss-urlrewrite": "^0.2.2",
"strip-json-comments": "^2.0.1"
},
"gitHead": "e43df719e16464b00873adb52ac6a64c91036a79"
"gitHead": "b366367ac0b63f41ef205dc93eee55d8e9f8f3ed"
}
{
"name": "@dcloudio/uni-h5-ui",
"version": "2.0.0-alpha-31020210201001",
"version": "2.0.0-alpha-31120210204001",
"description": "uni-app h5 ui",
"main": "dist/index.umd.min.js",
"repository": {
......@@ -13,5 +13,5 @@
},
"author": "fxy060608",
"license": "Apache-2.0",
"gitHead": "e43df719e16464b00873adb52ac6a64c91036a79"
"gitHead": "b366367ac0b63f41ef205dc93eee55d8e9f8f3ed"
}
{
"name": "@dcloudio/uni-h5",
"version": "2.0.0-alpha-31020210201001",
"version": "2.0.0-alpha-31120210204001",
"description": "uni-app h5",
"main": "dist/index.umd.min.js",
"repository": {
......@@ -24,5 +24,5 @@
"title": "H5",
"main": "lib/h5/uni.config.js"
},
"gitHead": "e43df719e16464b00873adb52ac6a64c91036a79"
"gitHead": "b366367ac0b63f41ef205dc93eee55d8e9f8f3ed"
}
{
"name": "@dcloudio/uni-migration",
"version": "2.0.0-alpha-31020210201001",
"version": "2.0.0-alpha-31120210204001",
"description": "uni-app migration",
"main": "lib/index.js",
"repository": {
......@@ -20,7 +20,7 @@
},
"author": "fxy060608",
"license": "Apache-2.0",
"gitHead": "e43df719e16464b00873adb52ac6a64c91036a79",
"gitHead": "b366367ac0b63f41ef205dc93eee55d8e9f8f3ed",
"dependencies": {
"commander": "^4.0.1",
"fs-extra": "^8.1.0",
......
......@@ -1909,10 +1909,28 @@ const hooks = [
'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, {
mocks,
initRefs
}) {
initEventChannel$1();
if (vm.$options.store) {
Vue.prototype.$store = vm.$options.store;
}
......@@ -2316,20 +2334,6 @@ function parseApp (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));
return vm
}
......@@ -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 => {
protocols[todoApi] = false;
});
......@@ -2667,8 +2706,9 @@ if (typeof Proxy !== 'undefined' && "mp-alipay" !== 'app-plus') {
my.createApp = createApp;
my.createPage = createPage;
my.createComponent = createComponent;
my.createSubpackageApp = createSubpackageApp;
var uni$1 = uni;
export default uni$1;
export { createApp, createComponent, createPage };
export { createApp, createComponent, createPage, createSubpackageApp };
{
"name": "@dcloudio/uni-mp-alipay",
"version": "2.0.0-alpha-31020210201001",
"version": "2.0.0-alpha-31120210204001",
"description": "uni-app mp-alipay",
"main": "dist/index.js",
"repository": {
......@@ -17,5 +17,5 @@
"name": "mp-alipay",
"title": "支付宝小程序"
},
"gitHead": "e43df719e16464b00873adb52ac6a64c91036a79"
"gitHead": "b366367ac0b63f41ef205dc93eee55d8e9f8f3ed"
}
......@@ -1598,10 +1598,28 @@ const hooks = [
'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, {
mocks,
initRefs
}) {
initEventChannel$1();
if (vm.$options.store) {
Vue.prototype.$store = vm.$options.store;
}
......@@ -1769,20 +1787,6 @@ function parseApp (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));
return vm
}
......@@ -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 => {
protocols[todoApi] = false;
});
......@@ -2153,8 +2192,9 @@ if (typeof Proxy !== 'undefined' && "mp-baidu" !== 'app-plus') {
swan.createApp = createApp;
swan.createPage = createPage;
swan.createComponent = createComponent;
swan.createSubpackageApp = createSubpackageApp;
var uni$1 = uni;
export default uni$1;
export { createApp, createComponent, createPage };
export { createApp, createComponent, createPage, createSubpackageApp };
{
"name": "@dcloudio/uni-mp-baidu",
"version": "2.0.0-alpha-31020210201001",
"version": "2.0.0-alpha-31120210204001",
"description": "uni-app mp-baidu",
"main": "dist/index.js",
"repository": {
......@@ -17,5 +17,5 @@
"name": "mp-baidu",
"title": "百度小程序"
},
"gitHead": "e43df719e16464b00873adb52ac6a64c91036a79"
"gitHead": "b366367ac0b63f41ef205dc93eee55d8e9f8f3ed"
}
......@@ -1350,10 +1350,28 @@ const hooks = [
'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, {
mocks,
initRefs
}) {
initEventChannel$1();
if (vm.$options.store) {
Vue.prototype.$store = vm.$options.store;
}
......@@ -1515,20 +1533,6 @@ function parseApp$1 (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));
return vm
}
......@@ -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 => {
protocols[todoApi] = false;
});
......@@ -1811,8 +1850,9 @@ if (typeof Proxy !== 'undefined' && "mp-kuaishou" !== 'app-plus') {
ks.createApp = createApp;
ks.createPage = createPage;
ks.createComponent = createComponent;
ks.createSubpackageApp = createSubpackageApp;
var uni$1 = uni;
export default uni$1;
export { createApp, createComponent, createPage };
export { createApp, createComponent, createPage, createSubpackageApp };
{
"name": "@dcloudio/uni-mp-kuaishou",
"version": "2.0.0-alpha-31020210201001",
"version": "2.0.0-alpha-31120210204001",
"description": "uni-app mp-kuaishou",
"main": "dist/index.js",
"repository": {
......@@ -17,5 +17,5 @@
"name": "mp-kuaishou",
"title": "快手小程序"
},
"gitHead": "e43df719e16464b00873adb52ac6a64c91036a79"
"gitHead": "b366367ac0b63f41ef205dc93eee55d8e9f8f3ed"
}
......@@ -1511,10 +1511,28 @@ const hooks = [
'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, {
mocks,
initRefs
}) {
initEventChannel$1();
if (vm.$options.store) {
Vue.prototype.$store = vm.$options.store;
}
......@@ -1681,20 +1699,6 @@ function parseApp$1 (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));
return vm
}
......@@ -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 => {
protocols[todoApi] = false;
});
......@@ -1984,8 +2023,9 @@ if (typeof Proxy !== 'undefined' && "mp-qq" !== 'app-plus') {
wx.createApp = createApp;
wx.createPage = createPage;
wx.createComponent = createComponent;
wx.createSubpackageApp = createSubpackageApp;
var uni$1 = uni;
export default uni$1;
export { createApp, createComponent, createPage };
export { createApp, createComponent, createPage, createSubpackageApp };
{
"name": "@dcloudio/uni-mp-qq",
"version": "2.0.0-alpha-31020210201001",
"version": "2.0.0-alpha-31120210204001",
"description": "uni-app mp-qq",
"main": "dist/index.js",
"repository": {
......@@ -17,5 +17,5 @@
"name": "mp-qq",
"title": "QQ小程序"
},
"gitHead": "e43df719e16464b00873adb52ac6a64c91036a79"
"gitHead": "b366367ac0b63f41ef205dc93eee55d8e9f8f3ed"
}
......@@ -1603,10 +1603,28 @@ const hooks = [
'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, {
mocks,
initRefs
}) {
initEventChannel$1();
if (vm.$options.store) {
Vue.prototype.$store = vm.$options.store;
}
......@@ -1848,20 +1866,6 @@ function parseApp (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));
return vm
}
......@@ -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 => {
protocols[todoApi] = false;
});
......@@ -2192,8 +2231,9 @@ if (typeof Proxy !== 'undefined' && "mp-toutiao" !== 'app-plus') {
tt.createApp = createApp;
tt.createPage = createPage;
tt.createComponent = createComponent;
tt.createSubpackageApp = createSubpackageApp;
var uni$1 = uni;
export default uni$1;
export { createApp, createComponent, createPage };
export { createApp, createComponent, createPage, createSubpackageApp };
{
"name": "@dcloudio/uni-mp-toutiao",
"version": "2.0.0-alpha-31020210201001",
"version": "2.0.0-alpha-31120210204001",
"description": "uni-app mp-toutiao",
"main": "dist/index.js",
"repository": {
......@@ -17,5 +17,5 @@
"name": "mp-toutiao",
"title": "字节跳动小程序"
},
"gitHead": "e43df719e16464b00873adb52ac6a64c91036a79"
"gitHead": "b366367ac0b63f41ef205dc93eee55d8e9f8f3ed"
}
......@@ -2990,6 +2990,7 @@ function createComponentInstance(vnode, parent, suspense) {
return instance;
}
let currentInstance = null;
const getCurrentInstance = () => currentInstance || currentRenderingInstance;
const setCurrentInstance = (instance) => {
currentInstance = instance;
};
......@@ -3247,7 +3248,7 @@ function defineEmit() {
}
// Core API ------------------------------------------------------------------
const version = "3.0.4";
const version = "3.0.5";
// import deepCopy from './deepCopy'
/**
......@@ -3661,7 +3662,7 @@ function createVueApp(rootComponent, rootProps = null) {
}
function applyOptions$1(options, instance, publicThis) {
Object.keys(options).forEach(name => {
Object.keys(options).forEach((name) => {
if (name.indexOf('on') === 0) {
const hook = options[name];
if (isFunction(hook)) {
......@@ -3737,7 +3738,7 @@ var plugin = {
createMiniProgramApp(instance);
return instance;
};
}
},
};
// @ts-ignore
......@@ -3773,4 +3774,4 @@ function createApp(rootComponent, rootProps = null) {
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",
"version": "2.0.0-alpha-31020210201001",
"version": "2.0.0-alpha-31120210204001",
"description": "@dcloudio/uni-mp-vue",
"main": "dist/vue.runtime.esm.js",
"module": "dist/vue.runtime.esm.js",
......@@ -23,5 +23,5 @@
"bugs": {
"url": "https://github.com/dcloudio/uni-app/issues"
},
"gitHead": "e43df719e16464b00873adb52ac6a64c91036a79"
"gitHead": "b366367ac0b63f41ef205dc93eee55d8e9f8f3ed"
}
......@@ -1246,6 +1246,19 @@ 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 = [
'onShow',
'onHide',
......@@ -1255,10 +1268,28 @@ const hooks = [
'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, {
mocks,
initRefs
}) {
initEventChannel();
if (vm.$options.store) {
Vue.prototype.$store = vm.$options.store;
}
......@@ -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) {
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));
return vm
}
......@@ -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 => {
protocols[todoApi] = false;
});
......@@ -1736,8 +1775,9 @@ if (typeof Proxy !== 'undefined' && "mp-weixin" !== 'app-plus') {
wx.createApp = createApp;
wx.createPage = createPage;
wx.createComponent = createComponent;
wx.createSubpackageApp = createSubpackageApp;
var uni$1 = uni;
export default uni$1;
export { createApp, createComponent, createPage };
export { createApp, createComponent, createPage, createSubpackageApp };
{
"name": "@dcloudio/uni-mp-weixin",
"version": "2.0.0-alpha-31020210201001",
"version": "2.0.0-alpha-31120210204001",
"description": "uni-app mp-weixin",
"main": "dist/index.js",
"repository": {
......@@ -17,5 +17,5 @@
"name": "mp-weixin",
"title": "微信小程序"
},
"gitHead": "e43df719e16464b00873adb52ac6a64c91036a79"
"gitHead": "b366367ac0b63f41ef205dc93eee55d8e9f8f3ed"
}
{
"name": "@dcloudio/uni-quickapp-native",
"version": "2.0.0-alpha-31020210201001",
"version": "2.0.0-alpha-31120210204001",
"description": "uni-app quickapp-native",
"main": "dist/vue.prod.js",
"repository": {
......@@ -19,7 +19,7 @@
},
"author": "fxy060608",
"license": "Apache-2.0",
"gitHead": "e43df719e16464b00873adb52ac6a64c91036a79",
"gitHead": "b366367ac0b63f41ef205dc93eee55d8e9f8f3ed",
"uni-app": {
"name": "quickapp-native",
"title": "快应用(Native)版"
......
......@@ -1325,10 +1325,28 @@ const hooks = [
'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, {
mocks,
initRefs
}) {
initEventChannel$1();
if (vm.$options.store) {
Vue.prototype.$store = vm.$options.store;
}
......@@ -1558,20 +1576,6 @@ function parseApp (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));
return vm
}
......@@ -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 => {
protocols[todoApi] = false;
});
......@@ -1902,8 +1941,9 @@ if (typeof Proxy !== 'undefined' && "quickapp-webview" !== 'app-plus') {
qa.createApp = createApp;
qa.createPage = createPage;
qa.createComponent = createComponent;
qa.createSubpackageApp = createSubpackageApp;
var uni$1 = uni;
export default uni$1;
export { createApp, createComponent, createPage };
export { createApp, createComponent, createPage, createSubpackageApp };
{
"name": "@dcloudio/uni-quickapp-webview",
"version": "2.0.0-alpha-31020210201001",
"version": "2.0.0-alpha-31120210204001",
"description": "uni-app quickapp-webview",
"main": "dist/index.js",
"repository": {
......@@ -17,5 +17,5 @@
"name": "quickapp-webview",
"title": "快应用(Webview)版"
},
"gitHead": "e43df719e16464b00873adb52ac6a64c91036a79"
"gitHead": "b366367ac0b63f41ef205dc93eee55d8e9f8f3ed"
}
{
"name": "@dcloudio/uni-stat",
"version": "2.0.0-alpha-31020210201001",
"version": "2.0.0-alpha-31120210204001",
"description": "",
"main": "dist/index.js",
"repository": {
......@@ -34,5 +34,5 @@
"rollup-plugin-replace": "^2.2.0",
"rollup-plugin-uglify": "^6.0.2"
},
"gitHead": "e43df719e16464b00873adb52ac6a64c91036a79"
"gitHead": "b366367ac0b63f41ef205dc93eee55d8e9f8f3ed"
}
{
"name": "@dcloudio/uni-template-compiler",
"version": "2.0.0-alpha-31020210201001",
"version": "2.0.0-alpha-31120210204001",
"description": "uni-template-compiler",
"main": "lib/index.js",
"repository": {
......@@ -22,5 +22,5 @@
"@babel/types": "^7.3.3",
"vue-template-compiler": "^2.6.10"
},
"gitHead": "e43df719e16464b00873adb52ac6a64c91036a79"
"gitHead": "b366367ac0b63f41ef205dc93eee55d8e9f8f3ed"
}
{
"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",
"main": "index.js",
"repository": {
......@@ -18,5 +18,5 @@
"css": "~2.2.1",
"escodegen": "^1.8.1"
},
"gitHead": "e43df719e16464b00873adb52ac6a64c91036a79"
"gitHead": "b366367ac0b63f41ef205dc93eee55d8e9f8f3ed"
}
......@@ -69,6 +69,7 @@ module.exports = function (content, map) {
}
Object.assign(appJson.globalStyle, appJson.globalStyle['app-plus'] || {})
pageJson.style = pageJson.style || {}
Object.assign(pageJson.style, pageJson.style['app-plus'] || {})
const pageJsonStyle = Object.assign(appJson.globalStyle, pageJson.style)
if (pageJsonStyle.disableScroll === true) {
......
......@@ -76,7 +76,7 @@ function borderProperty (declaration) {
var { value, important } = clearImportant(declaration.value)
var position = declaration.position
var property = declaration.property.split('-')[1]
var splitResult = value.split(/\s+/)
var splitResult = value.replace(/\s*,\s*/g, ',').split(/\s+/)
var result = []
switch (splitResult.length) {
case 1:
......
{
"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",
"main": "index.js",
"repository": {
......@@ -13,5 +13,5 @@
},
"author": "fxy060608",
"license": "Apache-2.0",
"gitHead": "e43df719e16464b00873adb52ac6a64c91036a79"
"gitHead": "b366367ac0b63f41ef205dc93eee55d8e9f8f3ed"
}
......@@ -243,8 +243,10 @@ if (isNVueCompiler) {
process.env.UNI_USING_NVUE_COMPILER = true
}
if (platformOptions.nvueStyleCompiler !== 'weex') {
if (platformOptions.nvueStyleCompiler === 'uni-app') {
process.env.UNI_USING_NVUE_STYLE_COMPILER = true
} else {
platformOptions.nvueStyleCompiler = 'weex'
}
if (platformOptions.usingComponents === true) {
......
......@@ -36,7 +36,11 @@ function getProvides () {
}
if (process.env.UNI_USING_COMPONENTS) {
if (process.env.UNI_SUBPACKGE) {
provides.createApp = [uniPath, 'createSubpackageApp']
} else {
provides.createApp = [uniPath, 'createApp']
}
provides.createPage = [uniPath, 'createPage']
provides.createComponent = [uniPath, 'createComponent']
}
......
{
"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",
"main": "index.js",
"repository": {
......@@ -17,7 +17,7 @@
"author": "fxy060608",
"license": "Apache-2.0",
"dependencies": {
"@dcloudio/uni-stat": "^2.0.0-alpha-31020210201001",
"@dcloudio/uni-stat": "^2.0.0-alpha-31120210204001",
"buffer-json": "^2.0.0",
"copy-webpack-plugin": "^5.1.1",
"cross-env": "^5.2.0",
......@@ -37,5 +37,5 @@
"wrap-loader": "^0.2.0",
"xregexp": "4.0.0"
},
"gitHead": "e43df719e16464b00873adb52ac6a64c91036a79"
"gitHead": "b366367ac0b63f41ef205dc93eee55d8e9f8f3ed"
}
{
"name": "@dcloudio/webpack-uni-mp-loader",
"version": "2.0.0-alpha-31020210201001",
"version": "2.0.0-alpha-31120210204001",
"description": "webpack-uni-mp-loader",
"main": "index.js",
"repository": {
......@@ -16,5 +16,5 @@
},
"author": "fxy060608",
"license": "Apache-2.0",
"gitHead": "e43df719e16464b00873adb52ac6a64c91036a79"
"gitHead": "b366367ac0b63f41ef205dc93eee55d8e9f8f3ed"
}
{
"name": "@dcloudio/webpack-uni-pages-loader",
"version": "2.0.0-alpha-31020210201001",
"version": "2.0.0-alpha-31120210204001",
"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.1.0"
"compilerVersion": "3.1.1"
},
"gitHead": "e43df719e16464b00873adb52ac6a64c91036a79"
"gitHead": "b366367ac0b63f41ef205dc93eee55d8e9f8f3ed"
}
......@@ -32,6 +32,9 @@ export const chooseFile = {
},
extension: {
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 = {
type: Array,
default: ['*'],
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 = {
type: Array,
default: ['*'],
validator (extension, params) {
if (extension.length === 0) params.extension = ['*']
if (extension.length === 0) { return 'param extension should not be empty.' }
}
}
}
......@@ -27,6 +27,7 @@ import {
import createApp from './wrapper/create-app'
import createPage from './wrapper/create-page'
import createComponent from './wrapper/create-component'
import createSubpackageApp from './wrapper/create-subpackage-app'
todos.forEach(todoApi => {
protocols[todoApi] = false
......@@ -114,11 +115,13 @@ if (__PLATFORM__ === 'app-plus') {
__GLOBAL__.createApp = createApp
__GLOBAL__.createPage = createPage
__GLOBAL__.createComponent = createComponent
__GLOBAL__.createSubpackageApp = createSubpackageApp
export {
createApp,
createPage,
createComponent
createComponent,
createSubpackageApp
}
export default uni
import Vue from 'vue'
import 'uni-platform/runtime/index'
import EventChannel from 'uni-helpers/EventChannel'
import parseApp from 'uni-platform/runtime/wrapper/app-parser'
import {
getEventChannel
} from 'uni-helpers/navigate-to'
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))
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
}
......@@ -7,6 +7,7 @@
<img
v-if="contentPath"
:src="contentPath"
:draggable="draggable"
>
<v-uni-resize-sensor
v-if="mode === 'widthFix' || mode === 'heightFix'"
......@@ -39,6 +40,10 @@ export default {
lazyLoad: {
type: [Boolean, String],
default: false
},
draggable: {
type: Boolean,
default: true
}
},
data () {
......
此差异已折叠。
......@@ -5,6 +5,12 @@ import {
initMocks
} from 'uni-wrapper/util'
import EventChannel from 'uni-helpers/EventChannel'
import {
getEventChannel
} from 'uni-helpers/navigate-to'
const hooks = [
'onShow',
'onHide',
......@@ -14,10 +20,32 @@ const hooks = [
'onUnhandledRejection'
]
function initEventChannel () {
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)
}
}
export default function parseBaseApp (vm, {
mocks,
initRefs
}) {
initEventChannel()
if (vm.$options.store) {
Vue.prototype.$store = vm.$options.store
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册