記事ディレクトリ
- まずマウントする
html
ファイルをpublic
フォルダーに置く必要があります
- 引用符で囲まれたパスの形式
<iframe ref="sheet" src="/luckysheet.html" width="100%" height="100%"></iframe>
- iframe は ref をバインドすることで取得され、データは渡す必要があるデータであり、iframes.postMessage のメソッドを通じて渡されます。
sentMsgSheet(data) {
const sheetWindow = this.$refs.sheet.contentWindow;
if (sheetWindow) {
sheetWindow.postMessage(data, '*');
}
}
sentMsgSheet([]);
- postMessage 通信の具体的な使用方法については、https: //blog.csdn.net/qq_45677671/article/details/128238860を参照してください。