zhangzengfei
2021-01-28 0f70bb5e95342e1c88e16b4c12609cd45dd1b103
src/components/treeMenu/jsTree/tree.vue
@@ -62,7 +62,7 @@
    childrenFieldName: { type: String, default: "children" },
    itemEvents: {
      type: Object,
      default: function() {
      default: function () {
        return {};
      }
    },
@@ -152,29 +152,29 @@
        item
      );
      let self = this;
      node.addBefore = function(data, selectedNode) {
      node.addBefore = function (data, selectedNode) {
        let newItem = self.initializeDataItem(data);
        let index = selectedNode.parentItem.findIndex(t => t.id === node.id);
        selectedNode.parentItem.splice(index, 0, newItem);
      };
      node.addAfter = function(data, selectedNode) {
      node.addAfter = function (data, selectedNode) {
        let newItem = self.initializeDataItem(data);
        let index =
          selectedNode.parentItem.findIndex(t => t.id === node.id) + 1;
        selectedNode.parentItem.splice(index, 0, newItem);
      };
      node.addChild = function(data) {
      node.addChild = function (data) {
        let newItem = self.initializeDataItem(data);
        node.opened = true;
        node[self.childrenFieldName].push(newItem);
      };
      node.openChildren = function() {
      node.openChildren = function () {
        node.opened = true;
        self.handleRecursionNodeChildren(node, node => {
          node.opened = true;
        });
      };
      node.closeChildren = function() {
      node.closeChildren = function () {
        node.opened = false;
        self.handleRecursionNodeChildren(node, node => {
          node.opened = false;
@@ -229,7 +229,7 @@
      oriNode.model.selected = true;
    },
    handleBatchSelectItems(oriNode, oriItem) {
      console.log('oriNode, oriItem',oriNode, oriItem)
      console.log('oriNode, oriItem', oriNode, oriItem)
      this.handleRecursionNodeChilds(oriNode, node => {
        if (!!node.model) {
          if (!!node.model.disabled) return;
@@ -335,7 +335,6 @@
    this.initializeData(this.data);
  },
  mounted() {
    debugger
    if (this.async) {
      this.$set(this.data, 0, this.initializeLoading());
      this.handleAsyncLoad(this.data, this);