[add] webview改透明度
This commit is contained in:
parent
3bdf5bf905
commit
ef23390d9a
@ -5,10 +5,10 @@ export default class Manager extends cc.Component {
|
||||
//#region 外調參數
|
||||
|
||||
@property({ type: cc.WebView })
|
||||
public webview: cc.WebView = null
|
||||
public webview: cc.WebView = null;
|
||||
|
||||
@property({ type: cc.Node })
|
||||
public BG: cc.Node = null
|
||||
public BG: cc.Node = null;
|
||||
|
||||
//#endregion
|
||||
|
||||
@ -18,8 +18,8 @@ export default class Manager extends cc.Component {
|
||||
let self: this = this;
|
||||
window.addEventListener("message", function (e: MessageEvent<any>): void {
|
||||
let data: any = e.data;
|
||||
let method = data.method;
|
||||
let value = data.value;
|
||||
let method: string = data.method;
|
||||
let value: any = data.value;
|
||||
if (method && self[method]) {
|
||||
if (value) {
|
||||
self[method](...value);
|
||||
@ -33,16 +33,25 @@ export default class Manager extends cc.Component {
|
||||
}, false);
|
||||
let href: string = window.location.href;
|
||||
|
||||
this.webview.url = `https://karolchang.github.io/jm-expense-vue-ts/?ignore=${Date.now()}`;
|
||||
// this.webview.url = `http://localhost:8080/jm-expense-vue-ts/?ignore=${Date.now()}&host=${href}`;
|
||||
this.webview.url = `https://karolchang.github.io/jm-expense-vue-ts/?host=${href}&ignore=${Date.now()}`;
|
||||
// this.webview.url = `http://localhost:8080/jm-expense-vue-ts/?host=${href}&ignore=${Date.now()}`;
|
||||
this.webview.node.active = true;
|
||||
|
||||
cc.view.setResizeCallback(this._resize.bind(this));
|
||||
this._resize();
|
||||
|
||||
setTimeout(() => {
|
||||
if (this.webview.node.opacity === 0) {
|
||||
self._closeBG();
|
||||
}
|
||||
}, 2000);
|
||||
}
|
||||
|
||||
private _closeBG(): void {
|
||||
this.BG.destroy();
|
||||
this.webview.node.opacity = 255;
|
||||
this.webview.node.active = false;
|
||||
this.webview.node.active = true;
|
||||
}
|
||||
|
||||
private _log(msg: string): void {
|
||||
|
Loading…
Reference in New Issue
Block a user