Skip to content
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

bootstrap 4 added #1

Merged
merged 1 commit into from
Dec 11, 2019
Merged
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
English | [中文](README_CN.md)
English

# vue-tree-chart

Expand Down
117 changes: 0 additions & 117 deletions README_CN.md

This file was deleted.

14 changes: 8 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "vue-tree-chart",
"name": "vue-binary-tree",
"version": "1.2.6",
"description": "A vue2 component to display tree chart",
"author": "refined-x [tower1229@foxmail.com]",
"description": "A vue2 component to display binary trees",
"author": "mdiaz00147@gmail.com",
"main": "./dist/TreeChart.common.js",
"repository": {
"type": "git",
Expand All @@ -14,8 +14,8 @@
"keywords": [
"vue",
"tree",
"chart",
"tree chart"
"binary",
"binary tree"
],
"license": "MIT",
"homepage": "https://github.com/tower1229/Vue-Tree-Chart/blob/master/README.md",
Expand All @@ -33,7 +33,9 @@
"@vue/cli-plugin-babel": "^3.9.2",
"@vue/cli-plugin-eslint": "^3.9.2",
"@vue/cli-service": "^3.9.2",
"vue-template-compiler": "^2.6.10"
"vue-template-compiler": "^2.6.10",
"node-sass": "^4.13.0",
"sass-loader": "^8.0.0"
},
"eslintConfig": {
"root": true,
Expand Down
52 changes: 37 additions & 15 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,39 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title>vue-tree-chart</title>
</head>
<body>
<noscript>
<strong>We're sorry but blank doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>

<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"
integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<title>Vue-Binary-Tree</title>
</head>

<body>
<noscript>
<strong>We're sorry but blank doesn't work properly without JavaScript enabled. Please enable it to
continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"
integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"
integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q"
crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"
integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl"
crossorigin="anonymous"></script>
<script>
$(function () {
$('[data-toggle="tooltip"]').tooltip()
})
</script>
</body>

</html>
96 changes: 47 additions & 49 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,96 +1,94 @@
<template>
<div id="app">
<div id="app" class="main d-flex flex-column justify-content-around align-items-center">
<label>
切换为横向
<input type="checkbox" v-model="landscape" value="1">
Vertical
<input type="checkbox" v-model="landscape" value="1" />
</label>
<TreeChart :json="data" :class="{landscape: landscape.length}" @click-node="clickNode" />
<footer class="foot">
<p>© 2018 - 3018 Author
<a href="https://refined-x.com/" target="_blank">雅X共赏</a>
Github
<a href="https://github.com/tower1229/Vue-Tree-Chart" target="_blank">Vue-Tree-Chart</a>
</p>
<div class="main-content d-flex align-items-center">
<BinaryTree :json="data" :class="{landscape: landscape.length}" @click-node="clickNode" />
</div>

<footer class="main-footer bg-dark col-12 d-flex justify-content-center align-items-center">
<p class="text-white">
© 2020 Author
Github
<a
href="https://github.com/mdiaz00147/Vue-Binary-Tree"
target="_blank"
class="text-warning"
>Vue-Binary-Tree</a>
</p>
</footer>
</div>
</template>

<script>
import TreeChart from "@/components/TreeChart";
import BinaryTree from "@/components/BinaryTree";

export default {
name: 'app',
name: "app",
components: {
TreeChart
BinaryTree
},
data() {
return {
landscape: [],
data: {
name: 'root',
name: "root",
image_url: "https://static.refined-x.com/static/avatar.jpg",
children: [
{
name: 'children1',
name: "children1",
image_url: "https://static.refined-x.com/static/avatar.jpg"
},
{
name: 'children2',
name: "children2",
image_url: "https://static.refined-x.com/static/avatar.jpg",
mate: {
name: 'mate',
name: "mate",
image_url: "https://static.refined-x.com/static/avatar.jpg"
},
children: [
{
name: 'grandchild',
name: "grandchild",
image_url: "https://static.refined-x.com/static/avatar.jpg"
},
{
name: 'grandchild2',
name: "grandchild2",
image_url: "https://static.refined-x.com/static/avatar.jpg"
},
{
name: 'grandchild3',
name: "grandchild3",
image_url: "https://static.refined-x.com/static/avatar.jpg"
}
]
}
]
}
}
};
},
methods: {
clickNode: function(node){
clickNode: function(node) {
// eslint-disable-next-line
console.log(node)
console.log(node);
}
}
}
};
</script>

<style>
#app {
font-family: 'Avenir', Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
}
#app .avat{border-radius: 2em;border-width:2px;}
#app .name{font-weight:700;}
.foot {
position: fixed;
left: 0;
bottom: 0;
width: 100%;
background: #333;
padding: 24px;
overflow: hidden;
color: #999;
font-size: 14px;
text-align: center;
}
.foot a{color:#fff;margin:0 .5em}
</style>
<style lang="scss" scoped>
#app {
background: #e8ebee;
min-height: 1000px;
}

.main {
&-content {
flex: 1;
}

&-footer {
flex: 0.5;
}
}
</style>
Loading