Skip to content

add direction prop #28

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 37 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

122 changes: 71 additions & 51 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,60 +1,80 @@
<template>
<div id="app">
<org-chart :datasource="ds" @node-click="selectNode">
<!-- <template slot-scope="{ nodeData }">
<b @click="selectNode(nodeData)">{{ nodeData.name }}</b>
</template> -->
</org-chart>
</div>
<div id="app">
<org-chart :datasource="ds"
@node-click="selectNode"
direction='r2l'>
<!-- <template slot-scope="{ nodeData }">
<b @click="selectNode(nodeData)">{{ nodeData.name }}</b>
</template> -->
</org-chart>
</div>
</template>

<script>
import OrgChart from './components/OrganizationChartContainer.vue'
import OrgChart from './components/OrganizationChartContainer.vue';

export default {
name: 'app',
components: {
OrgChart
},
data () {
return {
ds: {
'id': '1',
'name': 'Lao Lao',
'title': 'general manager',
'children': [
{ 'id': '2', 'name': 'Bo Miao', 'title': 'department manager' },
{ 'id': '3', 'name': 'Su Miao', 'title': 'department manager',
'children': [
{ 'id': '4', 'name': 'Tie Hua', 'title': 'senior engineer' },
{ 'id': '5', 'name': 'Hei Hei', 'title': 'senior engineer',
'children': [
{ 'id': '6', 'name': 'Pang Pang', 'title': 'engineer' },
{ 'id': '7', 'name': 'Xiang Xiang', 'title': 'UE engineer' }
]
}
]
},
{ 'id': '8', 'name': 'Hong Miao', 'title': 'department manager' },
{ 'id': '9', 'name': 'Chun Miao', 'title': 'department manager' }
]
}
}
},
methods: {
selectNode (nodeData) {
alert('node ' + nodeData.name + ' is selected')
}
}
}
export default {
name: 'app',
components: {
OrgChart
},
data() {
return {
ds: {
id: '1',
name: 'Lao Lao',
title: 'general manager',
children: [
{ id: '2', name: 'Bo Miao', title: 'department manager' },
{
id: '3',
name: 'Su Miao',
title: 'department manager',
children: [
{
id: '4',
name: 'Tie Hua',
title: 'senior engineer'
},
{
id: '5',
name: 'Hei Hei',
title: 'senior engineer',
children: [
{
id: '6',
name: 'Pang Pang',
title: 'engineer'
},
{
id: '7',
name: 'Xiang Xiang',
title: 'UE engineer'
}
]
}
]
},
{ id: '8', name: 'Hong Miao', title: 'department manager' },
{ id: '9', name: 'Chun Miao', title: 'department manager' }
]
}
};
},
methods: {
selectNode(nodeData) {
alert('node ' + nodeData.name + ' is selected');
}
}
};
</script>

<style>
#app {
font-family: 'Avenir', Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
}
#app {
font-family: 'Avenir', Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
}
</style>
Loading