在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/HTML/ React中有沒有類似Vue中template里的$event特殊變量

React中有沒有類似Vue中template里的$event特殊變量

clipboard.png
我說的$event就是圖中指的那個

我的第一個問題就如標(biāo)題所說,react里該怎么表示

class Demo extends Component{
    warn = (message,event) => {
        console.log(message);
        console.log(event);
    }
        
    render() {
        return <div>
            {/* 這里第二參填什么。。 */}
            <button onClick={this.warn("hello","WTF")}>submit</button>
        </div>
    }
}

第二個問題 在Vue中除了$event以外還有其它“特殊變量”么
這一點我在vue源碼里面搜$event 看起來有點聯(lián)系的只有一個文件
https://github.com/vuejs/vue/...
的這一處

clipboard.png

第一個問題 小翼 解答了?,F(xiàn)在看看有沒有哪位朋友能指點一下我第二個問題

回答
編輯回答
擱淺

第一個問題這樣改:

class Demo extends Component{
    warn = (message, text, event) => {
        console.log(message);
        console.log(text);
        console.log(event);
    }
        
    render() {
        return <div>
            {/* 這里第二參填什么。。 */}
            <button onClick={e => this.warn("hello","WTF", e)}>submit</button>
        </div>
    }
}
2017年10月21日 05:30