React中jquery引用的實(shí)現(xiàn)方法
來(lái)源:懂視網(wǎng)
責(zé)編:小采
時(shí)間:2020-11-27 22:30:27
React中jquery引用的實(shí)現(xiàn)方法
React中jquery引用的實(shí)現(xiàn)方法:在React中引用Jquery比較好玩,獲取元素的數(shù)據(jù)更多 1.引入方法舉例: import $ from 'jquery'; import { Button } from 'antd'; class testJquery extends React.Component { constructor(props) { super(
導(dǎo)讀React中jquery引用的實(shí)現(xiàn)方法:在React中引用Jquery比較好玩,獲取元素的數(shù)據(jù)更多 1.引入方法舉例: import $ from 'jquery'; import { Button } from 'antd'; class testJquery extends React.Component { constructor(props) { super(
在React中引用Jquery比較好玩,獲取元素的數(shù)據(jù)更多
1.引入方法舉例:
import $ from 'jquery';
import { Button } from 'antd';
class testJquery extends React.Component {
constructor(props) {
super(props);
this.selectElement = this.selectElement.bind(this);
}
render() {
return(
<div>
<Button onClick={this.selectElement}>點(diǎn)擊一下</Button>
<h4 className="text">這是:12</h4>
</div>
);
}
selectElement() {
console.log('text對(duì)象:',$('.text'));
console.log('text中的值:',$('.text')[0].textContent);
}
}
export default testJquery;
2.界面樣式
3. 控制臺(tái)打印結(jié)果
4.text對(duì)象部分屬性
聲明:本網(wǎng)頁(yè)內(nèi)容旨在傳播知識(shí),若有侵權(quán)等問題請(qǐng)及時(shí)與本網(wǎng)聯(lián)系,我們將在第一時(shí)間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com
React中jquery引用的實(shí)現(xiàn)方法
React中jquery引用的實(shí)現(xiàn)方法:在React中引用Jquery比較好玩,獲取元素的數(shù)據(jù)更多 1.引入方法舉例: import $ from 'jquery'; import { Button } from 'antd'; class testJquery extends React.Component { constructor(props) { super(