Error in v-on handler: "TypeError: Function expected"
See original GitHub issueDescribe the bug
I have problem with b-form-select in IE 11. In Chrome or Firefox it works fine. On selecting some value from select I get error in console:
[Vue warn]: Error in v-on handler: “TypeError: Function expected”
found in
---> <BFormSelect>
<App> at src/App.vue
<Root>
Steps to reproduce the bug
- Test code is:
<template>
<div id="app">
<b-form-select v-model="selected" :options="options"></b-form-select>
<b-form-select v-model="selected" :options="options" size="sm" class="mt-3"></b-form-select>
<div class="mt-3">Selected: <strong>{{ selected }}</strong></div>
</div>
</template>
<script>
export default {
data() {
return {
selected: null,
options: [
{ value: null, text: 'Please select an option' },
{ value: 'a', text: 'This is First option' },
{ value: 'b', text: 'Selected Option' },
{ value: { C: '3PO' }, text: 'This is an option with object value' },
{ value: 'd', text: 'This one is disabled', disabled: true }
]
}
}
}
</script>
- Open page in IE.
- Select some value from first select
- Check exception in console
Expected behavior
Exception should not be thrown, both selects should have the same value and selected value should be shown.
Versions
Libraries:
- BootstrapVue: 2.0.0-rc.28
- Bootstrap: 4.3.1
- Vue: 2.6.10
Environment:
- Device: PC
- OS: Windows 7
- Browser: Internet Explorer 11
- Version: 11.0.9600.19431
Additional context
I tried to install:
npm install core-js regenerator-runtime intersection-observer
and add to the top of main.js file:
import 'core-js'
import 'regenerator-runtime/runtime'
import 'intersection-observer' // Optional
It didn’t help.
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
How to get rid of Error in v-on handler: "TypeError: _vm.myFcn ...
1. have you tried calling it with () e.g. @click.prevent="debouncedOnSubmit()", and maybe converted it to a computed function if that doesnt ...
Read more >Built-in Exceptions — Python 3.11.1 documentation
This can be used to test an exception handler or to report an error condition “just ... Some built-in exceptions (like OSError )...
Read more >Error Handling in React 16 – React Blog
As React 16 release is getting closer, we would like to announce a few changes to how React handles JavaScript errors inside components....
Read more >TypeError - JavaScript - MDN Web Docs
A TypeError may be thrown when: an operand or argument passed to a function is incompatible with the type expected by that operator...
Read more >Windows Installer Error Messages (for Developers)
For error codes specific to the Windows Installer functions MsiExec.exe ... A program run as part of the setup did not finish as...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I added to the <head> in index.html:
<script crossorigin="anonymous" src="https://polyfill.io/v3/polyfill.min.js?features=Array.from"></script>
It seems to work now. Thanks.Also note babel polyfill is now no longer maintained.
core-js
polyfill is probably a better bet.core-js
does polyfillArray.prototype.from
: https://github.com/zloirock/core-js/tree/master/packages/core-jsJust make sure
core-js
is imported before anything else is imported. If using Nuxt.js, core-js is automatically added (usually)If using a javascript minifier that performs dead code elimination (DCE), be cautious that it might clear out the polyfills.
core-js
is not marked as side effect free, so most bundlers/minifiers should keep all the code and not perform DCE.