<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智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                [TOC] ## 小程序vue對比 [小程序](http://www.hmoore.net/book/henputongderen/xiaochengxu/edit) [vue](http://www.hmoore.net/book/henputongderen/vuexuexi/edit) ## 重點知識點 獲取服務器端的數據 ### 1.componentDidMount() > 組件輸出到 DOM 后會執行 componentDidMount() 鉤子 > 安裝組件時,該方法會觸發 - 主頁 ``` componentDidMount() { 1.指定地址 2.通過axios發送請求并獲取數據,設置數據到state } import axios from 'axios-jsonp-pro'; //跨域要引入 constructor(props){ super(props); this.state = { movie:[] //定義值 } } componentDidMount(){ var id = this.props.match.params.id; var url = "http://api.douban.com/v2/movie/"+id; axios.jsonp(url).then(res=>{ this.setState({ movie:res }) }) } ``` ### 2.傳遞參數 - 組件 ``` 依賴 yarn add react-router-dom npm i react-router-dom --save ``` ``` import { Link } from 'react-router-dom' //要安裝依賴 <Link to = {'/Detail/' + this.props.movie.id}> <div className="movie"> <img src={this.props.movie.imgUrl} alt\=""/> <p>{this.props.movie.title}</p> </Link> ``` ### 3.設置路由 - Router.js ``` import Detail from './pages/Detail'; <Route path = "/detail/:id" component = {Detail} /> ``` ### 3.獲取別的頁面傳來的值 - 跳轉頁 ``` constructor(props){ super(props); this.state={ imgUrl:"", title:"", summary:"" } } componentDidMount(){ //獲取路由中傳過來的id var id =this.props.match.params.id; var url ="http://api.douban.com/v2/movie/subject/"+id; axios.jsonp(url).then(res=>{ var {images,title,summary}=res; this.setState({ imgUrl:images.small, title, summary }) }) } ```
                  <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>

                              哎呀哎呀视频在线观看