vue实现自定义树形组件

news2024/11/24 17:03:44

欢迎点击关注-前端面试进阶指南:前端登顶之巅-最全面的前端知识点梳理总结

*分享一个使用比较久的🪜

效果展示:

在这里插入图片描述

近期的一个功能需求,实现一个树形结构:可点击,可拖拽,右侧数据可以拖拽到对应的节点内,可创建文件夹、可创建文件、编辑文件名、可删除等等;

渲染列表数据的时候,列表的子项还是列表。针对多层级的列表,我们采用tree的方式,从根节点一次创建绑定子节点的方式,可以递归式的调用本身,对我们的树形结构进行展示;并且支持多余的树形拓展;

代码区域

1、创建TreeList文件夹,其中创建:fonts文件夹、index.js文件、tools.js文件、Tree.js文件、VueTreeList.vue文件;
2、fonts文件夹主要用来存放icon图标的,这里就不展示了,依据项目在阿里矢量图标内新增,然后在VueTreeList.vue内进行替换

使用

源代码地址

 <vue-tree-list
    ref="VueTreeList"
    :model="treeData" // 初识数据源,treeData: new Tree([]),
    :activeId="activeId" // 选中的id及背景色
    default-leaf-node-name="新建文件" // 默认创建文件名称
    default-tree-node-name="新建目录" // 默认创建文件夹名称
    :default-expanded="isExpanded" // 默认是否展开文件夹
    @click="handleOnClick" // 点击当前节点
    @moveGraph="moveGraph" // 右侧数据拖拽至当前节点触发,可删除不使用
    @add-node="handleOnAddNode" // 点击创建节点
    @end-edit="handleOnChangeNameEnd" // 点击编辑当前节点的名称
    @delete-node="deleteNode" // 点击删除当前节点
    @drop="handleDrop" // 拖拽上下节点我已注释掉,依据需求自身放开
    @drop-before="hadnleDropBefore" // 开始拖拽之前的触发函数
    @drop-after="handleDropAfter" // 结束拖拽完之后的触发函数
    loadDataApi="/api/tree-dir" // 点击左侧icon,触发远程加载填充子数据Api接口
>
</vue-tree-list>
1.1 创建index.js文件,也是往外暴露的入口文件;(文章并未按照思路排序)
/**
 * Created by ayou on 17/7/21.
 */

import VueTreeList from './VueTreeList'
import { Tree, TreeNode } from './Tree'

VueTreeList.install = Vue => {
  Vue.component(VueTreeList.name, VueTreeList)
}

export default VueTreeList

export { Tree, TreeNode, VueTreeList }

1.2 创建tools.js文件;
/**
 * Created by ayou on 18/2/6.
 */

var handlerCache

export const addHandler = function(element, type, handler) {
  handlerCache = handler
  if (element.addEventListener) {
    element.addEventListener(type, handler, false)
  } else if (element.attachEvent) {
    element.attachEvent('on' + type, handler)
  } else {
    element['on' + type] = handler
  }
}

export const removeHandler = function(element, type) {
  if (element.removeEventListener) {
    element.removeEventListener(type, handlerCache, false)
  } else if (element.detachEvent) {
    element.detachEvent('on' + type, handlerCache)
  } else {
    element['on' + type] = null
  }
}

// depth first search
export const traverseTree = (root) => {
  const { children, parent, ...newRoot } = root;

  if (children && children.length > 0) {
    newRoot.children = children.map(traverseTree);
  }

  return newRoot;
};

1.2 创建Tree.js文件;
import { traverseTree } from './tools'

export class TreeNode {
  constructor(data) {
    const { id, isLeaf, editNode } = data
    this.id = typeof id !== 'undefined' ? id : Math.floor(new Date().valueOf() * (Math.random() + 1))
    this.parent = null
    this.children = null
    this.isLeaf = !!isLeaf
    this.editNode = editNode || false
    for (const key in data) {
      if (key !== 'id' && key !== 'children' && key !== 'isLeaf') {
        this[key] = data[key]
      }
    }
  }


  changeName(name) {
    this.name = name
  }

  changeNodeId(id) {
    this.id = id
  }

  addChildren(children) {
    if (!this.children) {
      this.children = []
    }
    if (Array.isArray(children)) {
      children.forEach(child => {
        child.parent = this
        child.pid = this.id
      })
      this.children.push(...children)
    } else {
      const child = children
      child.parent = this
      child.pid = this.id
      this.children.push(child)
    }
  }

