| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <template>
- <div class="node-container" :style="nodeStyle">
- <el-card class="node-card">
- {{title}}
- </el-card>
- </div>
- </template>
- <script>
- export default {
- name: "TreeNode",
- props:{
- title: String,
- positionY: Number,
- positionX: Number
- },
- computed:{
- nodeStyle(){
- return {
- top: (this.positionY*120)+'px',
- left: (300*this.positionX)+'px'
- }
- }
- }
- }
- </script>
- <style scoped>
- .node-container{
- width: 300px;
- height: 120px;
- box-sizing: border-box;
- position: absolute;
- display: flex;
- justify-content: center;
- align-items: center;
- }
- .node-card{
- width: 260px;
- height: 100px;
- background-color: #42b983;
- }
- </style>
|