2 回答

TA貢獻(xiàn)1963條經(jīng)驗(yàn) 獲得超6個(gè)贊
我假設(shè)您正在處理多個(gè) refs 問題。確保 ref 值是唯一的。例如,
<component ref="dialog1"> </component>
<component ref="dialog2"> </component>
<script>
// somewhere in your logic
this.$refs.dialog1.save();
this.$refs.dialog1.save();
</script>

TA貢獻(xiàn)1875條經(jīng)驗(yàn) 獲得超3個(gè)贊
您的模板中有引用錯(cuò)誤
<v-dialog ref="dialog1" v-model="modal1" :return-value.sync="time" persistent width="290px">
添加了參考對(duì)話框 1
<v-btn text color="primary" @click="$refs.dialog1.save(time)">OK</v-btn>
更新了對(duì) dialog1 的引用
示例:https ://codepen.io/vishnubhadoriya/pen/MWyYEee
添加回答
舉報(bào)