2 lines
7.9 KiB
JavaScript
2 lines
7.9 KiB
JavaScript
(function(t){function e(e){for(var o,r,s=e[0],c=e[1],l=e[2],u=0,p=[];u<s.length;u++)r=s[u],Object.prototype.hasOwnProperty.call(i,r)&&i[r]&&p.push(i[r][0]),i[r]=0;for(o in c)Object.prototype.hasOwnProperty.call(c,o)&&(t[o]=c[o]);d&&d(e);while(p.length)p.shift()();return a.push.apply(a,l||[]),n()}function n(){for(var t,e=0;e<a.length;e++){for(var n=a[e],o=!0,s=1;s<n.length;s++){var c=n[s];0!==i[c]&&(o=!1)}o&&(a.splice(e--,1),t=r(r.s=n[0]))}return t}var o={},i={app:0},a=[];function r(e){if(o[e])return o[e].exports;var n=o[e]={i:e,l:!1,exports:{}};return t[e].call(n.exports,n,n.exports,r),n.l=!0,n.exports}r.m=t,r.c=o,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"===typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="/";var s=window["webpackJsonp"]=window["webpackJsonp"]||[],c=s.push.bind(s);s.push=e,s=s.slice();for(var l=0;l<s.length;l++)e(s[l]);var d=c;a.push([0,"chunk-vendors"]),n()})({0:function(t,e,n){t.exports=n("56d7")},"034f":function(t,e,n){"use strict";var o=n("85ec"),i=n.n(o);i.a},1389:function(t,e,n){t.exports=n.p+"img/logo.82b9c7a5.png"},"56d7":function(t,e,n){"use strict";n.r(e);n("b0c0"),n("e260"),n("e6cf"),n("cca6"),n("a79d");var o=n("2b0e"),i=n("98c5"),a=n("0c63"),r=n("5efb"),s=n("55f1"),c=n("d865"),l=(n("202f"),n("bc3a")),d=n.n(l),u=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("a-layout",{attrs:{id:"components-layout-demo-top-side-2"}},[n("a-layout-header",{staticClass:"smx-docs-header"},[n("div",{staticStyle:{display:"inline-block",position:"absolute"}},[n("img",{staticStyle:{height:"50px",margin:"auto 15px"},attrs:{alt:"logo",src:t.logo}})]),n("h2",[t._v(t._s(t.name))])]),n("a-layout",{staticClass:"smx-docs-home"},[n("a-layout-sider",{staticClass:"smx-docs-map",attrs:{width:"250"}},[t.config?n("a-menu",{style:{height:"100%",borderRight:0},attrs:{theme:t.theme,mode:"inline",defaultSelectedKeys:[t.defaultSelectedKey],defaultOpenKeys:[t.config.defaultOpenItem]}},[t._l(t.config.sider,(function(e,o){return[n("a-sub-menu",{key:o},[n("span",{attrs:{slot:"title"},slot:"title"},[n("a-icon",{attrs:{type:t.appstore}}),t._v(t._s(o))],1),t._l(e,(function(e){return[n("a-menu-item",{key:e.key,on:{click:function(n){return t.openItem(e.page)}}},[e.icon?n("a-icon",{attrs:{type:e.icon}}):n("a-icon",{attrs:{type:"read"}}),t._v(" "+t._s(e.title)+" ")],1)]}))],2)]}))],2):t._e()],1),n("a-layout",[n("a-layout-sider",{staticClass:"smx-docs-editor",attrs:{width:t.editorWidth+"%"}},[n("div",{staticClass:"saveBar"},[n("span",{staticClass:"label"},[t._v("代码编辑器")]),n("a-icon",{staticClass:"icon",attrs:{type:"play-circle",title:"Ctrl-S[Command-S]"},on:{click:t.runHtml}}),t._v(" 运行 "),n("a-icon",{staticClass:"icon",attrs:{type:"undo"},on:{click:t.undoHtml}}),t._v(" 刷新 ")],1),n("editor",{attrs:{lang:"html",theme:"monokai",width:"100%",options:t.options,height:"calc(100% - 30px)"},on:{init:t.editorInit},model:{value:t.content,callback:function(e){t.content=e},expression:"content"}}),n("div",{staticClass:"smx-docs-draw",on:{click:t.switchEditor}},[n("div",{staticClass:"smx-docs-up"}),n("div",{staticClass:"smx-docs-down"}),t.editorDraw?n("a-icon",{staticClass:"smx-docs-close",attrs:{type:"left"}}):t._e(),t.editorDraw?t._e():n("a-icon",{staticClass:"smx-docs-close",attrs:{type:"right"}})],1)],1),n("a-layout-sider",{staticClass:"smx-docs-map",attrs:{width:100-t.editorWidth+"%"}},[n("iframe",{ref:"iframe",staticStyle:{overflow:"hidden",width:"100%",height:"100%"},attrs:{frameborder:"0",id:"container",allowfullscreen:"true"}})])],1)],1)],1)},p=[],m=n("1fca"),f=n("7238"),h={components:{ALayoutSider:m["a"],editor:f},data:function(){return{content:"",contentBak:"",options:{enableBasicAutocompletion:!0,enableSnippets:!0,enableLiveAutocompletion:!0,fontSize:12},config:null,defaultSelectedKey:null,editorDraw:!0,editorWidth:45,theme:"light",name:"",logo:"",appstore:""}},methods:{editorInit:function(t){var e=this;n("2099"),n("be9d"),n("bb36"),n("0329"),n("14d4"),t.commands.addCommand({name:"myCommand",bindKey:{win:"Ctrl-S",mac:"Command-S"},exec:function(){e.$refs.iframe.srcdoc=e.content},readOnly:!0})},runHtml:function(){this.$refs.iframe.srcdoc=this.content},undoHtml:function(){this.$refs.iframe.srcdoc=this.contentBak},beautifulHtml:function(){"dark"===this.theme?this.theme="light":this.theme="dark"},openItem:function(t){var e=this;this.$axios.get("/case/html/"+t).then((function(t){e.content=t.data,e.contentBak=t.data,e.$refs.iframe.srcdoc=e.content,e.editorDraw=!0,e.editorWidth=45}))},switchEditor:function(){this.editorDraw=!this.editorDraw,this.editorDraw?this.editorWidth=45:this.editorWidth=0}},mounted:function(){var t=this,e=this;this.$axios.get("/case/sider.json").then((function(o){var i;if(e.config=o.data,e.config.icon?e.appstore=e.config.icon:e.appstore="appstore",e.config.name?e.name=e.config.name:e.name="文档示例",e.config.logo?e.config.logo&&("local"===e.config.logo?e.logo=n("1389"):e.logo=t.config.logo):e.logo=n("cf05"),e.config.defaultOpenItem)i=e.config.sider[e.config.defaultOpenItem];else for(var a in e.config.sider)return void(i=e.config.sider[a]);e.defaultSelectedKey=i[0].key,e.openItem(i[0].page)}))}},g=h,y=(n("034f"),n("2877")),v=Object(y["a"])(g,u,p,!1,null,null,null),b=v.exports;o["a"].component(i["a"].name,i["a"]),o["a"].component(i["a"].Header.name,i["a"].Header),o["a"].component(i["a"].Sider.name,i["a"].Sider),o["a"].component(i["a"].Content.name,i["a"].Content),o["a"].component(a["a"].name,a["a"]),o["a"].component(r["a"].name,r["a"]),o["a"].component(s["a"].name,s["a"]),o["a"].component(s["a"].Item.name,s["a"].Item),o["a"].component(s["a"].SubMenu.name,s["a"].SubMenu),o["a"].component(s["a"].Divider.name,s["a"].Divider),o["a"].component(s["a"].ItemGroup.name,s["a"].ItemGroup),o["a"].component(c["a"].name,c["a"]),o["a"].component(c["a"].TreeNode.name,c["a"].TreeNode),o["a"].component(c["a"].DirectoryTree.name,c["a"].DirectoryTree),o["a"].config.productionTip=!1,o["a"].prototype.$axios=d.a,new o["a"]({render:function(t){return t(b)}}).$mount("#app")},7238:function(t,e,n){var o=n("061c");t.exports={render:function(t){var e=this.height?this.px(this.height):"100%",n=this.width?this.px(this.width):"100%";return t("div",{attrs:{style:"height: "+e+"; width: "+n}})},props:{value:String,lang:!0,theme:String,height:!0,width:!0,options:Object},data:function(){return{editor:null,contentBackup:""}},methods:{px:function(t){return/^\d*$/.test(t)?t+"px":t}},watch:{value:function(t){this.contentBackup!==t&&(this.editor.session.setValue(t,1),this.contentBackup=t)},theme:function(t){this.editor.setTheme("ace/theme/"+t)},lang:function(t){this.editor.getSession().setMode("string"===typeof t?"ace/mode/"+t:t)},options:function(t){this.editor.setOptions(t)},height:function(){this.$nextTick((function(){this.editor.resize()}))},width:function(){this.$nextTick((function(){this.editor.resize()}))}},beforeDestroy:function(){this.editor.destroy(),this.editor.container.remove()},mounted:function(){var t=this,e=this.lang||"text",i=this.theme||"chrome";n("b378");var a=t.editor=o.edit(this.$el);a.$blockScrolling=1/0,this.$emit("init",a),a.getSession().setMode("string"===typeof e?"ace/mode/"+e:e),a.setTheme("ace/theme/"+i),this.value&&a.setValue(this.value,1),this.contentBackup=this.value,a.on("change",(function(){var e=a.getValue();t.$emit("input",e),t.contentBackup=e})),t.options&&a.setOptions(t.options)}}},"85ec":function(t,e,n){},cf05:function(t,e,n){t.exports=n.p+"img/logo.82b9c7a5.png"}});
|
|
//# sourceMappingURL=app.37256e26.js.map
|