<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>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                # iview-admin簡介 iview-admin是iview生態圈的成員之一。是一套基于 Vue.js,搭配ivew UI([https://www.iviewui.com/](https://www.iviewui.com/))?組件庫形成的后臺集成解決方案。 # 環境 Windows+Node.js +git # 項目啟動 ## 下載代碼 在GitHub上下載iview-admin代碼 git clone https://github.com/iview/iview-admin.git -b 2.0 ![](https://img.kancloud.cn/86/f2/86f2c47c9a98231f6ec75ee9e73b2373_491x130.png) ## 安裝依賴 找到文件所在位置 ![](https://img.kancloud.cn/e1/25/e125ae3058b465c0e551c3796f508a07_532x150.png) 進入項目根目錄 cd iview-admin 安裝依賴 npm install ## 運行項目 運行項目 npm run dev 項目運行完成瀏覽器會自動打開網頁,進入登錄頁面。如圖 ![](https://img.kancloud.cn/ee/45/ee45b9729e0fd4c3dfae536f4725de95_1268x587.png) # 目錄結構 ![](https://img.kancloud.cn/9a/9c/9a9c8c0c0e1716bbd6920c02dfe24162_520x312.png) 項目運行成功,我們可以添加自己的模塊,下面我們進行如下操作,新建頁面、配置路由。 # 新建頁面(以行李查詢為例) ## 說明: 在index.html處有個id="app"的div,在App.vue中也有一個id="app" 的div。頁面渲染的就是這個組件。 ![](https://img.kancloud.cn/37/0b/370b960eea55c0af053da5a350a49ec3_918x576.png) 在App.vue中有個router-view標簽,默認在這渲染當路由為"/"指向的組件,所以要設置路由。 ![](https://img.kancloud.cn/9c/12/9c1229ba90146b2be5a5531ec74352e1_694x203.png) ## 步驟 ### 在src/views下面新建文件夾luggage ### 在luggage文件夾下新建luggage.vue luggage.js 和 luggage.css 文件 ![](https://img.kancloud.cn/70/c8/70c856cc4b8518f016089d6ae8b9e554_431x270.png) 這里我們就創建好了一個組件即新的頁面。它的頁面路徑為 src/views/luggage。這個路徑將在后面的路由配置中用到。要想在瀏覽器上展示,接下來我們就要進行路由的配置 # 路由配置 說明:首先我們要看vue-router插件是否下載(一般項目npm install的時候會自動下載vue-router插件) ![](https://img.kancloud.cn/c2/7c/c27c9bb0a4a11fe17891eaab022393b2_1086x417.png) 如果沒有下載,用下面的命令進行下載 npm install --save vue-router 之后在src/router/index下看有沒有引入路由 ![](https://img.kancloud.cn/cc/2b/cc2bbb409e22cd2e206efc4aea521af9_913x382.png) ## 引入成功,開始使用插件 ![](https://img.kancloud.cn/39/44/3944e470954fb50994c0311ada8595bb_942x400.png) ## 生成router實例 ![](https://img.kancloud.cn/84/83/8483f3793175d9844c5ccecd8efb69e6_958x444.png) 這里的routers是從同級目錄下的routers.js引入的。routers.js這個文件是定義路由的文件。下面以行李查詢為例進行定義路由 ![](https://img.kancloud.cn/a8/87/a887ea729c7ae54a2971e64e29b780ea_922x521.png) 這是上面新建的頁面路徑我們已經配置到了路由里面,vue會自動匹配改視圖在頁面做出響應。 這里定義了路由,同時要在zh-CN.js下面配置菜單的中文title ![](https://img.kancloud.cn/7e/65/7e6538db47ceae4133222934ce2d3f44_1246x552.png) ## 在src/main.js中把路由實例傳給vue根組件 ![](https://img.kancloud.cn/4c/3a/4c3ab392902183e1c329ecc7eca03f48_720x510.png) 這樣應用就啟動了。在左側菜單就形成了我們配置的路由 ![](https://img.kancloud.cn/dd/df/dddf3465e69272397add81a53af2cec5_1366x628.png) # 配置頁面詳解 在結構層進行頁面布局,在行為層進行數據渲染 ## 頁面布局使用iview插件 同路由一樣。我們要先看是否下載iview插件 ![](https://img.kancloud.cn/fa/5e/fa5e3ff7a15b7572f3566642fafb9c25_743x465.png) 要是沒有下載,用如下命令進行下載 npm install iview@1.0.1 --save 下載之后,在src/main.js引入iview插件 ![](https://img.kancloud.cn/14/f7/14f74bff2585a3fd4ab305535301845f_1067x493.png) 引入成功之后,我們就可在任意頁面使用iview插件組件。組件的引用具體看文檔 [http://v1.iviewui.com/](http://v1.iviewui.com/) 下面我們做一個行李查詢項目,包括旅客列表,旅客關聯的行程、行李信息 這些頁面展示都放在結構層,<template></template>標簽里面。注:此標簽下面緊接著是一個div標簽,如圖 ![](https://img.kancloud.cn/b3/ab/b3ab7143e143bf084f910a616c4365d1_876x461.png) 這個功能,頁面整體有三部分。條件查詢表單、旅客列表表格、旅客關聯抽屜。用到的iview組件有form表單、table表格、drawer抽屜。具體參數配置看iview文檔 ![](https://img.kancloud.cn/d0/95/d0950d83b045ba5d8319ea73cc625cda_1059x529.png) 頁面效果如圖 ![](https://img.kancloud.cn/a9/96/a99652ab8c6a2a1a1ee2994e825b6a26_1361x550.png) 下面以table表格為例。展示頁面與后臺交互,首先我們要在vue文件中引入js文件 ![](https://img.kancloud.cn/87/1c/871cccfb1e5bcc5a91d67e5f68d0373c_1124x546.png) ## 頁面布局 直接引用iview的table組件 ![](https://img.kancloud.cn/97/db/97dba96d3c0defc4121a2fbd3436e3fe_1144x489.png) 我們看一下iview的table組件的參數配置 ![](https://img.kancloud.cn/06/6e/066e7e7ed5f4785aaaadd69d0b43bb72_935x212.png) ## 初始化數據 ![](https://img.kancloud.cn/71/d4/71d4bbc8a52b267e6318d4600283021a_548x303.png) ![](https://img.kancloud.cn/1c/26/1c263f5280d4578fe631cfe31faba84a_613x596.png) ## 行為層數據獲取 ### 配置請求鏈接 ![](https://img.kancloud.cn/ac/e8/ace808bbf38469bcfb00015b485de3be_1297x563.png) 配置完成之后。我們將方法暴露出來。方便給組件引用 ![](https://img.kancloud.cn/c9/cf/c9cf3e80ac7e7b7ab4a1fc0b58b4c9c2_871x227.png) ### 在頁面js文件中引入接口方法 ![](https://img.kancloud.cn/5a/80/5a8032f8000a9c4e69128b77f0bdaa3d_1109x380.png) ### 方法中調用接口 ![](https://img.kancloud.cn/02/28/02287c345ad1cb1ab9e28aa6162999e1_725x413.png) ### 數據賦值 此時將調用后端返回的數組數據賦值給了table表格的data數組 ![](https://img.kancloud.cn/0f/93/0f93c54d3b525c27e750fd2b990314d0_596x249.png) 頁面剛開始加載就要將數據渲染出來,所以要在mounted鉤子函數中調用獲取旅客列表函數 ![](https://img.kancloud.cn/7b/a8/7ba869a61c258324ac02262e77473238_1048x574.png) 這時頁面里面的表格就渲染出來了 ![](https://img.kancloud.cn/28/af/28afa7787fa30819cf711a20380e9580_1340x407.png)
                  <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>

                              哎呀哎呀视频在线观看