React投票小程式,區分事件源。

2021-08-17 18:41:58 字數 964 閱讀 6510

情況:多個按鈕,對應乙個函式時,要區分是哪個按鈕發出的事件源。

import react from 'react'

import from 'react-dom'

import from 'antd-mobile';

const checkboxitem = checkbox.checkboxitem;

import from 'rc-form';

import style from '../model/model.less'

import from 'antd-mobile/../../src/services/';

var i = 1;

class voteemp extends react.component ,,,

,,,]

}componentdidmount(),

success: (res)=>)

},error: (err)=>,});

fetch("platform.vote.searchempvote",,

success: (res)=>)

},error: (err)=>,});

}onchange = (row, checked) => = this.state;

data.some((r) =>

});this.setstate();

}votesubmite = (e) => ,

success: (res)=>,

error: (err)=>,});

}render() = this.state;

return (

候選人數:16

已投票數:

參與人數:

投票於2023年1月20號結束!

>

onclick=}>更多

)})}

投票);

}export default voteemp

微信小程式區分點選,長按事件

touchstart 手指觸控 longtap 手指觸控後後,超過350ms離開 touchend 手指觸控動作結束 tap 手指觸控後離開 事件觸發順序 單擊touchstart touchend tap 長按touchstart longtap touchend tap 通過上 可以發現,單擊事...

react基礎事件 小案例

事件的繫結 三種方法 方法不加括號 事件帶括號會自動執行方法 普通執行事件不帶括號 this.方法 將函式改為箭頭函式 方法加括號 this.方法.bind this 用bind將當前的this傳過去 在constructor 中寫 this.方法 this.方法.bind this 事件的引數傳遞...

小程式點選事件

普通點選事件 bindtap 要放在前面,放在後面不好使 bindtap 會有冒泡事件 catchtap 不會有冒泡事件 1 2 view 3 button type warn size mini bindtap dian 點老子呀 button 4view 56 view 花木蘭 小程式傳值 da...