父页面主要数据:
var vueObj = new Vue({ el: ‘#feedbackList‘, data: { feedList:[] }, methods: { loadFeedback: function () { var jsonStr = $("#newData").val() var json = JSON.parse(jsonStr); this.feedList.unshift(json); } } }) <div id="feedbackList" style="padding:20px 10px "> <input type="hidden" id="newData" v-on:click="loadFeedback()"/> <div class="row-fluid" v-for="item in feedList"> <div class="span12"> ... </div> </div> </div>
弹出层框架页面窗口主要数据:
1)复杂嵌套框架情况下使用:
$.Save({ url: "../../Manage/Feedback/Save?keyValue=...", param: postData, loading: "正在保存数据 ...", successMsg: "保存成功!", success: function () { if (keyValue) { var $obj; if (fromTarget == "workorder") $obj = window.top.frames[‘EmpDetail‘]; else $obj = $.currentIframe().frames[‘layui-layer-iframe‘ + index]; var jsonStr = ‘{"Attment":\"‘ + postData["Attac"] + ‘\","Content":\"‘ + postData["Content"] + ‘\","CreateTime":\"‘ + addTime + ‘\","CreateUserName":""}‘; $obj.$("#newData").val(jsonStr); $obj.$("#newData").trigger("click"); } else { $.currentIframe().reload(); } } })
2)一般框架下使用:
$.Save({ url: "../../Manage/uts/Save", param: { "list":postData }, loading: "正在保存数据...", successMsg: "保存成功!", success: function () { var obj = window.parent; obj.$("#newData").val(JSON.stringify(postData)); obj.$("#newData").trigger("click"); } })
使用layer.open打开一个框架页面执行成功回调时,怎么向父页面的Vue传值且能动态绑定数据?
原文:https://www.cnblogs.com/firstcsharp/p/12845097.html