Skip to content

Commit

Permalink
feat: add component tree; !#zh: 组件树
Browse files Browse the repository at this point in the history
  • Loading branch information
ly525 committed Oct 12, 2020
1 parent b220828 commit d34d717
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 3 deletions.
4 changes: 4 additions & 0 deletions front-end/h5/src/components/core/editor/left-panel/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import RenderShortcutsPanel from './shortcuts-panel/index'
import RenderPageManager from './page-manager/index'
import RenderPageTree from './page-tree/index'

export default {
name: 'EditorLeftPanel',
Expand All @@ -16,6 +17,9 @@ export default {
<a-tab-pane key='page-manager' tab={this.$t('editor.sidebar.pages')}>
<RenderPageManager />
</a-tab-pane>
<a-tab-pane key='page-tree' tab={this.$t('editor.sidebar.tree')}>
<RenderPageTree />
</a-tab-pane>
</a-tabs>
</a-layout-sider>
)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<template>
<a-tree
class="draggable-tree"
:default-expanded-keys="expandedKeys"
draggable
:tree-data="treeData"
@dragenter="onDragEnter"
@drop="onDrop"
/>
</template>

<script>
import { mapState } from 'vuex'
function getTreeNode (ele) {
return {
title: ele.name,
key: ele.uuid,
children: (ele.children || []).map(getTreeNode)
}
}
export default {
computed: {
...mapState('editor', {
elements: state => state.editingPage.elements
}),
treeData () {
return this.elements.map(getTreeNode)
}
},
data () {
return {
gData: [],
expandedKeys: []
}
},
methods: {
onDragEnter (info) {
},
onDrop (info) {
}
}
}
</script>
3 changes: 2 additions & 1 deletion front-end/h5/src/locales/lang/en-US.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ export default {
sidebar: {
components: 'Components',
pages: 'Pages',
templates: 'Templates'
templates: 'Templates',
tree: 'Tree'
},
pageManager: {
title: 'Page {index}',
Expand Down
5 changes: 3 additions & 2 deletions front-end/h5/src/locales/lang/zh-CN.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @Author: ly525
* @Date: 2019-11-24 18:51:58
* @LastEditors: ly525
* @LastEditTime: 2020-10-13 00:51:57
* @LastEditTime: 2020-10-13 01:29:21
* @FilePath: /h5/src/locales/lang/zh-CN.js
* @Github: https://github.com/ly525/luban-h5
* @Description: Do not edit
Expand Down Expand Up @@ -42,7 +42,8 @@ export default {
sidebar: {
components: '组件列表',
pages: '页面管理',
templates: '模板'
templates: '模板',
tree: '组件树'
},
pageManager: {
title: '第{index}页面',
Expand Down

0 comments on commit d34d717

Please sign in to comment.