鍍金池/ 問答/網(wǎng)絡(luò)安全  HTML/ iView組件Input[type="textarea"]的

iView組件Input[type="textarea"]的scroll事件無效

原生textarea的滾動(dòng)可以用@scroll,
但是iView里的Input組件好像沒有提供on-scroll指令,
請(qǐng)問應(yīng)該怎么辦?

回答
編輯回答
扯不斷

可以在mounted中綁定scroll事件來處理

mounted: {
    // 首先通過$refs獲取dom元素
    this.textArea = this.$refs.viewTextArea;
    // 監(jiān)聽這個(gè)dom的scroll事件
    this.textArea.addEventListener('scroll', () => {}, true);
}
2018年7月25日 08:18