久久久精品一区ed2k-女人被男人叉到高潮的视频-中文字幕乱码一区久久麻豆樱花-俄罗斯熟妇真实视频

vueelement中的table動(dòng)態(tài)渲染實(shí)現(xiàn)(動(dòng)態(tài)表頭)

通過(guò)在vue中使用element的table表格,實(shí)現(xiàn)數(shù)據(jù)動(dòng)態(tài)渲染,并且動(dòng)態(tài)渲染表頭。通過(guò)在父組件中引入子組件表格,然后向子組件傳遞表格數(shù)據(jù)和表頭數(shù)據(jù)。

成都創(chuàng)新互聯(lián)專(zhuān)注為客戶提供全方位的互聯(lián)網(wǎng)綜合服務(wù),包含不限于成都網(wǎng)站制作、做網(wǎng)站、外貿(mào)營(yíng)銷(xiāo)網(wǎng)站建設(shè)、琿春網(wǎng)絡(luò)推廣、微信小程序、琿春網(wǎng)絡(luò)營(yíng)銷(xiāo)、琿春企業(yè)策劃、琿春品牌公關(guān)、搜索引擎seo、人物專(zhuān)訪、企業(yè)宣傳片、企業(yè)代運(yùn)營(yíng)等,從售前售中售后,我們都將竭誠(chéng)為您服務(wù),您的肯定,是我們最大的嘉獎(jiǎng);成都創(chuàng)新互聯(lián)為所有大學(xué)生創(chuàng)業(yè)者提供琿春建站搭建服務(wù),24小時(shí)服務(wù)熱線:18980820575,官方網(wǎng)址:sd-ha.com

子組件table中template模板

<el-table 
  :data="this.tableData"
  height="400px" 
  max-height="400px" 
  size="small"
  row-class-name="row"
  cell-class-name="column"
  :row-
  :cell-
  :highlight-current-row="true"
  @cell-click="cellClick"
  fit
  >
  <el-table-column
    v-for="(item, index) in tableLabel"
    :key="index" 
    :prop="item.prop" 
    :width="item.width" 
    :label="item.label">
  </el-table-column>
</el-table>

接收父組件傳過(guò)來(lái)的數(shù)據(jù)

props: {
 tableData: { // 父組件傳遞過(guò)來(lái)的表格數(shù)據(jù)
    type: Array,
    default: []
  },
  tableLabel: { // 父組件傳遞過(guò)來(lái)的表頭數(shù)據(jù)
    type: Array,
    default: () => {
      return []
    }
  }
}

父組件

<file-table 
 :tableData="tableData"
 :tableLabel="tableLabel"
>
</file-table>


data() {
 return {
 // 子組件的表格數(shù)據(jù)
 tableData: [
  {id: 1, date: '2018-07-24', sales: 23.34, sale: 137597.76, const: 102203.71, profit: 35394.05},
  {id: 2, date: '2018-07-24', sales: 23.34, sale: 137597.76, const: 102203.71, profit: 35394.05},
  {id: 3, date: '2018-07-24', sales: 23.34, sale: 137597.76, const: 102203.71, profit: 35394.05},
  {id: 4, date: '2018-07-24', sales: 23.34, sale: 137597.76, const: 102203.71, profit: 35394.05},
  {id: 5, date: '2018-07-24', sales: 23.34, sale: 137597.76, const: 102203.71, profit: 35394.05},
  {id: 6, date: '2018-07-24', sales: 23.34, sale: 137597.76, const: 102203.71, profit: 35394.05},
  {id: 7, date: '2018-07-24', sales: 23.34, sale: 137597.76, const: 102203.71, profit: 35394.05},
  {id: 8, date: '2018-07-24', sales: 23.34, sale: 137597.76, const: 102203.71, profit: 35394.05},
  {id: 9, date: '2018-07-24', sales: 23.34, sale: 137597.76, const: 102203.71, profit: 35394.05},
  {id: 10, date: '2018-07-24', sales: 23.34, sale: 137597.76, const: 102203.71, profit: 35394.05},
  {id: 11, date: '2018-07-24', sales: 23.34, sale: 137597.76, const: 102203.71, profit: 35394.05},
  {id: 12, date: '2018-07-24', sales: 23.34, sale: 137597.76, const: 102203.71, profit: 35394.05}
 ],
 // 子組件的表頭數(shù)據(jù)
 tableLabel: [
      {label: '', width: '40', prop: 'id'},
      {label: '日期', width: '', prop: 'date'},
      {label: '銷(xiāo)售量', width: '', prop: 'sales'},
      {label: '銷(xiāo)售額', width: '', prop: 'sale'},
      {label: '成本', width: '', prop: 'const'},
      {label: '利潤(rùn)', width: '', prop: 'profit'}
    ]
 }
}

問(wèn)題:這種方式只能在一個(gè)組件中動(dòng)態(tài)渲染,但是當(dāng)我們需要操作每一列數(shù)據(jù)的時(shí)候,沒(méi)法操作,因?yàn)閑lement table再帶的方法是每個(gè)單元格點(diǎn)擊事件,而不符合我們需求,如何能實(shí)現(xiàn)表格動(dòng)態(tài)渲染,并且每個(gè)組件都能使用,還能夠?qū)崿F(xiàn)操作的可控的列,下節(jié)分享。

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持創(chuàng)新互聯(lián)。

網(wǎng)頁(yè)題目:vueelement中的table動(dòng)態(tài)渲染實(shí)現(xiàn)(動(dòng)態(tài)表頭)
網(wǎng)站路徑:http://sd-ha.com/article34/jjcppe.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供做網(wǎng)站、小程序開(kāi)發(fā)商城網(wǎng)站、虛擬主機(jī)、網(wǎng)站收錄網(wǎng)站設(shè)計(jì)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

商城網(wǎng)站建設(shè)