亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

vue 怎么獲取元素?

vue 怎么獲取元素?

慕哥9229398 2018-10-11 14:15:04
//報名數的滾動        var box = document.querySelector('.list-box'),            boxUl = document.querySelector('.list-box .list-ul'),            boxLi = document.querySelectorAll('.list-ul li'),            startX = 0,            startTime, endTime, moveTime,            startY = 0,            moveDistance = 0;        offLeft = 0;      console.log(boxLi[0].offsetWidth);      alert(boxLi[0])        box.style.width = boxLi[0].offsetWidth * 4 + 'px';                 boxUl.style.width =boxLi[0].offsetWidth * boxLi.length + 'px';               var moveWidth = boxUl.offsetWidth - box.offsetWidth;                這上面是一個代碼片段,頁面是用vue2.0 來做的,boxLi里的li 是 v-for 循環出來的,boxLi[0]怎么都獲取不到li,  在vue mounted 這里面執行也不行,最后我用winod.onload 還是無法獲致到, 求解決方向法,怎么才能在 vue里獲到元素操作???
查看完整描述

1 回答

  • 1 回答
  • 0 關注
  • 561 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號