Questions tagged [vuejs2]

Use this tag for questions specific to version 2 of Vue.js, an open-source, progressive JavaScript framework for building user interfaces. Consider also using the main [vue.js] tag in addition to this one.

This tag is for questions specific to version 2 of Vue.js, which was released on 1st of October 2016, and has an API similar to version 1.

This tag should be used with the main tag for maximum visibility.


What is Vue.js?

Vue.js is a popular open-source JavaScript framework. It is maintained on Github and created by Evan You, a former Google engineer.

From the introduction in the official Vue.js Guide:

Vue (pronounced /vjuː/, like view) is a progressive framework for building user interfaces. Unlike other monolithic frameworks, Vue is designed from the ground up to be incrementally adoptable. The core library is focused on the view layer only, and is easy to pick up and integrate with other libraries or existing projects. On the other hand, Vue is also perfectly capable of powering sophisticated Single-Page Applications when used in combination with modern tooling and supporting libraries.

A more in-depth overview of and introduction to Vue's functionality can be found in the Vue.js guide. The API documentation is available here.

Vue.js documentation also includes a comparison page with other frameworks and popular libraries, such as React or Angular.js, if you're looking for how Vue.js compares to other popular JavaScript frameworks.

For further information and resources, see the main tag wiki.


Related Tags


Official Logo:

22198 questions
357
votes
15 answers

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 but nothing changed. Then I realized that I've…
Amio.io
  • 17,083
  • 11
  • 66
  • 100
259
votes
9 answers

Can I pass parameters in computed properties in Vue.Js

is this possible to pass parameter in computed properties in Vue.Js. I can see when having getters/setter using computed, they can take a parameter and assign it to a variable. like here from documentation: // ... computed: { fullName: { //…
Saurabh
  • 58,805
  • 34
  • 169
  • 222
246
votes
7 answers

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 errors in the console, so I don't know what am I…
Javier Cárdenas
  • 3,155
  • 3
  • 17
  • 28
229
votes
25 answers

Vue 2 - Mutating props vue-warn

I started https://laracasts.com/series/learning-vue-step-by-step series. I stopped on the lesson Vue, Laravel, and AJAX with this error: vue.js:2574 [Vue warn]: Avoid mutating a prop directly since the value will be overwritten whenever the parent…
Dariusz Chowański
  • 2,403
  • 2
  • 11
  • 17
223
votes
19 answers

vue.js 2 how to watch store values from vuex

I am using vuex and vuejs 2 together. I am new to vuex, I want to watch a store variable change. I want to add the watch function in my vue component This is what I have so far: import Vue from 'vue'; import { MY_STATE, } from…
raffffffff
  • 2,567
  • 4
  • 14
  • 14
223
votes
11 answers

How to call function on child component on parent events

Context In Vue 2.0 the documentation and others clearly indicate that communication from parent to child happens via props. Question How does a parent tell its child an event has happened via props? Should I just watch a prop called event? That…
jbodily
  • 2,607
  • 2
  • 14
  • 19
222
votes
10 answers

Method vs Computed in Vue

What is the main difference between a method and a computed value in Vue.js? They look the same and interchangeable.
Bootstrap4
  • 2,803
  • 3
  • 11
  • 12
202
votes
15 answers

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 needed only in when user open a specific component…
Gijo Varghese
  • 8,506
  • 17
  • 61
  • 104
196
votes
1 answer

Is there a way to dispatch actions between two namespaced vuex modules?

Is it possible to dispatch an action between namespaced modules? E.g. I have vuex modules "gameboard" and "notification". Each are namespaced. I would like to dispatch an action from the gameboard to the notification module. I thought I could use…
Chris Schmitz
  • 16,386
  • 23
  • 70
  • 118
182
votes
14 answers

How to implement debounce in Vue2?

I have a simple input box in a Vue template and I would like to use debounce more or less like this: However the debounce property has been deprecated in Vue 2. The recommendation only says:…
MartinTeeVarga
  • 8,782
  • 9
  • 53
  • 89
168
votes
6 answers

Vuejs: Event on route change

In my main page I have dropdowns that show v-show=show by clicking on link @click = "show=!show" and I want to set show=false when I change route. Advise me please how to realize this thing.
kipris
  • 2,199
  • 3
  • 16
  • 25
168
votes
3 answers

Vuex - passing multiple parameters to mutation

I am trying to authenticate a user using vuejs and laravel's passport.I am not able to figure out how to send multiple parameters to the vuex mutation via an action. - store - export default new Vuex.Store({ state: { isAuth:…
Schwesi
  • 3,760
  • 8
  • 28
  • 54
167
votes
15 answers

Vue.js redirection to another page

I'd like to make a redirection in Vue.js similar to the vanilla javascript window.location.href = 'some_url' How could I achieve this in Vue.js?
Jimmy Obonyo Abor
  • 5,707
  • 9
  • 39
  • 65
163
votes
8 answers

What is the difference between the views and components folders in a Vue project?

I just used the command line (CLI) to initialize a Vue.js project. The CLI created a src/components and src/views folder. It has been a few months since I have worked with a Vue project and the folder structure seems new to me. What is the…
drsnark
  • 2,043
  • 2
  • 12
  • 16
157
votes
8 answers

VueJS conditionally add an attribute for an element

In VueJS we can add or remove a DOM element using v-if: but is there a way to add / remove attributes of a dom element eg for the following conditionally set the required attribute: Username:…
Don Smythe
  • 6,656
  • 13
  • 50
  • 90
1
2 3
99 100