2

Hi i have a problem about triggering component b-form-file.

<b-form-file ref="imageProfile"></b-form-file>

I try with this.$refs.imageProfile.click() not work. And i see not found click function on that element.

Thank You.

5

2 Answers 2

10

The file form component of bootstrap-vue is a little different, for someone still get this problem, try this:

<b-form-file ref="pickImage" v-model="file" :state="Boolean(file)"></b-form-file>

this.$refs.pickImage.$el.childNodes[0].click();

hope this help !

Sign up to request clarification or add additional context in comments.

Comments

6

You need to trigger the click on the element, not the component.

Try this:

this.$refs.imageProfile.$el.click()

See Vue Docs at https://v2.vuejs.org/v2/api/#vm-el

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.