Skip to content
Advertisement

Tag: vue.js

How to test plain Vue components (not single file components)

All of these tries are throwing an error: @vue/test-utils/dist/vue-test-utils.js:2471 var componentInstance = node.child; TypeError: Cannot read property ‘child’ of undefined I have also tried to use localVue, to use shallowMount instead of mount and tried to pass Vue.options.components.test after registrating it globally (and some other things that came to my mind) but nothing works. Isn’t there any way to test

Use that was imported in the parent

I’m building a component that manages other components. It dynamically render components in specific places depending on the props and inputs, much like an orchestrator. Use case My orchestrator have the following placeholders, like a grid (p1 … p6): In a given moment, it renders the component C1 into p2 and C2 into p6: In another moment, it replaces the

Emit an event from child mount and access from parent mount

Let’s say I have a component called child. I have data there that I want to access in my parent component. I want to emit an event in the childs mount: this.$emit(‘get-data’, this.data) before finally retrieving it in the parent mount. Is this possible to do / practical? If it is how can one achieve it? If not, what are

Advertisement