  // remove self
  remove() {
    const parent = this.parent
    const index = parent.children.findIndex(child => child === this)
    parent.children.splice(index, 1)
  }

  // remove child
  _removeChild(child, bool) {
    const index = this.children.findIndex(c => bool ? c.id === child.id : c === child)
    if (index !== -1) {
      this.children.splice(index, 1)
    }
  }

  isTargetChild(target) {
    let parent = target.parent
    while (parent) {
      if (parent === this) {
        return true
      }
      parent = parent.parent
    }
    return false
  }

  moveInto(target) {
    if (this.name === 'root' || this === target) {
      return
    }
    if (this.isTargetChild(target)) {
      return
    }
    if (target.isLeaf) {
      return
    }
    this.parent.removeChild(this)
    this.parent = target
    this.pid = target.id
    if (!target.children) {
      target.children = []
    }
    target.children.unshift(this)
  }

  findChildIndex(child) {
    return this.children.findIndex(c => c === child)
  }

  _canInsert(target) {
    if (this.name === 'root' || this === target) {
      return false
    }
    if (this.isTargetChild(target)) {
      return false
    }
    this.parent.removeChild(this)
    this.parent = target.parent
    this.pid = target.parent.id
    return true
  }

  insertBefore(target) {
    if (!this._canInsert(target)) return
    const pos = target.parent.findChildIndex(target)
    target.parent.children.splice(pos, 0, this)
  }

  insertAfter(target) {
    if (!this._canInsert(target)) return
    const pos = target.parent.findChildIndex(target)
    target.parent.children.splice(pos + 1, 0, this)
  }

  toString() {
    return JSON.stringify(traverseTree(this))
  }
}

export class Tree {
  constructor(data) {
    this.root = new TreeNode({ name: 'root', isLeaf: false, id: 0 })
    this.initNode(this.root, data)
    return this.root
  }

  initNode(node, data) {
    data.forEach(_data => {
      const child = new TreeNode(_data)
      if (_data.children && _data.children.length > 0) {
        this.initNode(child, _data.children)
      }
      node.addChildren(child)
    })
  }
}

1.3 创建VueTreeList.vue文件;

说明:支持点击创建远程数据,loadDataAjax方法,需要自己研究功能小编已实现;现有代码基本功能已经完善,需要依赖自己的项目进行变更和更改;treeNode可以直接访问和修改数据源的,需要读者自己发掘;

