VueTreeselect appears unknown solution

Sometimes you don’t understand why everything is right, and bugs can appear

VueTreeselect appears unkonwn, the more common reason is

1. The bound value is defined as an empty string in data and changed to null

2. The normalizer attribute, to convert the format returned by the backend to the format of VueTreeselect,

    normalizer(node) {
    
    
      if (node.children && !node.children.length) {
    
    
        delete node.children
      }
      return {
    
    
        id: node.id,
        code: node.code,
        label: node.name,

        children: node.children && node.children.length > 0 ? node.children : 0,
      }
    }

3. If there is no solution, there is another possibility, that is, when the node is clicked, the value is wrong

Print the node when you click the node, and find that you can only get the id, and you can’t get the others, because when assigning a value, there is a layer of this.$nextTick(() => {})

Do not use this.$nextTick(() => {}) to wrap the assignment in the node event, it will affect the value

Guess you like

Origin blog.csdn.net/weixin_49668076/article/details/130945233