亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

vue 在父組件里阻止子組件的點擊事件

vue 在父組件里阻止子組件的點擊事件

青春有我 2019-03-19 19:16:57
子組件的代碼<template>     <div>       <div class="show">         <div class="picture" :style="'backgroundImage:url('+headerImage+')'" @click="addPic"></div>       </div>       <div>         <input ref="file" type="file" accept="image" @change="upload($event)"  style="display:none">       </div>     </div></template>  <script>   import Exif from 'exif-js'   export default {     data() {      return {        headerImage: '/static/images/add.jpg',        picValue: ''       }     },    methods: {       addPic() {        let file = this.$refs.file         file.click()   ←  這塊是點擊div 觸發點擊input file的點擊事件       },    }父組件<div class="upload">      <label for="">法人身份證</label>      <div class="frontimg">          <uploading @backImg="backImg"></uploading>          <p>{{text}}</p>      </div> </div>     methods:{         backImg(img) {                this.legalPersonImage = img;                this.text = '重新上傳'                 if (this.text == '重新上傳') {                    this.submit();                 }             },     }應該怎么寫 能在滿足一種條件下 清除點擊事件 求教
查看完整描述

1 回答

?
慕的地10843

TA貢獻1785條經驗 獲得超8個贊

傳一個prop進去就行,比如傳進去的prop為flag,addPic方法體里面根據flag的值判斷是否執行input file的點擊事件,flag為true的時候執行,flag為false的時候不執行

查看完整回答
反對 回復 2019-03-19
  • 1 回答
  • 0 關注
  • 3184 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號