<template>
  <div :class="['vtl', isMobile && 'isMobile']">
    <div
      v-if="model.name !== 'root'"
      :id="model.id"
      class="vtl-node"
      :class="{ 'vtl-leaf-node': model.isLeaf, 'vtl-tree-node': !model.isLeaf }"
    >
      <div class="vtl-border vtl-up" :class="{ 'vtl-active': isDragEnterUp }" />
      <div
        :class="['vtl-node-main', { 'vtl-active': isDragEnterNode }]"
        :style="{ fontSize: '10px' }"
        @drop="drop"
        @mouseover="mouseOver"
        @mouseout="mouseOut"
        @click.stop="handleCurClick"
        @dragover="dragOver"
        @dragenter="dragEnter"
        @dragleave="dragLeave"
      >

      <span
          v-if="!model.children"
          class="vtl-caret vtl-is-small"
        >
          <i
            class="vtl-icon"
            style="cursor: pointer; width: 11px;"
          ></i>
        </span>

        <span
          v-if="model.children"
          class="vtl-caret vtl-is-small"
        >
          <i
            class="vtl-icon"
            :class="caretClass"
            style="cursor: pointer"
            @click.prevent.stop="toggle"
          ></i>
          <i
            v-if="isRemoteLoading"
            class="Custom_demo-spin-icon-load ivu-icon ivu-icon-ios-loading"
            style="font-size: 16px; margin-right: 3px; margin-top: -2px"
          ></i>
        </span>

        <span v-if="model.isLeaf">
          <slot
            name="leafNodeIcon"
            :expanded="expanded"
            :model="model"
            :root="rootNode"
          >
            <i
              style="cursor: pointer"
              class="vtl-icon vtl-menu-icon vtl-icon-file"
            ></i>
          </slot>
        </span>
        <span v-else>
          <slot
            name="treeNodeIcon"
            :expanded="expanded"
            :model="model"
            :root="rootNode"
          >
            <img
              class="custom_img"
              style="width:15px;margin-right: 3px"
              src="../../../static/img/folder.png"
              alt=""
            />
          </slot>
        </span>

        <div
          v-if="!editable"
          :class="[
            'vtl-node-content',
            isShowClickBackg,
            { custom_class_hiddle: isHover, custom_class_click: model.isLeaf }
          ]"
          :style="{
            color: model.matched ? '#D9262C' : null,
            cursor: 'pointer'
          }"
        >
          <slot
            name="leafNameDisplay"
            :expanded="expanded"
            :model="model"
            :root="rootNode"
          >
            {{ model.name }}
          </slot>
        </div>
        <input
          v-if="editable || handleInitEditable(model)"
          class="vtl-input"
          type="text"
          ref="nodeInput"
          :value="model.name"
          @input="updateName"
          @blur="setUnEditable"
          @keyup.enter="setUnEditable"
        />
        <div class="vtl-operation" v-show="isHover">
          <!-- 新增设备 -->
          <span
            title="新增设备"
            v-btn-key="rolespermiss.addDevice"
            @click.stop.prevent="createChild"
            v-if="
              (!model.isDevice || model.isDir === false) &&
                $route.path != '/autoMonitorBoard'
            "
          >
            <slot
              name="addLeafNodeIcon"
              :expanded="expanded"
              :model="model"
              :root="rootNode"
            >
              <i class="vtl-icon vtl-icon-plus"></i>
            </slot>
          </span>
          <!-- 编辑名称 -->
          <span
            title="编辑名称"
            v-btn-key="rolespermiss.editFolder"
            @click.stop.prevent="setEditable(true)"
            v-if="
              !model.editNodeDisabled &&
                !model.isDevice &&
                $route.path != '/autoMonitorBoard'
            "
          >
            <slot
              name="editNodeIcon"
              :expanded="expanded"
              :model="model"
              :root="rootNode"
            >
              <i class="vtl-icon vtl-icon-edit"></i>
            </slot>
          </span>
          <!-- 删除节点 -->
          <span
            title="删除节点"
            @click.stop.prevent="delNode"
            style="line-height: 14px;"
            v-if="$route.path != '/autoMonitorBoard'"
            v-btn-key="rolespermiss.deleteFolder"
          >
            <slot
              name="delNodeIcon"
              :expanded="expanded"
              :model="model"
              :root="rootNode"
            >
              <i class="vtl-icon vtl-icon-trash"></i>
            </slot>
          </span>
          <!-- 创建子目录 -->
          <span
            :title="defaultAddTreeNodeTitle"
            @click.stop.prevent="addChild(false)"
            v-btn-key="rolespermiss.createFolder"
            v-if="
              !model.addTreeNodeDisabled &&
                !model.isLeaf &&
                !model.isDevice &&
                $route.path != '/autoMonitorBoard'
            "
          >
            <slot
              name="addTreeNodeIcon"
              :expanded="expanded"
              :model="model"
              :root="rootNode"
            >
              <i class="vtl-icon vtl-icon-folder-plus-e"></i>
            </slot>
          </span>
          <!-- 详情按钮 -->
          <span
            title="设备详情"
            style="margin-top: -1px"
            @click.stop="handleViewDetail"
            v-btn-key="rolespermiss.folderDetail"
            v-if="!model.addTreeNodeDisabled && model.isLeaf && !model.isDevice"
          >
            <Icon style="color: #d9262c" type="ios-paper-outline" />
          </span>
        </div>
      </div>
      <div
        v-if="
          model.children &&
            model.children.length > 0 &&
            (expanded || model.expanded)
        "
        class="vtl-border vtl-bottom"
        :class="{ 'vtl-active': isDragEnterBottom }"
      ></div>
    </div>

    <div
      :class="{ 'vtl-tree-margin': model.name !== 'root' }"
      v-if="isFolder && (model.name === 'root' || expanded || model.expanded)"
    >
      <item
        :model="model"
        :title="model.name"
        v-for="model in model.children"
        :key="model.id"
        :activeId="activeId"
        :loadDataApi="loadDataApi"
        :rolespermiss="rolespermiss"
        :requestHeader="requestHeader"
        :default-tree-node-name="defaultTreeNodeName"
        :default-leaf-node-name="defaultLeafNodeName"
        :default-expanded="defaultExpanded"
      >
        <template v-slot:leafNameDisplay="slotProps">
          <slot name="leafNameDisplay" v-bind="slotProps" />
        </template>
        <template v-slot:addTreeNodeIcon="slotProps">
          <slot name="addTreeNodeIcon" v-bind="slotProps" />
        </template>
        <template v-slot:addLeafNodeIcon="slotProps">
          <slot name="addLeafNodeIcon" v-bind="slotProps" />
        </template>
        <template v-slot:editNodeIcon="slotProps">
          <slot name="editNodeIcon" v-bind="slotProps" />
        </template>
        <template v-slot:delNodeIcon="slotProps">
          <slot name="delNodeIcon" v-bind="slotProps" />
        </template>
        <template v-slot:leafNodeIcon="slotProps">
          <slot name="leafNodeIcon" v-bind="slotProps" />
        </template>
        <template v-slot:treeNodeIcon="slotProps">
          <slot name="treeNodeIcon" v-bind="slotProps" />
        </template>
      </item>
    </div>
  </div>
