vue element dialog in the open when the transfer interfaces

Scene: open a dialog, dialog there is a table, the table's data transfer interface, and was thinking was to adjust the interface when the dialog components mounted, but the entire page rendering is triggered, and only trigger once, but that when unknown parameters of the interface, the interface to the selected modulation using @open meet the requirements when the dialog is opened

Code:

<el-dialog
      title="选择可用商家"
      :visible.sync="dialogVisible"
      @close='closeDialog'
      width='70%'
      @open='open'
></el-dialog>
// 当弹窗打开时调校验地址接口
    open() {
      axios.get('/admin/getLocation', {
        params: {
          cityId: this.cityId,
          address: this.address
        }
      }).then((res) => {
        this.tableData = res.data.data
      }).catch((err) => {
        console.log(err)
      })
    }

ok~

Guess you like

Origin blog.csdn.net/Luckyzhoufangbing/article/details/93719623