add w3w iframe page
This commit is contained in:
parent
231d1a31da
commit
f3b4d4595d
@ -17,23 +17,36 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
value: "",
|
value: "",
|
||||||
iframe: document.querySelector("#iframe")
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
console.log('mounted')
|
||||||
window.addEventListener("message", (e) => {
|
window.addEventListener("message", (e) => {
|
||||||
if (e.data?.type === "w3wCampaignJoinSuccess") {
|
if (e.data?.type === "w3wCampaignJoinSuccess") {
|
||||||
console.log('on get iframe message: ')
|
console.log('on get iframe message: ')
|
||||||
console.log(e.data);
|
console.log(e.data);
|
||||||
|
//TODO:: 这里调用接口上报给服务端, 服务端进行检查
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
let iframe = document.getElementById("iframe")
|
||||||
|
let self = this;
|
||||||
|
iframe.onload =function() {
|
||||||
|
console.log('iframe load')
|
||||||
|
setTimeout(() => {
|
||||||
|
console.log('send wallet address to remote page')
|
||||||
|
// TODO:: 这里传真实的钱包地址
|
||||||
|
self.sendAddressToIframe('0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1')
|
||||||
|
}, 1000);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods:{
|
methods:{
|
||||||
navigator(){
|
navigator(){
|
||||||
this.$router.push('recommend')
|
this.$router.push('recommend')
|
||||||
},
|
},
|
||||||
|
|
||||||
sendAddressToIframe(address) {
|
sendAddressToIframe(address) {
|
||||||
this.iframe.contentWindow.postMessage(
|
let iframe = document.getElementById("iframe")
|
||||||
|
iframe.contentWindow.postMessage(
|
||||||
{
|
{
|
||||||
type: "w3wWalletAddressUpdate",
|
type: "w3wWalletAddressUpdate",
|
||||||
data: {
|
data: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user