</template>

<script>
import { request } from "@/axios/index";
import { TreeNode } from "./Tree.js";
import { removeHandler } from "./tools.js";
import { isShowMobile } from "@/storage/storeutil";

let compInOperation = null;

export default {
  name: "vue-tree-list",

  props: {
    model: {
      type: Object
    },
    activeId: Number,
    rolespermiss: Object,
    loadDataApi: String,
    requestHeader: Object,
    defaultLeafNodeName: {
      type: String,
      default: "新建"
    },
    defaultTreeNodeName: {
      type: String,
      default: "新建"
    },
    defaultAddTreeNodeTitle: {
      type: String,
      default: "新建"
    },
    defaultExpanded: {
      type: Boolean,
      default: true
    }
  },

  data() {
    return {
      isHover: false,
      editable: false,
      isDragEnterUp: false,
      isDragEnterBottom: false,
      isDragEnterNode: false,
      isRemoteLoading: false,
      expanded: this.defaultExpanded,
      clickEditIcon: false
    };
  },

  computed: {
    rootNode() {
      var node = this.$parent;
      while (node._props.model.name !== "root") {
        node = node.$parent;
      }
      return node;
    },

    caretClass() {
      return this.model.expanded
        ? "vtl-icon-caret-down"
        : this.expanded
        ? "vtl-icon-caret-down"
        : "vtl-icon-caret-right";
    },

    isFolder() {
      return this.model.children && this.model.children.length;
    },

    isShowClickBackg() {
      const {
        model: { id }
      } = this;
      return { activeItem: id === this.activeId };
    },

    isMobile() {
      return isShowMobile();
    }

    // treeNodeClass() {
    //   const {
    //     model: { dragDisabled, disabled },
    //   } = this;
    //   return {
    //     "vtl-drag-disabled": dragDisabled,
    //     "vtl-disabled": disabled,
    //   };
    // },
  },

  methods: {
    updateName(e) {
      var oldName = this.model.name;
      this.model.changeName(e.target.value);
      this.rootNode.$emit("change-name", {
        id: this.model.id,
        oldName: oldName,
        newName: e.target.value,
        node: this.model
      });
    },

    // 点击左侧箭头异步加载子节点数据
    toggle() {
      if (this.model.expanded) {
        this.expanded = false;
      } else {
        this.expanded = !this.expanded;
      }
      this.model.expanded = false;
    },

    // 删除节点
    delNode() {
      this.rootNode.$emit("delete-node", this.model);
    },

    setEditable(bool) {
      this.clickEditIcon = bool || false;
      this.editable = true;
      this.$nextTick(() => {
        const $input = this.$refs.nodeInput;
        $input.focus();
        this.handleCurClick();
      });
    },

    setUnEditable(e) {
      if (this.editable === false) return;
      this.editable = false;
      this.model.editNode = false;
      var oldName = this.model.name;
      this.model.changeName(e.target.value);
      this.rootNode.$emit(
        "change-name",
        {
          id: this.model.id,
          oldName: oldName,
          newName: e.target.value,
          eventType: "blur"
        },
        this.model
      );
      this.rootNode.$emit(
        "end-edit",
        {
          id: this.model.id,
          oldName: oldName,
          newName: e.target.value
        },
        this.model,
        this.clickEditIcon
      );
      this.clickEditIcon = false;
    },

    // 新建目录
    handleInitEditable(row) {
      if (row.editNode) {
        this.setEditable();
      }
    },

    // 异步请求数据
    async loadDataAjax(Refresh) {
      if (Refresh) {
        this.model.isLeaf = true;
      }
      const { method, params, httpApi } = this.requestHeader || {};
      const httpUrl = this.model.isLeaf ? httpApi : this.loadDataApi;
      const requestParams = this.model.isLeaf
        ? { treeDirId: this.model.id, ...(params || {}) }
        : { id: this.model.id, ...(params || {}) };
      try {
        this.isRemoteLoading = true;
        const { code, data, message } = await request(
          method || "GET",
          httpUrl,
          requestParams
        );

        if (code !== 0) {
          return (
            (this.expanded = false),
            (this.isRemoteLoading = false),
            this.$Message.error("失败," + message || "请求失败")
          );
        }

        const dataSource = this.model.isLeaf ? data.deviceList : data.data;
        if (!dataSource) {
          return (this.expanded = false), (this.isRemoteLoading = false);
        }

        if (Array.isArray(dataSource) && dataSource.length) {
          dataSource.forEach(item => {
            const node = new TreeNode(item);
            if (Refresh && this.expanded) {
              this.model._removeChild(node, true);
            }
            this.model.addChildren(node, true);
          });
          this.expanded = true;
        }

        this.isRemoteLoading = false;
      } catch (err) {
        this.expanded = false;
        this.isRemoteLoading = false;
        throw new Error(err);
      }
    },

    mouseOver() {
      if (this.model.disabled) return;
      this.isHover = true;
    },

    mouseOut() {
      this.isHover = false;
    },

    // 点击当前节点
    handleCurClick() {
      this.rootNode.$emit(
        "click",
        {
          toggle: this.toggle,
          ...this.model
        },
        this.editable
      );
      if (this.$route.path=='/autoMonitorBoard') {
        this.toggle()
      }
    },

    // 查看详情
    handleViewDetail() {
      this.rootNode.$emit("viewDetail", {
        ...this.model
      });
    },

    // 新增子节点
    async addChild(isLeaf) {
      if (!this.expanded) {
        await this.loadDataAjax();
        this.handleAddChildren(isLeaf);
      } else {
        this.handleAddChildren(isLeaf);
      }
    },

    handleAddChildren(isLeaf) {
      const name = isLeaf ? this.defaultLeafNodeName : this.defaultTreeNodeName;
      this.expanded = true;
      var node = new TreeNode({ name, isLeaf, isDir: false });
      this.model.addChildren(node, true);
      this.rootNode.$emit("add-node", node);
    },

    createChild() {
      this.rootNode.$emit("create-child", {
        ...this.model,
        loadDataAjax: this.loadDataAjax
      });
    },

    // dragStart(e) {
    //   if (!(this.model.dragDisabled || this.model.disabled)) {
    //     compInOperation = this;
    //     e.dataTransfer.setData("data", "data");
    //     e.dataTransfer.effectAllowed = "move";
    //     return true;
    //   }
    //   return false;
    // },

    // dragEnd() {
    //   compInOperation = null;
    // },

    dragOver(e) {
      e.preventDefault();
      return true;
    },

    dragEnter(ev) {
      this.isDragEnterNode = true;
    },

    dragLeave() {
      this.isDragEnterNode = false;
    },

    drop(ev) {
      if (ev.dataTransfer && ev.dataTransfer.getData("data")) {
        const data = JSON.parse(ev.dataTransfer.getData("data"));
        this.isDragEnterNode = false;
        this.$Modal.confirm({
          title: "提示",
          content: `是否确定要移入【${this.model.title}】目录中?`,
          closable: true,
          maskClosable: true,
          onOk: () => {
            this.axios
              .request("POST", "/api/move", {
                id: data.id,
                treeDirId: this.model.id
              })
              .then(response => {
                if (+response.code === 0) {
                  this.$Message.success("移动成功!");
                  this.rootNode.$emit("moveGraph");
                } else {
                  // 提示错误
                  this.$Notice.error({
                    title: "查询失败",
                    desc: response.message || "请求失败",
                    duration: 5
                  });
                }
              });
          }
        });
        return;
      }
      if (!compInOperation) return;
      const oldParent = compInOperation.model.parent;
      compInOperation.model.moveInto(this.model);
      this.isDragEnterNode = false;
      this.rootNode.$emit("drop", {
        target: this.model,
        node: compInOperation.model,
        src: oldParent
      });
    }

    //   dragEnterUp() {
    //     if (!compInOperation) return;
    //     this.isDragEnterUp = true;
    //   },

    //   dragOverUp(e) {
    //     e.preventDefault();
    //     return true;
    //   },

    //   dragLeaveUp() {
    //     if (!compInOperation) return;
    //     this.isDragEnterUp = false;
    //   },

    //   dropBefore() {
    //     if (!compInOperation) return;
    //     const oldParent = compInOperation.model.parent;
    //     compInOperation.model.insertBefore(this.model);
    //     this.isDragEnterUp = false;
    //     this.rootNode.$emit("drop-before", {
    //       target: this.model,
    //       node: compInOperation.model,
    //       src: oldParent,
    //     });
    //   },

    //   dragEnterBottom() {
    //     if (!compInOperation) return;
    //     this.isDragEnterBottom = true;
    //   },

    //   dragOverBottom(e) {
    //     e.preventDefault();
    //     return true;
    //   },

    //   dragLeaveBottom() {
    //     if (!compInOperation) return;
    //     this.isDragEnterBottom = false;
    //   },

    //   dropAfter() {
    //     if (!compInOperation) return;
    //     const oldParent = compInOperation.model.parent;
    //     compInOperation.model.insertAfter(this.model);
    //     this.isDragEnterBottom = false;
    //     this.rootNode.$emit("drop-after", {
    //       target: this.model,
    //       node: compInOperation.model,
    //       src: oldParent,
    //     });
    //   },
  },

  beforeCreate() {
    this.$options.components.item = require("./VueTreeList").default;
  },

  beforeDestroy() {
    removeHandler(window, "keyup");
  }
};
</script>

