귀속 js, 귀속 모든 node 속성 이름 변경
                                            
 1505 단어  javascript 전단
                    
1. 잎사귀 결점이 아닌 id수조를 차례로 꺼낸다
getPriv(this.roleId).then((response) => {
             const privData = this.privData
             var a = []
             var forfn = function (list) {
               for (var i = 0; i < list.length; i++) {
                 if (list[i].children) {
                   a.push(list[i].id)
                   forfn(list[i].children)
                 }
               }
             }
             forfn(privData)
            // a b this.privIds b a 
             var b = response.data
             let RemoveSame = [...new Set([...a, ...b])]
             let SamePart = a.filter((item) => b.includes(item))
             let Difference = RemoveSame.filter(
               (item) => !SamePart.includes(item)
             )
             this.privIds = Difference
             // this.$refs.menu.setCheckedNodes(response.data)
           })2. 모든 node의 속성 이름을 차례로 바꿉니다
getTree().then((response) => {
      this.menuOptions = []
      //data tree, antd design  select 
      const ass = (data) => {
        let item = []
        data.map((list, i) => {
          let newData = {}
          newData.title = list.label
          newData.id = list.id
          newData.parentId = list.parentId
          newData.children = list.children ? ass(children) : [] // , 
          item.push(newData)
        })
        return item
      }
      var rda = ass(response.data)
      this.menuOptions = rda
    })이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
JavaScript 베이스(7)콜 () 과 apply () 를 호출하면 대상을 첫 번째 인자로 지정할 수 있습니다. Math.floor () 는 한 수를 아래로 가져올 수 있습니다. Math.round () 는 한 수를 반올림하여 정돈할 수 있다...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.