मैं एक Vue घटक कॉल imageUpload बनाया और वी-मॉडल के रूप में संपत्ति पारित किया है नहीं है
<image-upload v-model="form.image"></image-upload>
और imgeUpload
घटक भीतर मैं इस कोड है
<input type="file" accept="images/*" class="file-input" @change="upload">
upload:(e)=>{
const files = e.target.files;
if(files && files.length > 0){
console.log(files[0])
this.$emit('input',files[0])
}
}
और मैं
प्राप्तUncaught TypeError: _this.$emit is not a function
धन्यवाद
वसा तीर कार्यों के साथ 'विधियों' को परिभाषित न करें। http://stackoverflow.com/documentation/vue.js/9350/using-this-in-vue/28958/wrong-using-an-arrow-function-to-define-a-method-that-refers-to- यह # टी = 201703281535474331805 – Bert
बहुत बढ़िया, धन्यवाद :) –