<style lang="less">
@font-face {
  font-family: "icomoon";
  src: url("fonts/icomoon.eot?ui1hbx");
  src: url("fonts/icomoon.eot?ui1hbx#iefix") format("embedded-opentype"),
    url("fonts/icomoon.ttf?ui1hbx") format("truetype"),
    url("fonts/icomoon.woff?ui1hbx") format("woff"),
    url("fonts/icomoon.svg?ui1hbx#icomoon") format("svg");
  font-weight: normal;
  font-style: normal;
}

.vtl-icon {
  font-family: "icomoon" !important;
  font-style: normal;
  font-weight: normal;
  font-variant: normal;
  text-transform: none;
  line-height: 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  &.vtl-menu-icon {
    margin-right: 4px;
    &:hover {
      color: inherit;
    }
  }
  &:hover {
    color: #d9262c;
  }
}

.vtl-icon-file:before {
  content: "\e906";
}
.vtl-icon-folder:before {
  content: "\e907";
}
.vtl-icon-caret-down:before {
  font-size: 16px;
  content: "\e901";
}
.vtl-icon-caret-right:before {
  font-size: 16px;
  content: "\e900";
}
.vtl-icon-edit:before {
  content: "\e902";
  font-size: 18px;
}
.vtl-icon-folder-plus-e:before {
  content: "\e903";
}
.vtl-icon-plus:before {
  content: "\e904";
  font-size: 16px;
}
.vtl-icon-trash:before {
  content: "\e905";
}

