<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智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                首先我們移除 eslint 的校驗 ![](https://img.kancloud.cn/f0/1f/f01f410dd703044abde0a318beb8d58c_2412x1454.png) 接下來我們正式進入`增刪改查` 的正式操作。 查詢 ## 1、在 `router/index.js` 下添加如下的路由 ``` import User from '@/components/User' ``` ``` { path: '/user', name: 'User', component: User } ``` ![](https://img.kancloud.cn/0b/72/0b72169f410af2edb848f6fb9e3e8109_1264x1358.png) 同時 在 components 下新建 User 文件夾,并在 User 文件夾下新建 index.vue 文件 ![](https://img.kancloud.cn/35/7b/357bf6812989d7d701dff01be99f5774_608x620.png) ![](https://img.kancloud.cn/08/fd/08fd6546152745a623994a65d871327d_798x324.png) ## 2、啟動 npm 調試 ``` npm run dev ``` 訪問 http://localhost:8080/#/user 看到如下頁面 ![](https://img.kancloud.cn/1e/82/1e82b9a5d57a40181e394d4488b69d54_2604x1042.png) ## 3、去 elementui 網站去找 table組件 https://element.eleme.cn/#/zh-CN/component/table 從業務需求來看,我們需要在列表上展示 `id`,`name`, `age`,`create_time` 同時還得有個操作的按鈕,這幾個內容,因此我們需要編輯表格的 表頭 ![](https://img.kancloud.cn/87/84/878416ed87c14773ed615c34fe6ec075_1766x1144.png) 另外,我們操作的地方放了 兩個點擊的操作,因此我們要在 methods 中定義這兩個操作 ![](https://img.kancloud.cn/9d/77/9d77d4ad943f2ac5eefcb4d6a5529bea_836x832.png) ``` <template> <div class="userList"> <el-table :data="tableData" style="width: 100%"> <el-table-column prop="id" label="ID"> </el-table-column> <el-table-column prop="name" label="姓名"> </el-table-column> <el-table-column prop="age" label="年齡"> </el-table-column> <el-table-column label="操作"> <template slot-scope="scope"> <el-button @click="handleEdit(scope.row)" type="text" size="small">編輯</el-button> <el-button @click="handleDel(scope.row)" type="text" size="small">刪除</el-button> </template> </el-table-column> </el-table> </div> </template> <script> export default { data() { return { tableData: [] } }, methods: { // 編輯 handleEdit(row) { }, // 刪除 handleDel(row) { }, } } </script> ``` ## 4、開始請求接口獲取列表數據 我們定義一個方法 叫 getUserList 去調用接口獲取數據 根據接口文檔, 請求地址: http://api2.pfecms.com/user/index 參數:page limit ``` getUserList() { this.$http({ method: 'get', url: 'http://api2.pfecms.com/user/index', data: { limit: 15, page: 1 }, headers:{ 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' } }).then((res) => { let result = res.data; }).catch((error) => { console.log(error); }); } ``` 并且在 組件掛載之后就調用,填入我們對應的 地址和參數,就可以調用接口了 在 then的回調中,res.data 就是服務器返回的數據 ![](https://img.kancloud.cn/fe/ea/feeac99e24d421ef351d4f0de9fa7abc_846x366.png) >[danger] 服務器返回的數據中data 中的 data 就是存放的用戶列表數據 ``` let result = res.data; if (result.code == 0) { this.tableData = result.data.data } ``` 因此,我們只需要將 tableData 賦值,即可讓數據表格顯示用戶列表數據 ![](https://img.kancloud.cn/fb/f0/fbf0367b2359c3db2140ec8e54afa6e9_1916x928.png) ![](https://img.kancloud.cn/32/b4/32b4521a09e61fac9e7f2964c99db0b8_3374x456.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>

                              哎呀哎呀视频在线观看