国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 編程 > JavaScript > 正文

vue+element-ui+ajax實(shí)現(xiàn)一個(gè)表格的實(shí)例

2019-11-19 14:12:12
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

實(shí)例如下:

<!DOCTYPE html><html><head><script src="js/jquery-3.2.1.js"></script><script src="vue.js"></script><!-- 引入樣式 --><link rel="stylesheet"  rel="external nofollow" ><!-- 引入組件庫(kù) --><script src="https://unpkg.com/element-ui/lib/index.js"></script></head><body> <div id="app"><template> <el-table :data="tableData" style="width: 100%"> <el-table-column label="任務(wù)" width="180">  <template slot-scope="scope">  <el-popover trigger="hover" placement="top">   <p>姓名: {{ scope.row.name }}</p>   <div slot="reference" class="name-wrapper">   <el-tag size="medium">{{ scope.row.name }}</el-tag>   </div>  </el-popover>  </template> </el-table-column> <el-table-column label="歷時(shí)" width="180">  <template slot-scope="scope">  <i class="el-icon-time"></i>  <span style="margin-left: 10px">{{ scope.row.take }}</span>  </template> </el-table-column>  <el-table-column label="開(kāi)始時(shí)間" width="180">  <template slot-scope="scope">  <i class="el-icon-time"></i>  <span style="margin-left: 10px">{{ scope.row.startTime }}</span>  </template> </el-table-column>  <el-table-column label="結(jié)束時(shí)間" width="180">  <template slot-scope="scope">  <i class="el-icon-time"></i>  <span style="margin-left: 10px">{{ scope.row.finishTime }}</span>  </template> </el-table-column> <el-table-column label="操作">  <template slot-scope="scope">  <el-button size="mini" @click="handleEdit(scope.$index, scope.row)">編輯</el-button>  <el-button size="mini" type="danger" @click="handleDelete(scope.$index, scope.row)">刪除</el-button>  </template> </el-table-column> </el-table></template></div>  <script type="text/javascript"> new Vue({ el:'#app', data:{  tableData: [],  getUrl: 'http://localhost:8080/mytime/getTodayTomatos', }, created: function(){  this.getTableData() }, methods:{  getTableData:function(){  var self = this;  $.ajax({   type : "post",   dataType : "json",   contentType : "application/json",   url : "http://localhost:8080/mytime/getTodayTomatos",   success : function(json) {   self.tableData=json.fitomatos;   },   error : function(json) {   alert("加載失敗");  }  });  },  handleEdit(index, row) {  console.log(index, row.name);  },  handleDelete(index, row) {  console.log(index, row);  } } })</script></body></html>

效果圖:

以上這篇vue+element-ui+ajax實(shí)現(xiàn)一個(gè)表格的實(shí)例就是小編分享給大家的全部?jī)?nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持武林網(wǎng)。

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 安庆市| 鄂州市| 兴化市| 武定县| 郓城县| 嘉善县| 吐鲁番市| 巫溪县| 剑河县| 根河市| 玉山县| 莲花县| 鹤峰县| 兴宁市| 黑山县| 开平市| 郸城县| 九江县| 万全县| 商丘市| 奇台县| 周口市| 安福县| 九龙坡区| 澳门| 乌审旗| 镶黄旗| 新源县| 原阳县| 合江县| 山阳县| 双牌县| 图们市| 台南市| 孟津县| 镇平县| 内乡县| 邳州市| 永年县| 贵德县| 区。|