pens.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <template>
  2. <div>
  3. <el-collapse accordion>
  4. <el-collapse-item v-for="(item, index) in tools" :key="index">
  5. <template slot="title">{{ item.group }}</template>
  6. <a
  7. v-for="(btn, i) in item.children"
  8. :key="i"
  9. :title="btn.name"
  10. :draggable="btn.data"
  11. @dragstart="onDrag($event, btn)"
  12. >
  13. <i :class="`iconfont ${btn.icon}`" style="color:#2196f3;"></i>
  14. </a>
  15. </el-collapse-item>
  16. </el-collapse>
  17. </div>
  18. </template>
  19. <style scoped>
  20. .el-collapse-item__content {
  21. display: flex;
  22. flex-wrap: wrap;
  23. justify-content: left;
  24. }
  25. .el-collapse-item__content .iconfont {
  26. font-size: 30px;
  27. padding: 9px;
  28. }
  29. .el-collapse-item__header {
  30. padding-left: 5px;
  31. }
  32. .el-collapse-item__arrow {
  33. font-size: 20px;
  34. }
  35. </style>
  36. <script>
  37. import { CanvasTools, canvasRegister } from '../assets/js/canvas'
  38. //import hackjson from '../assets/css/hack.json'
  39. export default {
  40. data()
  41. {
  42. return {
  43. tools: CanvasTools,
  44. isToolCollapse: true,
  45. isCollapse: true,
  46. //hacktools: hackjson,
  47. };
  48. },
  49. methods: {
  50. onDrag(event, node)
  51. {
  52. console.log(event)
  53. event.dataTransfer.setData('Text', JSON.stringify(node.data))
  54. },
  55. },
  56. created()
  57. {
  58. // if (process.client && window['echartsData']) {
  59. // for (let key in window['echartsData']) {
  60. // document.body.removeChild(window['echartsData'][key]).div
  61. // }
  62. // window['echartsData'] = {}
  63. // }
  64. canvasRegister()
  65. // if (process.client) {
  66. // document.onclick = event =>
  67. // {
  68. // this.contextmenu = {
  69. // left: null,
  70. // top: null,
  71. // bottom: null
  72. // }
  73. // }
  74. // }
  75. },
  76. mounted()
  77. {
  78. //console.log(hackjson);
  79. }
  80. };
  81. </script>