Skip to content

Commit

Permalink
删除没用的代码
Browse files Browse the repository at this point in the history
  • Loading branch information
jaweii committed Aug 18, 2017
1 parent 5f3f60e commit 6e05b4b
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 75 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Vue-Layout",
"version": "0.0.1",
"version": "1.0.1",
"description": "vue可视化布局",
"author": "jawei <[email protected]>",
"private": true,
Expand Down
139 changes: 68 additions & 71 deletions src/components/components.vue
Original file line number Diff line number Diff line change
@@ -1,44 +1,22 @@
<template>
<section>
<mu-tabs :value="activeTab" @change="handleTabChange">
<mu-tab value="Mint-UI" title="Mint-UI" />
<mu-tab value="Muse-UI" title="Muse-UI" />
<mu-tab value="Common" title="通用" />
</mu-tabs>
<div v-if="activeTab==='Common'">
<br>
<ul class="components-list" @mousedown="mouseDown">
<li draggable="true" @dragstart="dragStart" data-name="Text">
<mu-icon value="text_fields" style="vertical-align:middle;" /> 文本
</li>
<li draggable="true" @dragstart="dragStart" data-name="A">
<mu-icon value="link" style="vertical-align:middle;" /> 链接
</li>
<li draggable="true" @dragstart="dragStart" data-name="Img">
<mu-icon value="image"/> 图片
</li>
<li draggable="true" @dragstart="dragStart" data-name="Br">
<mu-icon value="keyboard_return"/> 换行
</li>
<li draggable="true" @dragstart="dragStart" data-name="Div">
<mu-icon value="check_box_outline_blank"/> div
</li>
</ul>
</div>
<div v-if="activeTab === 'Mint-UI'">
<br>
<ul class="components-list" @mousedown="mouseDown">
<li draggable="true" @dragstart="dragStart" data-name="Header">
<mt-header fixed title="Header"></mt-header>
</li>
<li draggable="true" @dragstart="dragStart" data-name="Button">
<mt-button type="default">Button</mt-button>
</li>
</ul>
</div>
<mu-content-block style="display:flex;">
<mu-select-field :value="activeTab" @change="handleTabChange" autoWidth>
<mu-menu-item title="Muse-UI" value="Muse-UI">
</mu-menu-item>
<mu-menu-item title="Mint-UI" value="Mint-UI">
</mu-menu-item>
<mu-menu-item title="iView-UI" value="iView-UI">
</mu-menu-item>
<mu-menu-item title="Element-UI" value="Element-UI">
</mu-menu-item>
<mu-menu-item title="通用" value="Common">
</mu-menu-item>
</mu-select-field>
<mu-sub-header style="white-space:nowrap;">- 组件</mu-sub-header>
</mu-content-block>
<div v-if="activeTab === 'Muse-UI'">
<br>
<ul class="components-list" @mousedown="mouseDown">
<ul class="components-list">
<!-- 导航栏 -->
<li draggable="true" @dragstart="dragStart" data-name="App Bar">
<appbar />
Expand Down Expand Up @@ -134,13 +112,61 @@
<li draggable="true" @dragstart="dragStart" data-name="Circular Progress">
<circularProgress />
</li>

<li draggable="true" @dragstart="dragStart" data-name="Card">
<card />
</li>
<!-- <li draggable="true" @dragstart="dragStart" data-name="Back Top">
<!--
<li draggable="true" @dragstart="dragStart" data-name="Back Top">
<backTop/>
</li> -->
</li>
-->
</ul>
</div>
<div v-if="activeTab === 'Mint-UI'">
<ul class="components-list">
<li draggable="true" @dragstart="dragStart" data-name="Header">
<mt-header fixed title="Header"></mt-header>
</li>
<li draggable="true" @dragstart="dragStart" data-name="Button">
<mt-button type="default">Button</mt-button>
</li>
</ul>
</div>
<div v-if="activeTab === 'iView-UI'">
<ul class="components-list">
<!--
<li draggable="true" @dragstart="dragStart" data-name="Header">
<mt-header fixed title="Header"></mt-header>
</li>
-->
</ul>
</div>
<div v-if="activeTab === 'Element-UI'">
<ul class="components-list">
<!--
<li draggable="true" @dragstart="dragStart" data-name="Header">
<mt-header fixed title="Header"></mt-header>
</li>
-->
</ul>
</div>
<div v-if="activeTab==='Common'">
<ul class="components-list">
<li draggable="true" @dragstart="dragStart" data-name="Text">
<mu-icon value="text_fields" style="vertical-align:middle;" /> 文本
</li>
<li draggable="true" @dragstart="dragStart" data-name="A">
<mu-icon value="link" style="vertical-align:middle;" /> 链接
</li>
<li draggable="true" @dragstart="dragStart" data-name="Img">
<mu-icon value="image" /> 图片
</li>
<li draggable="true" @dragstart="dragStart" data-name="Br">
<mu-icon value="keyboard_return" /> 换行
</li>
<li draggable="true" @dragstart="dragStart" data-name="Div">
<mu-icon value="check_box_outline_blank" /> div
</li>
</ul>
</div>
</section>
Expand All @@ -155,41 +181,12 @@ export default {
}
},
mounted() {
//组件拖拽跟随鼠标
// document.onmousemove = this.mouseMove
//松开后移除
// document.onmouseup = e => {
// let drag = document.getElementById('dragging')
// this.removeDom(drag)
// }
},
methods: {
handleTabChange(val) {
this.activeTab = val
},
mouseDown(e) {
return
let component = this.getComponent(e.target)
if (!component)
return
let drag = document.getElementById('dragging')
this.removeDom(drag)
drag = component.cloneNode(true)
drag.id = 'dragging'
drag.setAttribute('draggable', true)
drag.style.width = component.offsetWidth + 'px'
drag.style.height = component.offsetHeight + 'px'
document.body.appendChild(drag)
},
mouseMove(e) {
let drag = document.getElementById('dragging')
if (!drag)
return
drag.style.left = e.pageX - drag.offsetWidth / 2 + 'px'
drag.style.top = e.pageY - drag.offsetHeight / 2 + 'px'
},
getComponent(e) {
if (!e)
return
Expand Down Expand Up @@ -237,7 +234,7 @@ export default {
&:hover {
transform: scale(1)translateX(5%);
}
i{
i {
vertical-align: middle;
}
}
Expand Down
5 changes: 2 additions & 3 deletions src/components/main.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
<mu-appbar>
<div class="title">
Vue-Layout
<mu-badge class="description" content="可视化布局 v1.0" color="#f06292" />
<mu-badge class="description" content="可视化布局 1.0" color="#f06292" />
</div>
<mu-icon-button icon="share" slot="right" @click="share.open=true" />
<mu-icon-button icon="settings" slot="right" @click="setting.open=true" />
<mu-icon-button icon=":iconfont icon-github" slot="right" href="https://github.com/jaweii/Vue-Layout" />
<mu-icon-button icon=":iconfont icon-github" slot="right" href="https://github.com/jaweii/Vue-Layout" />
</mu-appbar>
<mu-row class="main-content">
<mu-col class="attributes" :width="width.attr" :tablet="width.attr" :desktop="width.attr">
Expand All @@ -31,7 +31,6 @@
<preview ref="preview" />
</mu-col>
<mu-col class="components" :width="width.components" :tablet="width.components" :desktop="width.components">
<mu-sub-header>组件</mu-sub-header>
<components ref="components" />
</mu-col>
</mu-row>
Expand Down

0 comments on commit 6e05b4b

Please sign in to comment.