提交 ae634ece 编写于 作者: Q qiang

Merge branch 'dev' into alpha

......@@ -922,7 +922,18 @@ function getExtraValue (vm, dataPathsArray) {
const propPath = dataPathArray[1];
const valuePath = dataPathArray[3];
const vFor = dataPath ? vm.__get_value(dataPath, context) : context;
let vFor;
if (Number.isInteger(dataPath)) {
vFor = dataPath;
} else if (!dataPath) {
vFor = context;
} else if (typeof dataPath === 'string' && dataPath) {
if (dataPath.indexOf('#s#') === 0) {
vFor = dataPath.substr(3);
} else {
vFor = vm.__get_value(dataPath, context);
}
}
if (Number.isInteger(vFor)) {
context = value;
......@@ -972,6 +983,12 @@ function processEventExtra (vm, extra, event) {
} else {
if (dataPath === '$event') { // $event
extraObj['$' + index] = event;
} else if (dataPath === 'arguments') {
if (event.detail && event.detail.__args__) {
extraObj['$' + index] = event.detail.__args__;
} else {
extraObj['$' + index] = [event];
}
} else if (dataPath.indexOf('$event.') === 0) { // $event.target.value
extraObj['$' + index] = vm.__get_value(dataPath.replace('$event.', ''), event);
} else {
......
......@@ -13132,10 +13132,17 @@ var serviceContext = (function () {
const globalEvent = requireNativePlugin('globalEvent');
const emit = UniServiceJSBridge.emit;
// splashclosed 时开始监听 backbutton
plus.globalEvent.addEventListener('splashclosed', () => {
if (weex.config.preload) {
if (process.env.NODE_ENV !== 'production') {
console.log('[uni-app] preload.addEventListener.backbutton');
}
plus.key.addEventListener('backbutton', backbuttonListener);
});
} else {
// splashclosed 时开始监听 backbutton
plus.globalEvent.addEventListener('splashclosed', () => {
plus.key.addEventListener('backbutton', backbuttonListener);
});
}
plus.globalEvent.addEventListener('pause', () => {
emit('onAppEnterBackground');
......
"use strict";function t(t){return t&&"object"==typeof t&&"default"in t?t.default:t}var e=t(require("fs")),s=t(require("debug")),i=t(require("postcss-selector-parser")),r=t(require("fs-extra")),a=t(require("licia/dateFormat")),n=require("path"),o=require("util");function l(t){t.walk(t=>{if("tag"===t.type){const e=t.value;t.value="page"===e?"body":"uni-"+e}})}require("address"),require("default-gateway"),require("licia/isStr"),require("licia/getPort");const c=["Page.getElement","Page.getElements","Element.getElement","Element.getElements"];require("qrcode-terminal"),require("qrcode-reader");const h=/^win/.test(process.platform),p=s("automator:launcher"),u=o.promisify(e.readdir),d=o.promisify(e.stat);class m{constructor(t){this.id=t.id,this.app=t.executablePath,this.appid=t.appid||"HBuilder",this.package=t.package||"io.dcloud.HBuilder"}shouldPush(){return this.exists(this.FILE_APP_SERVICE).then(()=>(p(`${a("yyyy-mm-dd HH:MM:ss:l")} ${this.FILE_APP_SERVICE} exists`),!1)).catch(()=>(p(`${a("yyyy-mm-dd HH:MM:ss:l")} ${this.FILE_APP_SERVICE} not exists`),!0))}push(t){return async function t(e){const s=await u(e);return(await Promise.all(s.map(async s=>{const i=n.resolve(e,s);return(await d(i)).isDirectory()?t(i):i}))).reduce((t,e)=>t.concat(e),[])}(t).then(e=>{const s=e.map(e=>{const s=(t=>h?t.replace(/\\/g,"/"):t)(n.join(this.DIR_WWW,n.relative(t,e)));return p(`${a("yyyy-mm-dd HH:MM:ss:l")} push ${e} ${s}`),this.pushFile(e,s)});return Promise.all(s)}).then(t=>!0)}get FILE_APP_SERVICE(){return this.DIR_WWW+"/app-service.js"}}const y=s("automator:simctl");class f extends m{async init(){const t=require("node-simctl").Simctl;this.tool=new t({udid:this.id});try{await this.tool.bootDevice()}catch(t){}await this.initSDCard(),y(`${a("yyyy-mm-dd HH:MM:ss:l")} init ${this.id}`)}async initSDCard(){const t=(await this.tool.appInfo(this.package)).match(/DataContainer\s+=\s+"(.*)"/);if(!t)return Promise.resolve("");this.sdcard=t[1].replace("file:",""),y(`${a("yyyy-mm-dd HH:MM:ss:l")} install ${this.sdcard}`)}async version(){return Promise.resolve(this.sdcard?"9.6.96":"")}async install(){return y(`${a("yyyy-mm-dd HH:MM:ss:l")} install ${this.app}`),await this.tool.installApp(this.app),await this.tool.grantPermission(this.package,"all"),await this.initSDCard(),Promise.resolve(!0)}async start(){try{await this.tool.terminateApp(this.package),await this.tool.launchApp(this.package)}catch(t){}return Promise.resolve(!0)}async exit(){return await this.tool.terminateApp(this.package),await this.tool.shutdownDevice(),Promise.resolve(!0)}async captureScreenshot(){return Promise.resolve(await this.tool.getScreenshot())}exists(t){return r.existsSync(t)?Promise.resolve(!0):Promise.reject(Error(t+" not exists"))}pushFile(t,e){return Promise.resolve(r.copySync(t,e))}get DIR_WWW(){return`${this.sdcard}/Documents/Pandora/apps/${this.appid}/www/`}}const g=require("adbkit"),w=s("automator:adb");class M extends m{async init(){if(this.tool=g.createClient(),!this.id){const t=await this.tool.listDevices();if(!t.length)throw Error("Device not found");this.id=t[0].id}this.sdcard=(await this.shell(this.COMMAND_EXTERNAL)).trim(),w(`${a("yyyy-mm-dd HH:MM:ss:l")} init ${this.id} ${this.sdcard}`)}version(){return this.shell(this.COMMAND_VERSION).then(t=>{const e=t.match(/versionName=(.*)/);return e&&e.length>1?e[1]:""})}async install(){let t=!0;try{const e=(await this.tool.getProperties(this.id))["ro.build.version.release"].split(".")[0];parseInt(e)<6&&(t=!1)}catch(t){}if(w(`${a("yyyy-mm-dd HH:MM:ss:l")} install ${this.app} permission=${t}`),t){const t=require("adbkit/lib/adb/command.js"),e=t.prototype._send;t.prototype._send=function(t){return 0===t.indexOf("shell:pm install -r ")&&(t=t.replace("shell:pm install -r ","shell:pm install -r -g "),w(`${a("yyyy-mm-dd HH:MM:ss:l")} ${t} `)),e.call(this,t)}}return this.tool.install(this.id,this.app).then(()=>this.init())}start(){return this.exit().then(()=>this.shell(this.COMMAND_START))}exit(){return this.shell(this.COMMAND_STOP)}captureScreenshot(){return this.tool.screencap(this.id).then(t=>new Promise(e=>{const s=[];t.on("data",(function(t){s.push(t)})),t.on("end",(function(){e(Buffer.concat(s).toString("base64"))}))}))}exists(t){return this.tool.stat(this.id,t)}pushFile(t,e){return this.tool.push(this.id,t,e)}shell(t){return w(`${a("yyyy-mm-dd HH:MM:ss:l")} SEND ► ${t}`),this.tool.shell(this.id,t).then(g.util.readAll).then(t=>{const e=t.toString();return w(`${a("yyyy-mm-dd HH:MM:ss:l")} ◀ RECV ${e}`),e})}get DIR_WWW(){return`${this.sdcard}/Android/data/${this.package}/apps/${this.appid}/www`}get COMMAND_EXTERNAL(){return"echo $EXTERNAL_STORAGE"}get COMMAND_VERSION(){return"dumpsys package "+this.package}get COMMAND_STOP(){return"am force-stop "+this.package}get COMMAND_START(){return`am start -n ${this.package}/io.dcloud.PandoraEntry --es ${this.appid} --ez needUpdateApp false --ez reload true`}}const P=s("automator:devtool");let E,$=!1;const A={"Tool.close":{reflect:async()=>{}},"App.exit":{reflect:async()=>E.exit()},"App.enableLog":{reflect:()=>Promise.resolve()},"App.captureScreenshot":{reflect:async(t,e)=>{const s=await E.captureScreenshot(e);return P("App.captureScreenshot "+s.length),{data:s}}}};!function(t){c.forEach(e=>{t[e]=function(t){return{reflect:async(e,s)=>e(t,s,!1),params:t=>(t.selector&&(t.selector=i(l).processSync(t.selector)),t)}}(e)})}(A);const v={devtools:{name:"App",paths:[],required:["manifest.json","app-service.js"],validate:async function(t,s){if(t.platform=(t.platform||process.env.UNI_OS_NAME).toLocaleLowerCase(),Object.assign(t,t[t.platform]),E=function(t,e){return"ios"===t?new f(e):new M(e)}(t.platform,t),await E.init(),!await E.version()){if(!t.executablePath)throw Error(`app-plus->${t.platform}->executablePath is not provided`);if(!e.existsSync(t.executablePath))throw Error(t.executablePath+" not exists");$=!0}return t},create:async function(t,e,s){$&&await E.install(),(s.compiled||await E.shouldPush())&&await E.push(t),await E.start()}},adapter:A};module.exports=v;
"use strict";function t(t){return t&&"object"==typeof t&&"default"in t?t.default:t}var e=t(require("fs")),s=t(require("debug")),i=t(require("postcss-selector-parser")),r=t(require("fs-extra")),a=t(require("licia/dateFormat")),n=require("path"),o=require("util");function l(t){t.walk(t=>{if("tag"===t.type){const e=t.value;t.value="page"===e?"body":"uni-"+e}})}require("address"),require("default-gateway"),require("licia/isStr"),require("licia/getPort");const c=["Page.getElement","Page.getElements","Element.getElement","Element.getElements"];require("qrcode-terminal"),require("qrcode-reader");const h=/^win/.test(process.platform),u=s("automator:launcher"),p=o.promisify(e.readdir),d=o.promisify(e.stat);class m{constructor(t){this.id=t.id,this.app=t.executablePath,this.appid=t.appid||"HBuilder",this.package=t.package||"io.dcloud.HBuilder"}shouldPush(){return this.exists(this.FILE_APP_SERVICE).then(()=>(u(`${a("yyyy-mm-dd HH:MM:ss:l")} ${this.FILE_APP_SERVICE} exists`),!1)).catch(()=>(u(`${a("yyyy-mm-dd HH:MM:ss:l")} ${this.FILE_APP_SERVICE} not exists`),!0))}push(t){return async function t(e){const s=await p(e);return(await Promise.all(s.map(async s=>{const i=n.resolve(e,s);return(await d(i)).isDirectory()?t(i):i}))).reduce((t,e)=>t.concat(e),[])}(t).then(e=>{const s=e.map(e=>{const s=(t=>h?t.replace(/\\/g,"/"):t)(n.join(this.DIR_WWW,n.relative(t,e)));return u(`${a("yyyy-mm-dd HH:MM:ss:l")} push ${e} ${s}`),this.pushFile(e,s)});return Promise.all(s)}).then(t=>!0)}get FILE_APP_SERVICE(){return this.DIR_WWW+"/app-service.js"}}const y=s("automator:simctl");function f(t){const e=parseInt(t);return e>9?String(e):"0"+e}class g extends m{constructor(){super(...arguments),this.bundleVersion=""}async init(){const t=require("node-simctl").Simctl;this.tool=new t({udid:this.id});try{await this.tool.bootDevice()}catch(t){}await this.initSDCard(),y(`${a("yyyy-mm-dd HH:MM:ss:l")} init ${this.id}`)}async initSDCard(){const t=await this.tool.appInfo(this.package);y(`${a("yyyy-mm-dd HH:MM:ss:l")} appInfo ${t}`);const e=t.match(/DataContainer\s+=\s+"(.*)"/);if(!e)return Promise.resolve("");const s=t.match(/CFBundleVersion\s+=\s+(.*);/);if(!s)return Promise.resolve("");this.sdcard=e[1].replace("file:",""),this.bundleVersion=s[1],y(`${a("yyyy-mm-dd HH:MM:ss:l")} install ${this.sdcard}`)}async version(){return Promise.resolve(this.bundleVersion)}formatVersion(t){const e=t.split(".");return 3!==e.length?t:e[0]+f(e[1])+f(e[2])}async install(){return y(`${a("yyyy-mm-dd HH:MM:ss:l")} install ${this.app}`),await this.tool.installApp(this.app),await this.tool.grantPermission(this.package,"all"),await this.initSDCard(),Promise.resolve(!0)}async start(){try{await this.tool.terminateApp(this.package),await this.tool.launchApp(this.package)}catch(t){}return Promise.resolve(!0)}async exit(){return await this.tool.terminateApp(this.package),await this.tool.shutdownDevice(),Promise.resolve(!0)}async captureScreenshot(){return Promise.resolve(await this.tool.getScreenshot())}exists(t){return r.existsSync(t)?Promise.resolve(!0):Promise.reject(Error(t+" not exists"))}pushFile(t,e){return Promise.resolve(r.copySync(t,e))}get DIR_WWW(){return`${this.sdcard}/Documents/Pandora/apps/${this.appid}/www/`}}const w=require("adbkit"),M=s("automator:adb");class P extends m{async init(){if(this.tool=w.createClient(),!this.id){const t=await this.tool.listDevices();if(!t.length)throw Error("Device not found");this.id=t[0].id}this.sdcard=(await this.shell(this.COMMAND_EXTERNAL)).trim(),M(`${a("yyyy-mm-dd HH:MM:ss:l")} init ${this.id} ${this.sdcard}`)}version(){return this.shell(this.COMMAND_VERSION).then(t=>{const e=t.match(/versionName=(.*)/);return e&&e.length>1?e[1]:""})}formatVersion(t){return t}async install(){let t=!0;try{const e=(await this.tool.getProperties(this.id))["ro.build.version.release"].split(".")[0];parseInt(e)<6&&(t=!1)}catch(t){}if(M(`${a("yyyy-mm-dd HH:MM:ss:l")} install ${this.app} permission=${t}`),t){const t=require("adbkit/lib/adb/command.js"),e=t.prototype._send;t.prototype._send=function(t){return 0===t.indexOf("shell:pm install -r ")&&(t=t.replace("shell:pm install -r ","shell:pm install -r -g "),M(`${a("yyyy-mm-dd HH:MM:ss:l")} ${t} `)),e.call(this,t)}}return this.tool.install(this.id,this.app).then(()=>this.init())}start(){return this.exit().then(()=>this.shell(this.COMMAND_START))}exit(){return this.shell(this.COMMAND_STOP)}captureScreenshot(){return this.tool.screencap(this.id).then(t=>new Promise(e=>{const s=[];t.on("data",(function(t){s.push(t)})),t.on("end",(function(){e(Buffer.concat(s).toString("base64"))}))}))}exists(t){return this.tool.stat(this.id,t)}pushFile(t,e){return this.tool.push(this.id,t,e)}shell(t){return M(`${a("yyyy-mm-dd HH:MM:ss:l")} SEND ► ${t}`),this.tool.shell(this.id,t).then(w.util.readAll).then(t=>{const e=t.toString();return M(`${a("yyyy-mm-dd HH:MM:ss:l")} ◀ RECV ${e}`),e})}get DIR_WWW(){return`${this.sdcard}/Android/data/${this.package}/apps/${this.appid}/www`}get COMMAND_EXTERNAL(){return"echo $EXTERNAL_STORAGE"}get COMMAND_VERSION(){return"dumpsys package "+this.package}get COMMAND_STOP(){return"am force-stop "+this.package}get COMMAND_START(){return`am start -n ${this.package}/io.dcloud.PandoraEntry --es ${this.appid} --ez needUpdateApp false --ez reload true`}}const v=s("automator:devtool");let E,$=!1;const S={android:/android_version=(.*)/,ios:/iphone_version=(.*)/};const A={"Tool.close":{reflect:async()=>{}},"App.exit":{reflect:async()=>E.exit()},"App.enableLog":{reflect:()=>Promise.resolve()},"App.captureScreenshot":{reflect:async(t,e)=>{const s=await E.captureScreenshot(e);return v("App.captureScreenshot "+s.length),{data:s}}}};!function(t){c.forEach(e=>{t[e]=function(t){return{reflect:async(e,s)=>e(t,s,!1),params:t=>(t.selector&&(t.selector=i(l).processSync(t.selector)),t)}}(e)})}(A);const _={devtools:{name:"App",paths:[],required:["manifest.json","app-service.js"],validate:async function(t,s){t.platform=(t.platform||process.env.UNI_OS_NAME).toLocaleLowerCase(),Object.assign(t,t[t.platform]),E=function(t,e){return"ios"===t?new g(e):new P(e)}(t.platform,t),await E.init();const i=await E.version();if(i){if(t.version){const s=E.formatVersion(function(t,s){if(t.endsWith(".txt"))try{const i=e.readFileSync(t).toString().match(S[s]);if(i)return i[1]}catch(t){console.error(t)}return t}(t.version,t.platform));v("version: "+i),v("newVersion: "+s),s!==i&&($=!0)}}else $=!0;if($){if(!t.executablePath)throw Error(`app-plus->${t.platform}->executablePath is not provided`);if(!e.existsSync(t.executablePath))throw Error(t.executablePath+" not exists")}return t},create:async function(t,e,s){$&&await E.install(),($||s.compiled||await E.shouldPush())&&await E.push(t),await E.start()}},adapter:A};module.exports=_;
......@@ -54,10 +54,8 @@ module.exports = function initPreprocess (name, platforms, userDefines = {}) {
}
userDefineKeys.forEach(name => {
if (userDefines[name]) {
const key = normalize(name)
vueContext[key] = nvueContext[key] = true
}
const key = normalize(name)
vueContext[key] = nvueContext[key] = !!userDefines[name]
})
return {
......
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
ast-types@0.13.3:
version "0.13.3"
resolved "https://registry.npmjs.org/ast-types/-/ast-types-0.13.3.tgz#50da3f28d17bdbc7969a3a2d83a0e4a72ae755a7"
integrity sha512-XTZ7xGML849LkQP86sWdQzfhwbt3YwIO6MqbX9mUNYY98VKaaVZP7YNNm70IpwecbkkxmfC5IYAzOQ/2p29zRA==
commander@^4.0.1:
version "4.1.1"
resolved "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz#9fd602bd936294e9e9ef46a3f4d6964044b18068"
integrity sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==
core-util-is@~1.0.0:
version "1.0.2"
resolved "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"
integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=
dom-serializer@0:
version "0.2.2"
resolved "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.2.2.tgz#1afb81f533717175d478655debc5e332d9f9bb51"
integrity sha512-2/xPb3ORsQ42nHYiSunXkDjPLBaEj/xTwUO4B7XCZQTRk7EBtTOPaygh10YAAh2OI1Qrp6NWfpAhzswj0ydt9g==
dependencies:
domelementtype "^2.0.1"
entities "^2.0.0"
domelementtype@1, domelementtype@^1.3.0:
version "1.3.1"
resolved "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.1.tgz#d048c44b37b0d10a7f2a3d5fee3f4333d790481f"
integrity sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w==
domelementtype@^2.0.1:
version "2.0.1"
resolved "https://registry.npmjs.org/domelementtype/-/domelementtype-2.0.1.tgz#1f8bdfe91f5a78063274e803b4bdcedf6e94f94d"
integrity sha512-5HOHUDsYZWV8FGWN0Njbr/Rn7f/eWSQi1v7+HsUVwXgn8nWWlL64zKDkS0n8ZmQ3mlWOMuXOnR+7Nx/5tMO5AQ==
domutils@^1.5.1:
version "1.7.0"
resolved "https://registry.npmjs.org/domutils/-/domutils-1.7.0.tgz#56ea341e834e06e6748af7a1cb25da67ea9f8c2a"
integrity sha512-Lgd2XcJ/NjEw+7tFvfKxOzCYKZsdct5lczQ2ZaQY8Djz7pfAD3Gbp8ySJWtreII/vDlMVmxwa6pHmdxIYgttDg==
dependencies:
dom-serializer "0"
domelementtype "1"
entities@^1.1.1:
version "1.1.2"
resolved "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz#bdfa735299664dfafd34529ed4f8522a275fea56"
integrity sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w==
entities@^2.0.0:
version "2.0.3"
resolved "https://registry.npmjs.org/entities/-/entities-2.0.3.tgz#5c487e5742ab93c15abb5da22759b8590ec03b7f"
integrity sha512-MyoZ0jgnLvB2X3Lg5HqpFmn1kybDiIfEQmKzTb5apr51Rb+T3KdmMiqa70T+bhGnyv7bQ6WMj2QMHpGMmlrUYQ==
esprima@~4.0.0:
version "4.0.1"
resolved "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71"
integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==
fs-extra@^8.1.0:
version "8.1.0"
resolved "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz#49d43c45a88cd9677668cb7be1b46efdb8d2e1c0"
integrity sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==
dependencies:
graceful-fs "^4.2.0"
jsonfile "^4.0.0"
universalify "^0.1.0"
graceful-fs@^4.1.6, graceful-fs@^4.2.0:
version "4.2.4"
resolved "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz#2256bde14d3632958c465ebc96dc467ca07a29fb"
integrity sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==
inherits@^2.0.1, inherits@~2.0.3:
version "2.0.4"
resolved "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c"
integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==
isarray@~1.0.0:
version "1.0.0"
resolved "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11"
integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=
jsonfile@^4.0.0:
version "4.0.0"
resolved "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb"
integrity sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=
optionalDependencies:
graceful-fs "^4.1.6"
mustache@^3.1.0:
version "3.2.1"
resolved "https://registry.npmjs.org/mustache/-/mustache-3.2.1.tgz#89e78a9d207d78f2799b1e95764a25bf71a28322"
integrity sha512-RERvMFdLpaFfSRIEe632yDm5nsd0SDKn8hGmcUwswnyiE5mtdZLDybtHAz6hjJhawokF0hXvGLtx9mrQfm6FkA==
private@^0.1.8:
version "0.1.8"
resolved "https://registry.npmjs.org/private/-/private-0.1.8.tgz#2381edb3689f7a53d653190060fcf822d2f368ff"
integrity sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg==
process-nextick-args@~2.0.0:
version "2.0.1"
resolved "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2"
integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==
readable-stream@^2.0.2:
version "2.3.7"
resolved "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz#1eca1cf711aef814c04f62252a36a62f6cb23b57"
integrity sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==
dependencies:
core-util-is "~1.0.0"
inherits "~2.0.3"
isarray "~1.0.0"
process-nextick-args "~2.0.0"
safe-buffer "~5.1.1"
string_decoder "~1.1.1"
util-deprecate "~1.0.1"
recast@*:
version "0.19.1"
resolved "https://registry.npmjs.org/recast/-/recast-0.19.1.tgz#555f3612a5a10c9f44b9a923875c51ff775de6c8"
integrity sha512-8FCjrBxjeEU2O6I+2hyHyBFH1siJbMBLwIRvVr1T3FD2cL754sOaJDsJ/8h3xYltasbJ8jqWRIhMuDGBSiSbjw==
dependencies:
ast-types "0.13.3"
esprima "~4.0.0"
private "^0.1.8"
source-map "~0.6.1"
safe-buffer@~5.1.0, safe-buffer@~5.1.1:
version "5.1.2"
resolved "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d"
integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==
source-map@~0.6.1:
version "0.6.1"
resolved "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==
stricter-htmlparser2@^3.9.6:
version "3.9.6"
resolved "https://registry.npmjs.org/stricter-htmlparser2/-/stricter-htmlparser2-3.9.6.tgz#fd195f5e4bc0989c6b15fc79eca85c6401bb5045"
integrity sha512-w/PqXYnjfpi49nb3xnsizORItMM53M/jHdCL8Cer0OqO3vRLsNDtRKoHY/IkIuGnH7/TEn23yvlZoQQLt7pdrw==
dependencies:
domelementtype "^1.3.0"
domutils "^1.5.1"
entities "^1.1.1"
inherits "^2.0.1"
readable-stream "^2.0.2"
x-domhandler "^2.4.2"
string_decoder@~1.1.1:
version "1.1.1"
resolved "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8"
integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==
dependencies:
safe-buffer "~5.1.0"
universalify@^0.1.0:
version "0.1.2"
resolved "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66"
integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==
util-deprecate@~1.0.1:
version "1.0.2"
resolved "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"
integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=
x-domhandler@^2.4.2:
version "2.4.2"
resolved "https://registry.npmjs.org/x-domhandler/-/x-domhandler-2.4.2.tgz#21afb2d71977118688e49e05c30894497ce3d5e9"
integrity sha512-c+T0p5hsahezbHpahjNpSDKjMMwGwOnG6Iaz8zzSjEBlJM47hakZmNBLNpktZJjuRdopoUMPf7HzcPcTE1G0GQ==
dependencies:
domelementtype "1"
......@@ -1399,7 +1399,18 @@ function getExtraValue (vm, dataPathsArray) {
const propPath = dataPathArray[1];
const valuePath = dataPathArray[3];
const vFor = dataPath ? vm.__get_value(dataPath, context) : context;
let vFor;
if (Number.isInteger(dataPath)) {
vFor = dataPath;
} else if (!dataPath) {
vFor = context;
} else if (typeof dataPath === 'string' && dataPath) {
if (dataPath.indexOf('#s#') === 0) {
vFor = dataPath.substr(3);
} else {
vFor = vm.__get_value(dataPath, context);
}
}
if (Number.isInteger(vFor)) {
context = value;
......@@ -1449,6 +1460,12 @@ function processEventExtra (vm, extra, event) {
} else {
if (dataPath === '$event') { // $event
extraObj['$' + index] = event;
} else if (dataPath === 'arguments') {
if (event.detail && event.detail.__args__) {
extraObj['$' + index] = event.detail.__args__;
} else {
extraObj['$' + index] = [event];
}
} else if (dataPath.indexOf('$event.') === 0) { // $event.target.value
extraObj['$' + index] = vm.__get_value(dataPath.replace('$event.', ''), event);
} else {
......
......@@ -1064,7 +1064,18 @@ function getExtraValue (vm, dataPathsArray) {
const propPath = dataPathArray[1];
const valuePath = dataPathArray[3];
const vFor = dataPath ? vm.__get_value(dataPath, context) : context;
let vFor;
if (Number.isInteger(dataPath)) {
vFor = dataPath;
} else if (!dataPath) {
vFor = context;
} else if (typeof dataPath === 'string' && dataPath) {
if (dataPath.indexOf('#s#') === 0) {
vFor = dataPath.substr(3);
} else {
vFor = vm.__get_value(dataPath, context);
}
}
if (Number.isInteger(vFor)) {
context = value;
......@@ -1114,6 +1125,12 @@ function processEventExtra (vm, extra, event) {
} else {
if (dataPath === '$event') { // $event
extraObj['$' + index] = event;
} else if (dataPath === 'arguments') {
if (event.detail && event.detail.__args__) {
extraObj['$' + index] = event.detail.__args__;
} else {
extraObj['$' + index] = [event];
}
} else if (dataPath.indexOf('$event.') === 0) { // $event.target.value
extraObj['$' + index] = vm.__get_value(dataPath.replace('$event.', ''), event);
} else {
......
......@@ -980,7 +980,18 @@ function getExtraValue (vm, dataPathsArray) {
const propPath = dataPathArray[1];
const valuePath = dataPathArray[3];
const vFor = dataPath ? vm.__get_value(dataPath, context) : context;
let vFor;
if (Number.isInteger(dataPath)) {
vFor = dataPath;
} else if (!dataPath) {
vFor = context;
} else if (typeof dataPath === 'string' && dataPath) {
if (dataPath.indexOf('#s#') === 0) {
vFor = dataPath.substr(3);
} else {
vFor = vm.__get_value(dataPath, context);
}
}
if (Number.isInteger(vFor)) {
context = value;
......@@ -1030,6 +1041,12 @@ function processEventExtra (vm, extra, event) {
} else {
if (dataPath === '$event') { // $event
extraObj['$' + index] = event;
} else if (dataPath === 'arguments') {
if (event.detail && event.detail.__args__) {
extraObj['$' + index] = event.detail.__args__;
} else {
extraObj['$' + index] = [event];
}
} else if (dataPath.indexOf('$event.') === 0) { // $event.target.value
extraObj['$' + index] = vm.__get_value(dataPath.replace('$event.', ''), event);
} else {
......
......@@ -1072,7 +1072,18 @@ function getExtraValue (vm, dataPathsArray) {
const propPath = dataPathArray[1];
const valuePath = dataPathArray[3];
const vFor = dataPath ? vm.__get_value(dataPath, context) : context;
let vFor;
if (Number.isInteger(dataPath)) {
vFor = dataPath;
} else if (!dataPath) {
vFor = context;
} else if (typeof dataPath === 'string' && dataPath) {
if (dataPath.indexOf('#s#') === 0) {
vFor = dataPath.substr(3);
} else {
vFor = vm.__get_value(dataPath, context);
}
}
if (Number.isInteger(vFor)) {
context = value;
......@@ -1122,6 +1133,12 @@ function processEventExtra (vm, extra, event) {
} else {
if (dataPath === '$event') { // $event
extraObj['$' + index] = event;
} else if (dataPath === 'arguments') {
if (event.detail && event.detail.__args__) {
extraObj['$' + index] = event.detail.__args__;
} else {
extraObj['$' + index] = [event];
}
} else if (dataPath.indexOf('$event.') === 0) { // $event.target.value
extraObj['$' + index] = vm.__get_value(dataPath.replace('$event.', ''), event);
} else {
......
......@@ -937,7 +937,18 @@ function getExtraValue (vm, dataPathsArray) {
const propPath = dataPathArray[1];
const valuePath = dataPathArray[3];
const vFor = dataPath ? vm.__get_value(dataPath, context) : context;
let vFor;
if (Number.isInteger(dataPath)) {
vFor = dataPath;
} else if (!dataPath) {
vFor = context;
} else if (typeof dataPath === 'string' && dataPath) {
if (dataPath.indexOf('#s#') === 0) {
vFor = dataPath.substr(3);
} else {
vFor = vm.__get_value(dataPath, context);
}
}
if (Number.isInteger(vFor)) {
context = value;
......@@ -987,6 +998,12 @@ function processEventExtra (vm, extra, event) {
} else {
if (dataPath === '$event') { // $event
extraObj['$' + index] = event;
} else if (dataPath === 'arguments') {
if (event.detail && event.detail.__args__) {
extraObj['$' + index] = event.detail.__args__;
} else {
extraObj['$' + index] = [event];
}
} else if (dataPath.indexOf('$event.') === 0) { // $event.target.value
extraObj['$' + index] = vm.__get_value(dataPath.replace('$event.', ''), event);
} else {
......
......@@ -922,7 +922,18 @@ function getExtraValue (vm, dataPathsArray) {
const propPath = dataPathArray[1];
const valuePath = dataPathArray[3];
const vFor = dataPath ? vm.__get_value(dataPath, context) : context;
let vFor;
if (Number.isInteger(dataPath)) {
vFor = dataPath;
} else if (!dataPath) {
vFor = context;
} else if (typeof dataPath === 'string' && dataPath) {
if (dataPath.indexOf('#s#') === 0) {
vFor = dataPath.substr(3);
} else {
vFor = vm.__get_value(dataPath, context);
}
}
if (Number.isInteger(vFor)) {
context = value;
......@@ -972,6 +983,12 @@ function processEventExtra (vm, extra, event) {
} else {
if (dataPath === '$event') { // $event
extraObj['$' + index] = event;
} else if (dataPath === 'arguments') {
if (event.detail && event.detail.__args__) {
extraObj['$' + index] = event.detail.__args__;
} else {
extraObj['$' + index] = [event];
}
} else if (dataPath.indexOf('$event.') === 0) { // $event.target.value
extraObj['$' + index] = vm.__get_value(dataPath.replace('$event.', ''), event);
} else {
......
......@@ -319,6 +319,14 @@ describe('mp:compiler-extra', () => {
</view>`,
'<view><block wx:for="{{list[idx]}}" wx:for-item="item" wx:for-index="__i0__" wx:key="id"><view data-event-opts="{{[[\'tap\',[[\'m1\',[\'$0\'],[[[\'list.\'+idx+\'\',\'id\',item.id]]]]]]]}}" class="mid-item-title" bindtap="__e"><view data-event-opts="{{[[\'tap\',[[\'m2\',[\'$0\'],[[[\'list.\'+idx+\'\',\'id\',item.id]]]]]]]}}" class="mid-item-icon" catchtap="__e"></view></view></block></view>'
)
assertCodegen(
'<view><view class="item" v-for="i in \'abc\'" :key="i" @click="func(i)"></view></view>',
'<view><block wx:for="abc" wx:for-item="i" wx:for-index="__i0__" wx:key="*this"><view data-event-opts="{{[[\'tap\',[[\'func\',[\'$0\'],[[[\'#s#abc\',\'\',__i0__]]]]]]]}}" class="item" bindtap="__e"></view></block></view>'
)
assertCodegen(
'<view><view class="item" v-for="i in 5" :key="i" @click="func(i)"></view></view>',
'<view><block wx:for="{{5}}" wx:for-item="i" wx:for-index="__i0__" wx:key="*this"><view data-event-opts="{{[[\'tap\',[[\'func\',[\'$0\'],[[[5,\'\',__i0__]]]]]]]}}" class="item" bindtap="__e"></view></block></view>'
)
})
it('generate class binding', () => {
......
......@@ -10,7 +10,7 @@ const {
getMapCallExpression
} = require('./statements')
const {
const {
hasOwn,
genCode,
traverseKey,
......@@ -25,8 +25,8 @@ const origVisitor = {
Identifier (path) {
if (
!path.node.$mpProcessed &&
path.node.name === this.forItem &&
path.isReferencedIdentifier()
path.node.name === this.forItem &&
path.isReferencedIdentifier()
) {
const forItemIdentifier = t.identifier(this.forItem)
forItemIdentifier.$mpProcessed = true
......@@ -61,7 +61,10 @@ function replaceRefrence (forItem, code) {
}
function getForExtra (forItem, forIndex, path, state) {
let forCode = genCode(processMemberExpression(path.node.arguments[0], state), true)
const arg0 = path.node.arguments[0]
const isNumeric = t.isNumericLiteral(arg0)
const isString = t.isStringLiteral(arg0)
let forCode = genCode(processMemberExpression(arg0, state), true)
const forKey = traverseKey(path.node)
const origForKeyCode = t.isIdentifier(forKey) && forKey.name
......@@ -80,11 +83,17 @@ function getForExtra (forItem, forIndex, path, state) {
forExtraElements.push(...scoped.forExtra)
}
}
let forCodeElem = t.stringLiteral(forCode)
if (isNumeric) {
forCodeElem = t.numericLiteral(arg0.value)
} else if (isString) {
forCodeElem = t.stringLiteral('#s#' + forCode)
}
if (forItem === origForKeyCode) { // 以自身为 key,则依据 forIndex 查找 ['list','',__i0__],['list','',index]
forExtraElements.push(
t.arrayExpression(
[
t.stringLiteral(forCode),
forCodeElem,
t.stringLiteral(''),
t.identifier(forIndex)
]
......@@ -94,7 +103,7 @@ function getForExtra (forItem, forIndex, path, state) {
forExtraElements.push(
t.arrayExpression(
[
t.stringLiteral(forCode),
forCodeElem,
t.stringLiteral(forIndex === forKeyCode ? '' : forKeyCode),
forKey || t.identifier(forIndex)
]
......
......@@ -59,6 +59,17 @@ module.exports = function (content, map) {
${statCode}
import 'uni-app-style'
import App from './${normalizePath(params.page)}.nvue?mpType=page'
if (typeof Promise !== 'undefined' && !Promise.prototype.finally) {
Promise.prototype.finally = function(callback) {
const promise = this.constructor
return this.then(
value => promise.resolve(callback()).then(() => value),
reason => promise.resolve(callback()).then(() => {
throw reason
})
)
}
}
App.mpType = 'page'
App.route = '${params.page}'
App.el = '#root'
......@@ -73,4 +84,4 @@ module.exports = function (content, map) {
const automatorCode = process.env.UNI_AUTOMATOR_WS_ENDPOINT ? 'import \'@dcloudio/uni-app-plus/dist/automator\';'
: ''
return automatorCode + statCode + content
}
}
......@@ -78,8 +78,20 @@ module.exports = function generateComponent (compilation) {
let moduleId = ''
if (name.indexOf('node-modules') === 0) {
const modulePath = removeExt(restoreNodeModules(name))
const resource = normalizePath(path.resolve(process.env.UNI_INPUT_DIR, '..', modulePath))
let resource = normalizePath(path.resolve(process.env.UNI_INPUT_DIR, '..', modulePath))
const altResource = normalizePath(path.resolve(process.env.UNI_INPUT_DIR, modulePath))
if (
/^win/.test(process.platform) &&
modulePath.includes('@dcloudio') &&
(
modulePath.includes('page-meta') ||
modulePath.includes('navigation-bar')
)
) {
resource = normalizePath(path.resolve(process.env.UNI_CLI_CONTEXT, modulePath))
}
moduleId = findComponentModuleId(modules, concatenatedModules, resource, altResource)
} else {
const resource = removeExt(path.resolve(process.env.UNI_INPUT_DIR, name))
......
......@@ -59,6 +59,17 @@ module.exports = function (content, map) {
}
}
if ( // windows 上 page-meta, navigation-bar 可能在不同盘上
/^win/.test(process.platform) &&
path.isAbsolute(resourcePath) &&
(
resourcePath.indexOf('page-meta') !== -1 ||
resourcePath.indexOf('navigation-bar') !== -1
)
) {
resourcePath = normalizePath(path.relative(process.env.UNI_CLI_CONTEXT, resourcePath))
}
if (!type) {
type = 'Component'
}
......
......@@ -4,6 +4,7 @@ const loaderUtils = require('loader-utils')
const {
removeExt,
normalizePath,
getPlatformExts,
getShadowTemplate
} = require('@dcloudio/uni-cli-shared')
......@@ -43,7 +44,19 @@ module.exports = function (content, map) {
if (vueLoaderOptions) {
const globalUsingComponents = getGlobalUsingComponents()
const realResourcePath = path.relative(process.env.UNI_INPUT_DIR, this.resourcePath)
const resourcePath = normalizeNodeModules(removeExt(realResourcePath) + templateExt)
let resourcePath = normalizeNodeModules(removeExt(realResourcePath) + templateExt)
if ( // windows 上 page-meta, navigation-bar 可能在不同盘上
/^win/.test(process.platform) &&
path.isAbsolute(resourcePath) &&
(
resourcePath.indexOf('page-meta') !== -1 ||
resourcePath.indexOf('navigation-bar') !== -1
)
) {
resourcePath = normalizePath(path.relative(process.env.UNI_CLI_CONTEXT, resourcePath))
}
const wxComponents = getWXComponents(resourcePath.replace(path.extname(resourcePath), ''))
const params = loaderUtils.parseQuery(this.resourceQuery)
......
......@@ -322,7 +322,18 @@ function getExtraValue (vm, dataPathsArray) {
const propPath = dataPathArray[1]
const valuePath = dataPathArray[3]
const vFor = dataPath ? vm.__get_value(dataPath, context) : context
let vFor
if (Number.isInteger(dataPath)) {
vFor = dataPath
} else if (!dataPath) {
vFor = context
} else if (typeof dataPath === 'string' && dataPath) {
if (dataPath.indexOf('#s#') === 0) {
vFor = dataPath.substr(3)
} else {
vFor = vm.__get_value(dataPath, context)
}
}
if (Number.isInteger(vFor)) {
context = value
......@@ -372,6 +383,12 @@ function processEventExtra (vm, extra, event) {
} else {
if (dataPath === '$event') { // $event
extraObj['$' + index] = event
} else if (dataPath === 'arguments') {
if (event.detail && event.detail.__args__) {
extraObj['$' + index] = event.detail.__args__
} else {
extraObj['$' + index] = [event]
}
} else if (dataPath.indexOf('$event.') === 0) { // $event.target.value
extraObj['$' + index] = vm.__get_value(dataPath.replace('$event.', ''), event)
} else {
......@@ -533,4 +550,4 @@ export function handleEvent (event) {
) {
return ret[0]
}
}
}
......@@ -5,7 +5,8 @@ const LIFECYCLE_HOOKS = [
'onLaunch',
'onShow',
'onHide',
'onUniNViewMessage',
'onUniNViewMessage',
'onPageNotFound',
'onError',
// Page
'onLoad',
......
......@@ -103,7 +103,9 @@ export function navigateBack ({
return
}
uni.hideToast() // 后退时,关闭 toast,loading
// 后退时,关闭 toast,loading
uni.hideToast()
uni.hideLoading()
if (currentPage.$page.meta.isQuit) {
quit()
......@@ -120,4 +122,4 @@ export function navigateBack ({
return {
errMsg: 'navigateBack:ok'
}
}
}
......@@ -6,17 +6,16 @@ import {
invoke
} from '../../bridge'
let waiting
let waitingTimeout
let toast = false
let toastTimeout
let toast
let toastType
let timeout
export function showLoading (args) {
return callApiSync(showToast, args, 'showToast', 'showLoading')
return callApiSync(showToast, Object.assign({}, args, { type: 'loading' }), 'showToast', 'showLoading')
}
export function hideLoading () {
return callApiSync(hideToast, Object.create(null), 'hideToast', 'hideLoading')
return callApiSync(hide, 'loading', 'hide', 'hideLoading')
}
export function showToast ({
......@@ -25,41 +24,18 @@ export function showToast ({
image = '',
duration = 1500,
mask = false,
position = ''
position = '',
type = 'toast'
} = {}) {
if (position) {
if (toast) {
toastTimeout && clearTimeout(toastTimeout)
plus.nativeUI.closeToast()
}
if (waiting) {
waitingTimeout && clearTimeout(waitingTimeout)
waiting.close()
}
if (~['top', 'center', 'bottom'].indexOf(position)) {
plus.nativeUI.toast(title, {
verticalAlign: position
})
toast = true
toastTimeout = setTimeout(() => {
hideToast()
}, 2000)
return {
errMsg: 'showToast:ok'
}
}
console.warn('uni.showToast 传入的 "position" 值 "' + position + '" 无效')
}
if (duration) {
if (waiting) {
waitingTimeout && clearTimeout(waitingTimeout)
waiting.close()
}
if (toast) {
toastTimeout && clearTimeout(toastTimeout)
plus.nativeUI.closeToast()
}
hide(null)
toastType = type
if (['top', 'center', 'bottom'].includes(position)) {
// 仅可以关闭 richtext 类型,但 iOS 部分情况换行显示有问题
plus.nativeUI.toast(title, {
verticalAlign: position
})
toast = true
} else {
if (icon && !~['success', 'loading', 'none'].indexOf(icon)) {
icon = 'success'
}
......@@ -93,35 +69,42 @@ export function showToast ({
height: '55px',
icon: '__uniappsuccess.png',
interval: duration
}
}
}
waiting = plus.nativeUI.showWaiting(title, waitingOptions)
waitingTimeout = setTimeout(() => {
hideToast()
}, duration)
toast = plus.nativeUI.showWaiting(title, waitingOptions)
}
timeout = setTimeout(() => {
hide(null)
}, duration)
return {
errMsg: 'showToast:ok'
}
}
export function hideToast () {
if (toast) {
toastTimeout && clearTimeout(toastTimeout)
plus.nativeUI.closeToast()
toast = false
return callApiSync(hide, 'toast', 'hide', 'hideToast')
}
export function hide (type = 'toast') {
if (type && type !== toastType) {
return
}
if (waiting) {
waitingTimeout && clearTimeout(waitingTimeout)
waiting.close()
waiting = null
waitingTimeout = null
if (timeout) {
clearTimeout(timeout)
timeout = null
}
if (toast === true) {
plus.nativeUI.closeToast()
} else if (toast && toast.close) {
toast.close()
}
toast = null
toastType = null
return {
errMsg: 'hideToast:ok'
errMsg: 'hide:ok'
}
}
export function showModal ({
......
......@@ -59,10 +59,17 @@ function initGlobalListeners () {
const globalEvent = requireNativePlugin('globalEvent')
const emit = UniServiceJSBridge.emit
// splashclosed 时开始监听 backbutton
plus.globalEvent.addEventListener('splashclosed', () => {
if (weex.config.preload) {
if (process.env.NODE_ENV !== 'production') {
console.log('[uni-app] preload.addEventListener.backbutton')
}
plus.key.addEventListener('backbutton', backbuttonListener)
})
} else {
// splashclosed 时开始监听 backbutton
plus.globalEvent.addEventListener('splashclosed', () => {
plus.key.addEventListener('backbutton', backbuttonListener)
})
}
plus.globalEvent.addEventListener('pause', () => {
emit('onAppEnterBackground')
......@@ -230,4 +237,4 @@ export function registerApp (appVm) {
__uniConfig.ready = true
process.env.NODE_ENV !== 'production' && perf('registerApp')
}
}
......@@ -55,7 +55,8 @@ export default {
globalEvent.addEventListener('launchApp', () => {
if (process.env.NODE_ENV !== 'production') {
console.log('[uni-app] launchApp')
}
}
plus.updateConfigInfo && plus.updateConfigInfo()
registerApp(this)
oldMount.call(this, el, hydrating)
})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册