iview tree组件获取选中的子节点 getCheckedNodes

        <Tree :data="menus" ref="tree" show-checkbox multiple style="display:inline-block"></Tree>
        
  export default {
    data () {
      return {
        menus: []
     }
    },
    created() {
      this.getTree()
    },
    methods: {
      getTree: function () {
        http.get("/menu/tree").then((res) => {
          if (res.code === 100) {
             this.menus.push(res.data);
          }
        })
      },
      //获取tree组件的选中子节点
      getNodes: function () {
        console.log(this.$refs.tree.getCheckedNodes())
      }
    }
  }

你可能感兴趣的:(vue,iview,tree)