.vtl {
  cursor: default;
  margin-left: -3px;
}
.vtl-border {
  height: 5px;
  &.vtl-up {
    margin-top: -5px;
    background-color: transparent;
  }
  &.vtl-bottom {
    background-color: transparent;
  }
  &.vtl-active {
    border-bottom: 2px dashed pink;
  }
}

.vtl-node-main {
  display: flex;
  align-items: center;
  margin: 2.5px auto 2.5px -1px;
  .vtl-input {
    border: none;
    min-width: 200px;
    border-bottom: 1px solid blue;
  }
  &:hover {
    background-color: #f0f0f0;
  }
  &.vtl-active {
    outline: 1.5px dashed #d9262c;
  }

  .vtl-operation {
    display: flex;
    margin-left: 1rem;
    height: 18px;
    letter-spacing: 1px;
    span {
      margin-right: 10px;
    }
    .vtl-icon {
      color: #d9262c;
      vertical-align: sub;
    }
  }
}

.vtl-node-content {
  white-space: nowrap;
  padding: 1px 0px;
}

.activeItem {
  background: #ccc;
}
.custom_class_click {
  cursor: pointer;
}

.custom_class_hiddle {
  overflow: hidden;
  text-overflow: ellipsis;
}

.vtl-item {
  cursor: pointer;
}
.vtl-tree-margin {
  margin-left: 2em;
}

.Custom_demo-spin-icon-load {
  font-size: 18px;
  color: #d9262c;
  animation: ani-demo-spin 1s linear infinite;
}
@keyframes ani-demo-spin {
  from {
    transform: rotate(0deg);
  }
  50% {
    transform: rotate(180deg);
  }
  to {
    transform: rotate(360deg);
  }
}
.demo-spin-col {
  height: 100px;
  position: relative;
  border: 1px solid #eee;
}

