在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/HTML/ vue模態(tài)框點確定按鈕獲取里面組件的數(shù)據(jù)?

vue模態(tài)框點確定按鈕獲取里面組件的數(shù)據(jù)?

子組件數(shù)據(jù)
var data = [

    {
      id:"1",
      name: "頻段設置 1",
      freq: "88MHz-108MHz,步進25kHz",
      data:freqdata
    }
  ]
  模態(tài)框
     <el-dialog title="輸入頻段信息" :visible.sync="centerDialogVisible"      width="630px"  :close-on-click-modal="false" center> 
      <UcenFreqsetting gradfrom="center" ref="data"></UcenFreqsetting>//子組件
      <span slot="footer" class="dialog-footer">
        <el-button @click="centerDialogVisible = false">取 消</el-button>
        <el-button type="primary" v-on:click="addFreq">確 定</el-button>
      </span>
    </el-dialog>
回答
編輯回答
離魂曲

子組件:

methods:{
    getData(){
        return this.data1
    }
}

父組件:

 addFreq(){
    console.log(this.$refs.data.getData())
 }
2017年10月4日 05:00
編輯回答
雨萌萌

這個可以解決

this.$refs.data.$data.xxxx

但是不建議這么做,需要共享組件數(shù)據(jù),那么子組件數(shù)據(jù)應該在更新時$emit通知父組件。

2017年12月27日 19:33