0👍
Most likely you are importing it in another module using curly brackets. When default exporting, it should be imported without curly brackets.
Wrong:
import {something} from someModule
Right:
import something from someModule
- [Vuejs]-New issue after refactoring my code: "Invalid prop: type check failed for prop"
- [Vuejs]-How to use php variable in Vue.js template literal?
0👍
You can do this to add inline optional properties to an object:
export default {
...(character !== 'Passé' ? {} : { steps: [<your steps array>] })
}
The ...
is called a spread operator. It will expand the properties of the variable attached to it into the parent object (also works for arrays). In this case, we are adding either {}
(nothing) or { steps: [] }
based on your condition.
You can also do steps: character !== 'Passé' ? [] : [ <steps array> ]
This will make it so that steps
will always be defined on your object as an array.
Both of these will work.
- [Vuejs]-Failed to proxy the request :8080, because the request to the proxy target failed
- [Vuejs]-Vue & webpack & typescript "Cannot access '__WEBPACK_DEFAULT_EXPORT__' before initialization"
Source:stackexchange.com