12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <template>
- <div>
- <el-collapse accordion>
- <el-collapse-item v-for="(item, index) in tools" :key="index">
- <template slot="title">{{ item.group }}</template>
- <a
- v-for="(btn, i) in item.children"
- :key="i"
- :title="btn.name"
- :draggable="btn.data"
- @dragstart="onDrag($event, btn)"
- >
- <i :class="`iconfont ${btn.icon}`" style="color:#2196f3;"></i>
- </a>
- </el-collapse-item>
- </el-collapse>
- </div>
- </template>
- <style scoped>
- .el-collapse-item__content {
- display: flex;
- flex-wrap: wrap;
- justify-content: left;
- }
- .el-collapse-item__content .iconfont {
- font-size: 30px;
- padding: 9px;
- }
- .el-collapse-item__header {
- padding-left: 5px;
- }
- .el-collapse-item__arrow {
- font-size: 20px;
- }
- </style>
- <script>
- import { CanvasTools, canvasRegister } from '../assets/js/canvas'
- export default {
- data()
- {
- return {
- tools: CanvasTools,
- isToolCollapse: true,
- isCollapse: true,
-
- };
- },
- methods: {
- onDrag(event, node)
- {
- console.log(event)
- event.dataTransfer.setData('Text', JSON.stringify(node.data))
- },
- },
- created()
- {
-
-
-
-
-
-
- canvasRegister()
-
-
-
-
-
-
-
-
-
-
- },
- mounted()
- {
-
- }
- };
- </script>
|