Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

169
Views
Inline event handler in Vue.Js with dots in the name

I am building a SPA using the latest versions of Vue.js 3 and Bootstrap 5. In the main page I am using the Boostrap Offcanvas element with a code that is very similar to the one in the documentation.

The offcanvas definition looks like this

<div class="offcanvas offcanvas-start" tabindex="-1" id="categories">
    <div class="offcanvas-header">
      ...
    </div>
    <div class="offcanvas-body">
      ...
    </div>
 </div>

and this is the anchor that triggers it

<a data-bs-toggle="offcanvas" href="#categories" role="button">Categories</a>

I read in the Bootstrap documentation that the Offcanvas div fires some events like shown and hidden, however the full name of these events is shown.bs.offcanvas and hidden.bs.offcanvas. Using vanilla Javascript I could do listen to those events like documented using addEventListener on the Offcanvas element, however I wanted to do things "the Vue way" using Inline Handlers. But when I try to add

@show.bs.offcanvas="console.log('Showing');"
// or
v-on:show.bs.offcanvas="console.log('Showing');"

to the Offcanvas div I get the following errors

/Path/To/File/NavBar.vue
  48:123  error  'v-on' directives don't support the modifier 'bs'         vue/valid-v-on
  48:126  error  'v-on' directives don't support the modifier 'offcanvas'  vue/valid-v-on

✖ 2 problems (2 errors, 0 warnings)

So Vue sees the . and interprets bs and offcanvas Event Modifiers.

Has anyone ever encountered a similar problem or knows how to specify exact even

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Turns out I did not do enough Googling around and the same question was already answered for Vue.js 2 here. I have self-flagged the post as duplicate just in case.

I can confirm that this works in Vue.js 3

v-on="{'show.bs.offcanvas': eventHandlerFunction }"
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!