var time=null;function VueInit(t,e,rootNode){new Vue({el:rootNode,data:{toastMsg:"",zindex:-1,subZindex:-1,nowItem:{},resultJson:JSON.stringify({menu:t||{}},null," "),menu:t,menuTypeList:[{value:"view",label:"跳转链接"},{value:"click",label:"事件推送"},{value:"miniprogram",label:"跳转小程序"}]},methods:{toast:function(t){clearTimeout(time),this.toastMsg=t;var e=this;time=setTimeout(function(){e.toastMsg=""},2e3)},addMenuHandler:function(t){if(0==t)this.menu.button.push({name:"菜单名称",type:"view"});else if(1==t){var e={name:"子菜单名称",type:"view"};this.menu.button[this.zindex].hasOwnProperty("sub_button")?(this.menu.button[this.zindex].sub_button.push(e),this.nowItem=deepClone(this.menu.button[this.zindex])):(Vue.set(this.menu.button[this.zindex],"sub_button",[e]),Vue.set(this.nowItem,"sub_button",[e])),Vue.delete(this.menu.button[this.zindex],"url"),Vue.delete(this.menu.button[this.zindex],"type"),Vue.delete(this.menu.button[this.zindex],"appid")}},removeMenuHandler:function(){this.subZindex<0?(this.menu.button.splice(this.zindex,1),this.zindex=-1,this.nowItem={}):(this.menu.button[this.zindex].sub_button.splice(this.subZindex,1),this.subZindex=-1,this.nowItem=deepClone(this.menu.button[this.zindex])),this.resultJson=JSON.stringify({menu:this.menu})},selectedMenuItem:function(t){this.zindex=t,this.nowItem=deepClone(this.menu.button[t]),this.subZindex=-1},selectedSubMenuItem:function(t){this.subZindex=t,this.nowItem=deepClone(this.menu.button[this.zindex].sub_button[t])},confirmEditor:function(){if(""==this.nowItem.name)return this.toast("请填写菜单名称"),!1;if("view"==this.nowItem.type&&!this.nowItem.url)return this.toast("请输入跳转链接"),!1;if("click"==this.nowItem.type&&!this.nowItem.key)return this.toast("请输入事件KEY"),!1;if("miniprogram"==this.nowItem.type){if(!this.nowItem.pagepath)return this.toast("请输入小程序路径"),!1;if(!this.nowItem.url)return this.toast("请输入备用链接"),!1;if(!this.nowItem.appid)return this.toast("请输入AppId"),!1}this.subZindex<0?this.menu.button.splice(this.zindex,1,this.nowItem):this.menu.button[this.zindex].sub_button.splice(this.subZindex,1,this.nowItem),this.resultJson=JSON.stringify({menu:this.menu},null," "),this.toast("修改成功")},saveHandler:function(){e&&e({menu:this.menu})},selectedMenuType:function(t){var e={type:t,name:this.nowItem.name};"click"==t?e.key=this.nowItem.url||"":"view"==t?e.url=this.nowItem.url||"":(e.appid="",e.url=this.nowItem.url||"",e.pagepath=""),this.nowItem=e}}})}function deepClone(t){var e;if(isArray(t))e=[];else{if(!isObject(t))return t;e={}}if(isArray(t))for(var n=0,i=t.length;n