Questions tagged [vue-component]
Component is a powerful Vue feature that allows extending basic HTML elements to encapsulate reusable code.
vue-component
821
questions
313
votes
24
answers
477k
views
How to add external JS scripts to VueJS Components?
I've to use two external scripts for the payment gateways.
Right now both are put in the index.html file.
However, I don't want to load these files at the beginning itself.
The payment gateway is ...
246
votes
18
answers
292k
views
vuejs update parent data from child component
I'm starting to play with vuejs (2.0).
I built a simple page with one component in it.
The page has one Vue instance with data.
On that page I registered and added the component to html.
The ...
139
votes
7
answers
73k
views
How can I solve "Interpolation inside attributes has been removed. Use v-bind or the colon shorthand"? Vue.js 2
My Vue.js component is like this:
<template>
<div>
<div class="panel-group" v-for="item in list">
...
<...
173
votes
7
answers
82k
views
Communication between sibling components in Vue.js 2.0
Overview
In Vue.js 2.x, model.sync will be deprecated.
So, what is a proper way to communicate between sibling components in Vue.js 2.x?
Background
As I understand Vue.js 2.x, the preferred method ...
121
votes
10
answers
103k
views
Vue.js 3 Event Bus
How to create Event Bus in Vue 3?
In Vue 2, it was:
export const bus = new Vue();
bus.$on(...)
bus.$emit(...)
In Vue 3, Vue is not a constructor anymore, and Vue.createApp({}); returns an object ...
716
votes
16
answers
614k
views
Vue.js - How to properly watch for nested data
I'm trying to understand how to properly watch for some prop variation.
I have a parent component (.vue files) that receive data from an ajax call, put the data inside an object and use it to render ...
188
votes
29
answers
519k
views
[Vue warn]: Property or method is not defined on the instance but referenced during render
The following code has been written to handle an event after a button click
var MainTable = Vue.extend({
template: "<ul>" +
"<li v-for='(set,index) in settings'>" ...
312
votes
9
answers
268k
views
Vue v-on:click does not work on component
I'm trying to use the on click directive inside a component but it does not seem to work. When I click the component nothings happens when I should get a 'test clicked' in the console. I don't see any ...
504
votes
18
answers
573k
views
How to listen for 'props' changes
In the VueJs 2.0 docs I can't find any hooks that would listen on props changes.
Does VueJs have such hooks like onPropsUpdated() or similar?
Update
As @wostex suggested, I tried to watch my property ...
84
votes
8
answers
161k
views
Add global variable in Vue.js 3
How to add a global variable in Vue.js 3?
In Vue.js 2 we use this in the main.js file:
Vue.prototype.$myGlobalVariable = globalVariable
6
votes
2
answers
13k
views
Is it possible to emit from mounted in Vuejs?
I am familiar with emitting data via bus on events and these work great but now I want to emit something but I don't have an event to tie it to.
I've tried to emit it on mounted but that hasn't worked ...
182
votes
6
answers
148k
views
Passing props dynamically to dynamic component in VueJS
I've a dynamic view:
<div id="myview">
<div :is="currentComponent"></div>
</div>
with an associated Vue instance:
new Vue ({
data: function () {
return {
...
106
votes
6
answers
163k
views
VueJS access child component's data from parent
I'm using the vue-cli scaffold for webpack
My Vue component structure/heirarchy currently looks like the following:
App
PDF Template
Background
Dynamic Template Image
Static Template Image
Markdown
...
89
votes
24
answers
209k
views
Vue template or render function not defined yet I am using neither?
This is my main javascript file:
import Vue from 'vue'
new Vue({
el: '#app'
});
My HTML file:
<body>
<div id="app"></div>
<script src="{{ mix('/js/app.js') }}">&...
57
votes
12
answers
87k
views
Vuejs typescript this.$refs.<refField>.value does not exist
While rewriting my VueJs project in typescript, I came across a TypeScript error.
This is a part of the component that has a custom v-model.
An input field in the html has a ref called 'plate' and I ...