当前位置:网站首页>Iframe child parent pass parameter
Iframe child parent pass parameter
2022-04-22 06:38:00 【Crazy_ GirlLL】
1, Parent page to child page (iframe) The ginseng
Parent
Subpage (iframe)

Code :
// The parent page passes data to the child page
Parent :
<iframe id="ifm" ref="ifm" :src="interviewFeedBackUrl" frameborder="no" border="0" class="flexItem"></iframe>
mounted () {
// iframe Send a message after loading , Otherwise, the sub page will not receive message
this.$refs.ifm.onload = () => {
// iframe Send a message immediately after loading
this.$refs.ifm.contentWindow.postMessage({
'token': this.token
}, '*')
}
}
Sub level :
mounted () {
window.addEventListener("message", this.handleIncomingMessage, false)
},
2, Subpage (iframe) Pass parameters to parent page
Subpage

Parent page
Code :
Sub level
window.parent.postMessage({msg:'feedback_form_draft'}, '*')
Parent
mounted () {
// Accept iframe Parameters of
window.addEventListener('message', this.handleIncomingMessage, false)
},
版权声明
本文为[Crazy_ GirlLL]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220554364339.html
边栏推荐
猜你喜欢

2021-07-07

Kyushu cloud edge MEP was selected as a typical product in the report of China edge cloud research

servlet3.0+事件驱动实现高性能长轮询

数美科技获得ISO/IEC 27701隐私信息管理体系国际认证

Good news | Kyushu cloud was rated as "Zhejiang high tech enterprise research and development center"

mysql知识点总结

Pgdoucer best practices: Series 4

js引擎的循环机制:同步,异步,事件循环

Iframe子父级传参

护航·未来| 数美2022数字风控峰会正式启程
随机推荐
《信息系统项目管理师总结》第一章 项目整体管理
开源数据库管理系统现在比商业产品更受欢迎
PostgreSQL 13.3、12.7、11.12、10.17和9.6.22发布了!
MYSQL 查看优化器后执行得SQL语句详情
Escort · the future 𞓜 digital risk control summit of digital America 2022 officially set off
Idea插件之RestfulToolkit
Mvcc transaction isolation in PostgreSQL
Iframe子父级传参
Copu helped Peking University Graduate open source public elective course - Open Source PostgreSQL R & D course successfully enter Peking University
一套sql语句同时支持Oracle跟Mysql?
浅谈分布式锁
Kyushu cloud passes the authoritative evaluation of EC ready edge cloud
TiDB分表唯一主键ID——sequence 与gorm无法获取主键的解决
Hit the pain point directly, Kyushu cloud 5g private network helps FAW Fusheng intelligent logistics construction
The difference between equalsignorecase() and equals()
Functions and differences between synchronized keyword and volatile keyword
MySQL备忘录(供自己查询所用)
数美科技CTO梁堃建议:技术+运营组合防控 “杀猪盘”
congratulations! China Mobile Smart Home Center was selected in the list of ICT industry in 2020
API慢接口分析