Element: [Bug Report] Tree-Component doesn't collapse on prop-change from store to empty values

Created on 2 Aug 2017  ·  4Comments  ·  Source: ElemeFE/element

Element UI version

1.4.1

OS/Browsers version

macOS 10.12.6, Opera 46.0.2597.57

Vue version

2.4.2

Reproduction Link

https://jsfiddle.net/CinKon/pj71jkyw/433/

Steps to reproduce

Use Tree-Component
Use vuex-states for default-expanded-keys and current-node-key
Set default-expanded-keys = []
Set current-node-key = 0 (or something to disable)

What is Expected?

I want the Tree-Component to recognize and react to changes in the following properties to empty values: default-expanded-keys and current-node-key.
The tree then should collapse all open nodes and set all nodes to inactive.

What is actually happening?

At the moment, it doesn't do anything on change of these props.

tree stale

Most helpful comment

Current workaround:

      this.$refs.tree.store.currentNode = null

      Object.keys(this.$refs.tree.store.nodesMap).map((key, index) => {
        this.$refs.tree.store.nodesMap[key].checked = false
        this.$refs.tree.store.nodesMap[key].expanded = false
      })

All 4 comments

Current workaround:

      this.$refs.tree.store.currentNode = null

      Object.keys(this.$refs.tree.store.nodesMap).map((key, index) => {
        this.$refs.tree.store.nodesMap[key].checked = false
        this.$refs.tree.store.nodesMap[key].expanded = false
      })

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@CinKon That doesn't work

Do you mean the workaround? Well, it did 1 1/2 years ago, haven't worked with it since...

Was this page helpful?
0 / 5 - 0 ratings