首先看一下窗口间需要传输的最大的数据体,就不全展示了,只看一下概貌,也就是指下文中的this.$store.state:
Electron在版本8的时候,类似这种的操作是稀松平常的:
var jsonObj = {
isSendConversation: true,
isCreatedGroup: true,
isAddGroupUser: true,
sendTitle: "添加群成员",
groupId: groupId,
activeUsers: groupMemberUserInfos,
storeState: this.$store.state,
};
ipcRenderer.send("show-ModalComponent-window", {
url: url,
source: jsonObj,
type: "sendUserCard",
dataKey: currentWindow.id,
});
但自从升级到Electron版本15以后,中间有一些断崖式的升级,ipcRenderer.send携带参数中已经不允许使用非结构化数据了,用以上的方式传递都会报错,因为数据中包含了大量的自定义Object类型,于是乎有人给了这样一个方案:
ipcRenderer.send("show-ModalComponent-window", {
url: url,
source: JSON.parse(JSON.stringify