项目中遇到的Vue的问题

// 1、问题描述
// 在表格中点击操作的详情,打开详情的a-drawer,基本代码如下
// 操作部分
editList: debounce(function (index, record) { const self = this if (index === 0) { // 详情 const id = record.id self.detail(id) } else if (index === 1) { // 处理 const id = record.hiddenDangerPointCode self.deal(id) } else if (index === 3) { // 忽略 const id = record.id self.ignore(id) } }, 1000),
// 查看详情的操作
// 点击详情操作
    detail(record) {
      // const self = this
      // hiddenDangerPointDetail(record).then((res) => {
      //   const { obj, status } = res.data
      //   if (status === 200) {
      //     self.detailForm = obj
      //     self.visible = true
      //     self.controlmsg = {
      //       detailForm: self.detailForm
      //     }
      //   }
      // })
      // debugger
      this.checkHiddenDangerPointDetail(record)
      this.checkSuggestDetail(record)
      // this.visible = true
    },
    // 查看隐患点详情
    checkHiddenDangerPointDetail(id) {
      const self = this
      hiddenDangerPointDetail(id).then((res) => {
        const { obj, status } = res.data
        if (status === 200) {
          self.pointDetail = obj
          self.pointmsg = {
            msg: obj
          }
          self.visible = true
        }
      })
    },
    // 查看意见详情 
    checkSuggestDetail(id) {
      const self = this
      suggestDetail(id).then((res) => {
        const { obj, status } = res.data
        if (status === 200) {
          self.suggestmsg = {
            msg: obj
          }
        }
      })
    },
// 如果我们在上面的代码里将this.visible写在调用了两个函数的后面,就会发现,a-drawer第一次被调用的时候,我传给a-drawer的值是空的
// 原因我暂时不知道
// 2、封装代码过程中的问题
//  封装一个controlmsg,在里面写入一个form,可以很好显示,如果在controlmsg中添加两个form就会出现问题
//   解决方法:封装两个传值的msg,或者是在点击详情的时候把id传过去,在a-drawer里面调用接口
原文地址:https://www.cnblogs.com/Roxxane/p/14449839.html