<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                ### 1. 定義事件 ~~~ <input onChange={ async e => { // e.persist() await handleChange(e) }} value={props.value} onKeyPress={keyupadditem}/> <button onClick={additem}>添加</button> ~~~ ### 2. 事件處理 ~~~ const additem = () => { // console.log(props) //把跟新后的數據放在list中傳遞過去進行跟新 const actionchadd = { type: 'example/handleAdd', // list: props.list } props.dispatch(actionchadd); } const keyupadditem=(e)=>{ if (e.which !== 13) return // console.log('你按了回車鍵...') additem() } ~~~ ### 3. 整體展示 ~~~ import React from 'react'; import { connect } from 'dva'; import styles from './IndexPage.css'; function IndexPage(props) { const additem = () => { // console.log(props) //把跟新后的數據放在list中傳遞過去進行跟新 const actionchadd = { type: 'example/handleAdd', // list: props.list } props.dispatch(actionchadd); } const keyupadditem=(e)=>{ if (e.which !== 13) return // console.log('你按了回車鍵...') additem() } //獲取輸入框中的值 const handleChange = (e) => { const actionchange = { type: 'example/handleChange', value: e.target.value } props.dispatch(actionchange); // console.log(e.target.value) } const deleteitem = (e) => { // console.log(e) const actiondeleteitem = { type: "example/deleteitem", index: e, list: props.list } props.dispatch(actiondeleteitem) } return ( <div className={styles.normal}> <input onChange={ async e => { // e.persist() await handleChange(e) }} value={props.value} onKeyPress={keyupadditem}/> <button onClick={additem}>添加</button> <ul> {props.list.map((item, index) => { return <li key={index}><div><span>{item}</span><button onClick={deleteitem.bind(this, index)}>刪除</button></div></li> })} </ul> </div> ); } // IndexPage.propTypes = { // }; //用于連接模板文件與models文件 export default connect(({ example }) => { return { //接收models的state中的數據 list: example.list, value: example.value } })(IndexPage); ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看