调用组件页面并传参

 //a.vue页面调用
<user-detail ref="detailRef" :detail-visible="detailVisible" @changeShow="showDetail" />
//引入
import UserDetail from './detail.vue'
  components: {UserDetail}  
   handleDetail(id) {
      this.detailVisible = true
      this.$nextTick(() => {
        this.$refs.detailRef.dataInitialization(id)
      })
    },
detail.vue页面接收
 dataInitialization(id) {
      this.userId = id
      getEmployeeByEid({ eid: this.userId }).then(res => {
        this.form = res.data
      })
    }

 

上一篇:获取新添加到数据库的数据的自增长id


下一篇:代码优化:日志的输出要注意级别