.vtl-caret {
  display: flex;
  .vtl-icon {
    width: 28px;
    text-align: right;
  }
}

.isMobile {
  .vtl {
    margin-left: 3px;
  }
  .vtl-node-content {
    white-space: nowrap;
    padding: 1px 0px;
    font-size: 2.6em;
  }
  .custom_img {
    width: 2.5em !important;
  }
  .vtl-icon-caret-down:before,
  .vtl-icon-caret-right:before,
  .vtl-icon-plus:before,
  .vtl-icon-edit:before,
  .vtl-icon-trash:before,
  .vtl-icon-folder-plus-e:before {
    font-size: 30px;
  }
  .vtl-node-main .vtl-operation {
    height: auto;
  }
}
</style>

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/923149.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

金融学复习博迪(第10-12章)

第4部分 风险管理与资产组合理论 第10章 风险管理的原理 10.1什么是风险 风险与风险规避 在证券市场上&#xff0c;风险是指由于投资环境的不确定性和变动性&#xff0c;而导致的投资者收益的不确定性和变动性。不确定性是风险的必要条件而非充分条件。任何一种存在风险的情…

【分享】小型园区组网场景

小型园区组网图 在小型园区中&#xff0c;S2700&S3700通常部署在网络的接入层&#xff0c;S5700&S6700通常部署在网络的核心&#xff0c;出口路由器一般选用AR系列路由器。 接入交换机与核心交换机通过Eth-Trunk组网保证可靠性。 每个部门业务划分到一个VLAN中&#…

【数据仓库】Linux、CentOS源码安装Superset

Linux、CentOS源码安装Superset步骤&#xff0c;遇到的各种问题。 报错问题&#xff1a; Linux下pip版本问题 You are using pip version 8.1.2, however version 22.2.2 is available. 解决办法&#xff1a; 安装python3的pip yum install python3-pip再升级 pip3 install…

127.0.0.1、0.0.0.0和网卡ip地址的区别及原理剖析

127.0.0.1、0.0.0.0和网卡ip地址的区别及原理剖析 问题描述 在最近一次采用前后端分离的方式部署本地应用的过程中发现&#xff0c;前端的node服务启动在5173端口上&#xff0c;而后端的springboot服务配置文件中定义的服务端口server.port也是5173端口&#xff0c;且两者都能…

【Winform学习笔记(九)】Winform窗体程序延迟函数

Winform窗体程序延迟函数 前言正文1、具体代码2、使用示例 前言 Winform 窗体程序开发时&#xff0c;有时需要程序延迟或休眠几秒&#xff0c;如果直接使用 Thread.Sleep() 方法&#xff0c;会造成程序的假死&#xff0c;UI 界面停止响应&#xff1b; 本文中主要介绍一种方法&…

八、pikachu之越权

文章目录 1、越权概述2、水平越权3、垂直越权 1、越权概述 如果使用A用户的权限去操作B用户的数据&#xff0c;A的权限小于B的权限&#xff0c;如果能够成功操作&#xff0c;则称之为越权操作。 越权漏洞形成的原因是后台使用了 不合理的权限校验规则导致的。 一般越权漏洞容易…

保研面试题复习

信源/信道编码的目的和种类&#xff1f; 这个图是每个人在学习通信原理的时候&#xff0c;都会遇到的图。包含了三要素&#xff1a;信源、信道和信宿。这个图直接可以回答最开始的问题&#xff0c;所谓信源编码就是针对信源编码&#xff0c;所谓信道编码就是针对信道编码。 有…

【JavaEE】Spring全家桶实现AOP-统一处理

【JavaEE】AOP&#xff08;2&#xff09; 文章目录 【JavaEE】AOP&#xff08;2&#xff09;1. 统一登录校验处理1.1 自定义拦截器1.2 将自定义拦截器加入到系统配置1.3 测试1.4 对于静态资源的处理1.5 小练习&#xff1a;统一登录拦截处理1.6 拦截器原理1.6.1 执行流程1.6.2 源…

【多线程编程的第一课】进程和线程的概念,区别,联系

文章目录 0. 前言1. 进程2. 进程控制块&#xff08;PCB&#xff09;3. 线程3.1 线程概念3.2 为什么引入线程 4. 进程和线程区别与联系 0. 前言 要想了解多线程&#xff0c;那就绕不开进程&#xff0c;所以我们在学习多线程之前先简单了解一下进程。 1. 进程 进程是操作系统的基…

