1. 程式人生 > >Vue SPA應用中使用Layer的iframe 彈出層,並且傳值

Vue SPA應用中使用Layer的iframe 彈出層,並且傳值

lis app type The 問題 color class 喜歡 checklist

問題來源: BOOS 竟然說喜歡有可移動可最大化的彈出層,這!!!

技術分享圖片

SPA 模式下就是這種引入Vue.js的寫法

layer.open({
           type: 2,
           area: [840px, 550px],
           fixed: false, //不固定
           maxmin: true,
           title:title,
           content:url,
       });

正常引入layui.js 然後彈出,然後彈出層要調用父級層的方法,和賦值

     var
index = parent.layer.getFrameIndex(window.name); //獲取窗口索引 parent.app.UserCheckCount=this.UserCheckCount; parent.app.UserCheckList=this.UserCheckList; parent.app.QuestionSelectList=this.QuestionSelectList; parent.app.FatherQuestionList
=this.QuestionSelectList; parent.app.FatherQuestionMake(); console.log(parent.app.QuestionList); parent.app.QuestionSelectKey=this.QuestionSelectKey; parent.app.QuesctionPageMake(); parent.layer.close(index);

註意app是父級new 出來Vue的變量名

然後就可以愉快的玩耍了

!!!

Vue SPA應用中使用Layer的iframe 彈出層,並且傳值