第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

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

React-Semantic UI 調(diào)度事件不起作用

React-Semantic UI 調(diào)度事件不起作用

回首憶惘然 2021-09-17 13:47:20
我正在創(chuàng)建一個帶有反應(yīng)語義 UI 的文本輸入,當單擊按鈕時將輸入文本。一切都運行良好,只是此操作不會觸發(fā)onchange事件,因此不會更新狀態(tài)。這是我將文本附加到輸入的函數(shù)const putTextAtCursor = (text, inputID) => {  let inputElement = document.getElementById(inputID);  console.log({ inputElement, inputID });  let cursorPosition = 0;  if (document.selection) {    inputElement.focus();    let selectionRange = document.selection.createRange();    selectionRange.moveStart("character", -inputElement.value.length);    cursorPosition = selectionRange.text.length;  } else if (    inputElement.selectionStart ||    inputElement.selectionStart == "0"  ) {    cursorPosition = inputElement.selectionStart;  }  let origValue = inputElement.value;  let newValue =    origValue.substr(0, cursorPosition) +    text +    origValue.substr(cursorPosition);  inputElement.value = newValue;  let start = inputElement.selectionStart;  inputElement.selectionStart = inputElement.selectionEnd = start + text.length;  let event = new UIEvent("change");  inputElement.dispatchEvent(event);  inputElement.focus();};在dispatchEvent似乎沒有被解雇。完整演示在這里如何解決這個問題?
查看完整描述

1 回答

  • 1 回答
  • 0 關(guān)注
  • 161 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號