element cascader 选择任意一级操作面积问题

//给.el-cascader-node__label也加上点击事件

mounted(){

    setInterval(function(){

      document.querySelectorAll('.el-cascader-node__label').forEach(el=>{

        el.onclick = function () {

          let checked = document.getElementsByClassName('is-checked')[0]

          if(checked){

            checked.classList.remove('is-checked')

          }

          this.previousElementSibling.click()

          this.previousSibling.getElementsByClassName('el-radio__input')[0].className += ' is-checked'

        }

      })

    },500)

  },

你可能感兴趣的:(vue,js,vue,element)