我使用Ionic 3和Themeable Browser库,在工具栏Themeable Browser中自定义按钮,并第一次单击SitePointSitePressed()=>事件,单击未运行,但单击第二次,然后运行2事件。
cordova-plugin-themeablebrowser 0.2.17 离子(Ionic CLI):4.1.2 离子框架:离子角3.9.2 @ ionic / app-scripts:3.1.11 Android SDK工具:26.1.1 的NodeJS:v6.11.1 npm:6.2.0 操作系统:Windows 10 **我的代码:
const me = this;
this.ref = cordova.ThemeableBrowser.open(this.productUrl, '_blank', options)
.addEventListener('loadstart', function () {
console.log('loadstart')
me.viewProduct = false;
}).addEventListener('loadstop', function (event) {
console.log('load done');
}).addEventListener('loaderror', function (event) {
console.log('load error');
}).addEventListener('exit', function (x) {
console.log('exit app');
me.clear();
})
.addEventListener('SitePointSitePressed', function (x) {
me.dialogs.confirm(
"", // title
me.transText['addOrder'], // message
['OK', me.transText['quit']] // buttonLabels,
).then(onConfirm);
function onConfirm(buttonIndex) {
me.categoryService.getAllUsingGET().subscribe(data => {
me.categorys = data;
})