在页面中用函数打开一个对话窗口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;      //传给展示页面的参数
  }
},
发布了40 篇原创文章 · 获赞 8 · 访问量 7299

猜你喜欢

转载自blog.csdn.net/qq_42307369/article/details/104377156