最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

在elementui中Notification組件添加點(diǎn)擊事件實(shí)例

 更新時間:2020年11月11日 10:58:41   作者:前端菜鳥。  
這篇文章主要介紹了在elementui中Notification組件添加點(diǎn)擊事件實(shí)例,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧

1. 官方文檔

2. 添加點(diǎn)擊事件,傳參

handleClick() {
 let telNo = "1111",
 message = "22222",
 _this = this; //函數(shù)作用域問題

 this.$notify({
 title: "通知消息",
 position: "bottom-right",
 dangerouslyUseHTMLString: true,
 message: `<p style="cursor: pointer;">號碼:<i>${telNo}</i></p>`,
 duration: 0,
 type: "warning",
 onClick() {
 _this.defineCallBack(message); //自定義回調(diào),message為傳的參數(shù)
 }
 });
},

//點(diǎn)擊事件回調(diào)
defineCallBack(message) {
 console.log(message);
},

3. 按一定時間順序彈出消息通知

 //按一定時間順序彈出消息通知
notifyByOrder() {
 let data = ["aaaa", "bbbbb", "ccccc"];
 for (let i = 0; i < data.length; i++) {
 let item = data[i];
 setTimeout(() => {
 this.$notify({
 title: `通知${i + 1}`,
 position: "bottom-right",
 message: `通知內(nèi)容${item}`,
 duration: 0,
 type: "warning"
 });
 }, i * 5000);
 }
}

補(bǔ)充知識:vue+elementui怎樣點(diǎn)擊table中的單元格觸發(fā)事件--彈框

elementui中提供了點(diǎn)擊行處理事件

查看位置: elementui的table事件

elementui的table中怎樣點(diǎn)擊某個單元格觸發(fā)事件?

可以先看一下官網(wǎng)中table的自定義列模板代碼

<template>
 <el-table
 :data="tableData"
 border
 style="width: 100%">
 <el-table-column
 label="日期"
 width="180">
 <template scope="scope">
 <el-icon name="time"></el-icon>
 <span style="margin-left: 10px">{{ scope.row.date }}</span>
 </template>
 </el-table-column>
 <el-table-column
 label="姓名"
 width="180">
 <template scope="scope">
 <el-popover trigger="hover" placement="top">
  <p>姓名: {{ scope.row.name }}</p>
  <p>住址: {{ scope.row.address }}</p>
  <div slot="reference" class="name-wrapper">
  <el-tag>{{ scope.row.name }}</el-tag>
  </div>
 </el-popover>
 </template>
 </el-table-column>
 <el-table-column label="操作">
 <template scope="scope">
 <el-button
  size="small"
  @click="handleEdit(scope.$index, scope.row)">編輯</el-button>
 <el-button
  size="small"
  type="danger"
  @click="handleDelete(scope.$index, scope.row)">刪除</el-button>
 </template>
 </el-table-column>
 </el-table>
</template>
<script>
 export default {
 data() {
 return {
 tableData: [{
  date: '2016-05-02',
  name: '王小虎',
  address: '上海市普陀區(qū)金沙江路 1518 弄'
 }, {
  date: '2016-05-04',
  name: '王小虎',
  address: '上海市普陀區(qū)金沙江路 1517 弄'
 }, {
  date: '2016-05-01',
  name: '王小虎',
  address: '上海市普陀區(qū)金沙江路 1519 弄'
 }, {
  date: '2016-05-03',
  name: '王小虎',
  address: '上海市普陀區(qū)金沙江路 1516 弄'
 }]
 }
 },
 methods: {
 handleEdit(index, row) {
 console.log(index, row);
 },
 handleDelete(index, row) {
 console.log(index, row);
 }
 }
 }
</script>

點(diǎn)擊單元格彈出框可以使用template-scope方式實(shí)現(xiàn)

父組件

<el-table
 :data="tableData"
 border
 style="width: 100%">
 <el-table-column
 label="編號"
 prop = "number"
 width="180">
 <template scope="scope">
 <div style="color:red;text-decoration:underline;cursor:pointer;" @click="getMore(scope.row)">{{ scope.row.date }}</div>
 </template>
 </el-table-column>
 <el-table-column
 label="名稱"
 prop = "name"
 width="180">
 <template scope="scope">
 <div style="color:red;text-decoration:underline;cursor:pointer;" @click="getMore2(scope.row)">{{ scope.row.date }}</div>
 </template>
 </el-table-column>
</el-table>
 
<el-dialog :visible-sync="getA">
 <my-component :rowaa=row></my-component>
</el-dialog>
<el-dialog :visible-sync="getB">
 <my-component2 :rowaa=row></my-component2>
</el-dialog>
 
<script>
 import myComponent from './mycomponent'
 import myComponent2 form './mycomponent2'
 export default {
 data() {
  return {
  tableData : [
   {"number" : 1,"name":"y"},
   {"number" : 2,"name":"x"},
  ],
  getA : false,
  getB : false,
  row : ''
  } 
 },
 components: {
  'my-component' : myComponent,
  'my-component2' : myComponent2 
 },
 methods : {
  getMore(row) {
  this.getA = true
  this.row = row
  },
  getMore2(row) {
  this.getB = true
  this.row = row
  }
 }
 }
</script>

子組件 mycomponent

<div>{{formData}}</div>
 
