vue页面跳转和传值

vue页面跳转和传值

1.index.vue传值

如下图,我有两个vue,一个index.vue,一个proc-info.vue,下面将会index.vue中引入proc-info.vue
在这里插入图片描述

在index.vue 的script中引入

 import procInfo from './proc-info.vue';

然后在 exprot default中声明
在这里插入图片描述

  export default {
    name: "Invoice",
    components: {
       UploadImage,
       procInfo
    },
     data() {
      return {.....}
         }
      }

然后在一个dialog中调用它,invoiceUuid是我向proc-info.vue中传的值
在这里插入图片描述

    <el-dialog :visible.sync="InvoiceDetailDialog" width="1000px" :title="title">
      <procInfo :invoiceUuid="invoiceUuid"></procInfo>
    </el-dialog>

InvoiceDetailDialog这个是我在return中声明过一次
在这里插入图片描述

在方法中调用并把值传过去

      handleInvoiceDetail(row){
       const {uuid} = row;
       this.invoiceUuid = uuid;
       this.InvoiceDetailDialog = true;
      },

2.proc-info.vue接受值

传值 :在exprot default加入对应数据
在这里插入图片描述

    props: {
    invoiceUuid: {
      type: String,
      required: true,
      default: ''
    }
  },

收值:放入查询条件中,进入页面,找到method,接受传来的值并且放入查询条件中

    created() {
      this.getList();
    },
    methods: {
      getList() {
        this.loading = true;
        const routerParams = this.invoiceUuid;
        // 将数据放在当前组件的数据内
         this.queryParams.invoiceUuid = routerParams;
        listDetail(this.queryParams).then(response => {
          this.detailList = response.rows;
          this.total = response.total;
          this.loading = false;
        });
      },

页面效果:
在这里插入图片描述

在这里插入图片描述

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值