RabbitMQ特性介绍和使用案例

❤ 作者主页&#xff1a;李奕赫揍小邰的博客 ❀ 个人介绍&#xff1a;大家好&#xff0c;我是李奕赫&#xff01;(&#xffe3;▽&#xffe3;)~* &#x1f34a; 记得点赞、收藏、评论⭐️⭐️⭐️ &#x1f4e3; 认真学习!!!&#x1f389;&#x1f389; 文章目录 RabbitMQ特性…

张博《冰雪尖刀连》饰梅生 剧抛脸名不虚传

“《冰雪尖刀连》又燃又感动&#xff01;”“根本看不够&#xff01;”由著名导演执导&#xff0c;实力派演员主演的抗美援朝战争剧《冰雪尖刀连》正在总台央视一套热播&#xff0c;全网络平台同步更新中。该剧讲述了“钢七连”战士为了保家卫国远赴异国战场&#xff0c;爬冰卧…

设计模式——装饰器模式

装饰器模式 装饰器模式&#xff08;Decorator Pattern&#xff09;允许向一个现有的对象添加新的功能&#xff0c;同时又不改变其结构。这种类型的设计模式属于结构型模式&#xff0c;它是作为现有的类的一个包装。 装饰器模式通过将对象包装在装饰器类中&#xff0c;以便动态…

前端页面常见的布局分享

前端页面常见的布局分享 一、css盒模型 页面中的每一个元素都被看做一个矩形盒子。它包括&#xff1a;外边距、边框、内边距以及实际的内容。 网页设计中常听的属性名&#xff1a;内容(content)、填充(padding)、边框(border)、边界(margin)&#xff0c;CSS盒子模型都具备这些…

为什么说ChatGPT地位难保

似乎可以说&#xff0c;从ChatGPT推出以来&#xff0c;OpenAI一直是生成式人工智能的王者。但这种状况可能持续不了太久了。 自11月面世以来&#xff0c;OpenAI的聊天机器人颠覆了教学、写作、科技等多个领域[1]。它把世界上最大的科技公司如Meta和谷歌打了个措手不及&#x…

HJ31 单词倒排 题解

题目描述&#xff1a;单词倒排_牛客题霸_牛客网 (nowcoder.com) 对字符串中的所有单词进行倒排。 1、构成单词的字符只有26个大写或小写英文字母&#xff1b; 2、非构成单词的字符均视为单词间隔符&#xff1b; 3、要求倒排后的单词间隔符以一个空格表示&#xff1b;如果原字符…

如何拼接两个视频在一起?

如何拼接两个视频在一起&#xff1f;在度过一个美好周末的时候&#xff0c;我和朋友一起拍摄了两组视频&#xff0c;准备将两个视频合并成一个并发布到朋友圈。这个想法非常棒&#xff0c;但是我在第一步就遇到了麻烦&#xff1a;如何将这两个视频拼接在一起&#xff1f;这听起…

MyBatis分页思想和特殊字符

目录 一、MyBatis分页思想 1.1 使用场景 1.2 代码演示 二、MyBatis特殊字符 2.1代码演示 一、MyBatis分页思想 1.1 使用场景 Mybatis分页应用场景&#xff1a; MyBatis是一个Java持久层框架&#xff0c;它提供了一种将SQL查询和结果映射到Java对象的简单方式。分页是MyBa…

【LeetCode】面试题总结 消失的数字 最小k个数

1.消失的数字 两种思路 1.先升序排序&#xff0c;再遍历并且让后一项与前一项比较 2.转化为数学问题求等差数列前n项和 &#xff08;n的大小为数组的长度&#xff09;&#xff0c;将根据公式求得的应有的和数与数组中实际的和作差 import java.util.*; class Solution {public …

龙迅半导体,LT9611 MIPIDSI/CSI转HDMI,双端口MIPI接收,HDMI支持4K30HZ,免费提供完善的资料和选型推荐

龙迅LT9611 1.描述&#xff1a; LT9611 MIPIDSI/CSI到HDMI1.4桥具有双端口MIPID-PHY接收器前端配置&#xff0c;每个端口有4个数据通道&#xff0c;每个数据通道运行2Gbps&#xff0c;最大输入带宽为16Gbps。该桥提供了一个HDMI数据输出与可选的S/PDIF或8通道I2S串行音频输入…