<script>
export default {
 props: ['rowaa'],
 data() {
 return {
  formData:''
 }
 },
 created() {
 this.getData() 
 },
 watch : {
 'rowaa' : 'getData'
 },
 methods: {
 getData() {
  //從后臺獲取數(shù)據(jù)邏輯 model.CacheModel.get('api/' + this.rowaa + '.json')
  //通過this.rowaa就可以獲取傳過來的值
  this.formData = 333
 }
 }
}
</script>

問題解決

可以使用template+slot插值進(jìn)行管理

點(diǎn)擊找到當(dāng)前行的信息,然后再根據(jù)該信息在子組件中請求數(shù)據(jù)

也試過通過點(diǎn)擊行的事件,判斷在哪一個單元格然后處理事件,這樣也可以,但如果在表格中列存放的內(nèi)容發(fā)生變化又得重新調(diào)整

也試過dialog彈出框直接寫在當(dāng)前單元格的template中,就像官網(wǎng)中例子一樣,但是這樣會在點(diǎn)擊時觸發(fā)多次(次數(shù)與當(dāng)前頁展示的數(shù)量一致)

以上這篇在elementui中Notification組件添加點(diǎn)擊事件實(shí)例就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持腳本之家。

相關(guān)文章

  • vue項(xiàng)目引入Iconfont圖標(biāo)庫的教程圖解

    vue項(xiàng)目引入Iconfont圖標(biāo)庫的教程圖解

    這篇文章主要介紹了vue項(xiàng)目引入Iconfont圖標(biāo)庫的相關(guān)知識,非常不錯,具有一定的參考借鑒價值,需要的朋友可以參考下
    2018-10-10
  • vuex的module模塊用法示例

    vuex的module模塊用法示例

    這篇文章主要介紹了vuex的module模塊用法示例,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2018-11-11
  • Vue中的字符串模板的使用

    Vue中的字符串模板的使用

    本篇文章主要介紹了Vue中的字符串模板的使用,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2018-05-05
  • Element實(shí)現(xiàn)表格嵌套、多個表格共用一個表頭的方法

    Element實(shí)現(xiàn)表格嵌套、多個表格共用一個表頭的方法

    這篇文章主要介紹了Element實(shí)現(xiàn)表格嵌套、多個表格共用一個表頭的方法,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2020-05-05
  • vue+video.js視頻播放、視頻切換、視頻斷點(diǎn)分段上傳功能

    vue+video.js視頻播放、視頻切換、視頻斷點(diǎn)分段上傳功能

    本次需求是做一個視頻列表,點(diǎn)擊視頻列表播放對應(yīng)視頻;同時要求實(shí)現(xiàn)斷點(diǎn)分段上傳大文件(視頻)的功能,今天通過本文給大家講解下vue+video.js視頻播放、視頻切換、視頻斷點(diǎn)分段上傳功能,感興趣的朋友一起看看吧
    2022-12-12
  • vue 使用vant插件做tabs切換和無限加載功能的實(shí)現(xiàn)

    vue 使用vant插件做tabs切換和無限加載功能的實(shí)現(xiàn)

    這篇文章主要介紹了vue 使用vant插件做tabs切換和無限加載功能的實(shí)現(xiàn),具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2020-11-11
  • 深入理解vue的使用

    深入理解vue的使用

    這篇文章主要介紹了深入理解vue的使用,對vue感興趣的同學(xué),可以參考下
    2021-05-05
  • 項(xiàng)目中如何使用axios過濾多次重復(fù)請求詳解

    項(xiàng)目中如何使用axios過濾多次重復(fù)請求詳解

    在項(xiàng)目開發(fā)中經(jīng)常需要處理重復(fù)點(diǎn)擊導(dǎo)致多次調(diào)用接口的問題,這篇文章主要介紹了項(xiàng)目中如何使用axios過濾多次重復(fù)請求的相關(guān)資料,需要的朋友可以參考下
    2021-07-07
  • Vue樣式綁定的幾種實(shí)現(xiàn)方式

    Vue樣式綁定的幾種實(shí)現(xiàn)方式

    這篇文章主要介紹了Vue樣式綁定的幾種實(shí)現(xiàn)方式,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教
    2024-08-08
  • element自定義表單驗(yàn)證上傳身份證正反面的實(shí)現(xiàn)

    element自定義表單驗(yàn)證上傳身份證正反面的實(shí)現(xiàn)

    表單驗(yàn)證在很多地方都可以用的到,本文主要介紹了element自定義表單驗(yàn)證上傳身份證正反面的實(shí)現(xiàn),文中根據(jù)實(shí)例編碼詳細(xì)介紹的十分詳盡,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2022-03-03

最新評論

牡丹江市| 高州市| 巨野县| 永济市| 江安县| 钟山县| 郴州市| 泸州市| 洪雅县| 广东省| 横山县| 临洮县| 万盛区| 阳春市| 丰县| 睢宁县| 社会| 托克逊县| 盐山县| 汪清县| 关岭| 凤冈县| 和平县| 乌拉特前旗| 德清县| 霍山县| 多伦县| 张家界市| 浙江省| 平乐县| 威宁| 新巴尔虎左旗| 当涂县| 昂仁县| 邳州市| 福泉市| 哈巴河县| 通化县| 荥阳市| 浦北县| 临潭县|