在頁面中用函數打開一個對話窗口dialog(Element + Vue)

1、先在template寫<el-dialog></el-dialog>然後配置屬性
<template>
<el-dialog :title="amountmoneyTitle" :modal-append-to-body="false" :visible.sync="amountmoneyVisible" :width="dialogwidth+'px'"
           :fullscreen="true" :close-on-click-modal=false :modal=false style="margin: 104px 0px 0px 201px;" center @closed="dialogClose"
           :destroy-on-close="true">
  <amountmoney ref="amountmoney" :setCustId="custId" ></amountmoney>
</el-dialog>
</template>

2、定義dialog參數(amountmoney是打開窗口所展示的頁面)

import amountmoney from "./amountmoney"
export default {
  components: {amountmoney: amountmoney},
  data() {
    return {
      amountmoneyTitle:'',
      amountmoneyVisible:false,
      custId: '',

..................此處省略}}}

3、添加一個按鈕,走函數打開記錄頁面,傳個id給展示的頁面

<el-button type="danger"
           size="small"
           icon="el-icon-edit"
           plain
           v-if="permission.parameters_edit"
           @click="recordsConsumption">記錄
</el-button>
recordsConsumption() {
  if (this.selectionList.length != 1) {
    this.$message.warning("請選擇一條數據");
    return;
  } else {
    this.amountmoneyTitle = '賬戶信息記錄';     //打開頁面的標題
    this.amountmoneyVisible = true;    //參數設置爲true(可見),false(不可見)
    this.custId = this.ids;      //傳給展示頁面的參數
  }
},
發佈了41 篇原創文章 · 獲贊 9 · 訪問量 1萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章