11<template >
22 <section class =" preview" @dragover =" dragOver" @drop =" drop" >
33 <!-- CODE视图 -->
4- <mu-paper class =" sound-code " >
5- <div class =" sound-code- bar" >
4+ <mu-paper class =" preview-head " >
5+ <div class =" bar" >
66 <mu-sub-header style =" display :inline ;" >{{showType}}</mu-sub-header >
77 <mu-icon-button style =" float :right ;" icon =" fullscreen" tooltip =" 全屏" @click =" fullScreen" />
88 <mu-icon-button style =" float :right ;" icon =" delete" tooltip =" 清空" @click =" empty" />
1414 <mu-icon-button style =" float :right ;" icon =" code" tooltip =" 查看代码" @click =" showCode" />
1515 <mu-icon-button v-if =" $store.state.backupComponents.length" style =" float :right ;" icon =" undo" tooltip =" 撤销" @click =" undo" />
1616 </div >
17- <mu-content-block :class =" {'sound-code- content':true,'active':showType!=='预览'}" >
17+ <mu-content-block :class =" {'content':true,'active':showType!=='预览'}" >
1818 <pre v-show =" showType==='CODE'" v-highlightjs =" getSource(components)" ><code class =" html" ></code ></pre >
1919 <textarea v-show =" showType==='编辑样式'" class =" css-editor" placeholder =" .vue-layout{ ... }" v-model =" css" ></textarea >
2020 </mu-content-block >
@@ -395,7 +395,7 @@ export default {
395395 if (placeholder)
396396 placeholder .parentElement .removeChild (placeholder)
397397 },
398- selectedSlot (){
398+ selectedSlot () {
399399 // 必需,勿删,会在ondrop中被重写
400400 },
401401 getSource (components ) { // 预览视图中所有组件的代码
@@ -569,15 +569,15 @@ export default {
569569 components = components .concat (copiedComponents)
570570 this .$store .commit (' setState' , {
571571 components,
572- copiedComponents: []// 粘贴后清除剪切板
572+ copiedComponents: [] // 粘贴后清除剪切板
573573 })
574574 let topComponent = this .getParentComponent (components[index])
575575 let topIndex = components .findIndex (c => c .info .id === topComponent .info .id )
576576 components[topIndex].template = getTemplate (components[topIndex].info , components[topIndex].attributes , components[topIndex].slots ).template
577577 // 因为getTemplate中需要最新的components,所以提交两次状态
578578 this .$store .commit (' setState' , {
579579 components,
580- copiedComponents: []// 粘贴后清除剪切板
580+ copiedComponents: [] // 粘贴后清除剪切板
581581 })
582582 this .fresh ()
583583 })
@@ -649,10 +649,10 @@ export default {
649649
650650.preview-area {
651651 overflow : auto ;
652- padding-top : 48px ;
653652 position : relative ;
654653 height : inherit ;
655654 z-index : 0 ;
655+ padding-bottom : 100px ;
656656}
657657
658658.preview-tip {
@@ -663,27 +663,31 @@ export default {
663663 z-index : -1 ;
664664}
665665
666- .sound-code {
667- position : absolute ;
666+ .preview-head {
668667 width : 100% ;
669668 top : 0 ;
670669 z-index : 2 ;
671- }
672-
673- .sound-code-bar {
674- background-color : @grey100 ;
675- }
676-
677- .sound-code-content {
678- height : 0 ;
679- overflow : auto ;
680- transition : all .2s ;
681- padding-top : 0 ;
682- padding-bottom : 0 ;
683- margin-top : 0 ;
684- margin-bottom : 0 ;
685- background-color : @grey50 ;
686- user-select : text ;
670+ .bar {
671+ background-color : @grey100 ;
672+ }
673+ .content {
674+ height : 0 ;
675+ overflow : auto ;
676+ transition : all .2s ;
677+ padding-top : 0 ;
678+ padding-bottom : 0 ;
679+ margin-top : 0 ;
680+ margin-bottom : 0 ;
681+ background-color : @grey50 ;
682+ user-select : text ;
683+ code {
684+ background : none ;
685+ font-family : Consolas, Liberation Mono, Menlo, Courier , monospace ;
686+ }
687+ }
688+ .content.active {
689+ height : 95vh ;
690+ }
687691}
688692
689693.css-editor {
@@ -695,15 +699,6 @@ export default {
695699 overflow : auto ;
696700}
697701
698- .sound-code-content code {
699- background : none ;
700- font-family : Consolas, Liberation Mono, Menlo, Courier , monospace ;
701- }
702-
703- .sound-code-content.active {
704- height : 95vh ;
705- }
706-
707702.preview-mobile {
708703 position : absolute ;
709704 width : 375px ;
@@ -719,10 +714,4 @@ export default {
719714 width : 100% ;
720715}
721716 </style >
722- <style >
723- /* 预览视图底部预留空间 方便操作 */
724717
725- .preview-area > * :nth-last-child (1 ) {
726- margin-bottom : 100px ;
727- }
728- </style >
0 commit comments