Vue JS Interview Questions

1.What is Vue.js?

Vue.js (pronounced /vjuː/, like view) is a JavaScript library that helps you build web applications using the the MVVM (Model-View-ViewModel) architectural pattern.

2. How to start working in Vue.js?

Just download Vue.js by using any below methods and add in your project –

  1. https://vuejs.org/js/vue.min.js
  2. npm install vue
  3. bower install vue, or
  4. CDN – https://cdnjs.cloudflare.com/ajax/libs/vue/1.0.26/vue.min.js

3. How a view-model works in Vue.js?

View –

Model –

ViewModel –

4. How to create Two-Way Bindings in Vue.js?

HTML –

JS –

 5. How to use filters in Vue.js?

HTML –

JS – 

 

6. How to use custom filters in Vue.js?

HTML-

 JS-

7. How to handle events in Vue.js?

HTML-

 JS-

8. How to create components in Vue.js?

HTML-

 JS-

 9. What are Directives in VUE.js, List some of them you used? 

Below are list of commonly used directives in Vue.js

  • v-show
  • v-if
  • v-model
  • v-else
  • v-on

10. List type of Directive are available in Vuejs.

In Vue js following types of directives are available

  • General Directives
  • Literal Directives
  • Empty Directives
  • Custom Directives

11. What is VUE-resource, how can you install Vue Resource ?

VUE-resource is a plugin for vue.js that provides services for making web requests and handle responses using a XMLHttpRequest or JSONP

You can install it via yarn or NPM.

 12. How to create Constants in Vue js.

To create constant const keyword is used.In Vue.js we suggest to create a seperate file for defining your consants.

Example: Creating a Constant in Vue js.

Importing a Constant in Vue js.

 

13.How to use other plugin into vue js?

Here we used vue-infinite-scroll as plugin and it installed from NPM

14.how to use Ternary in vue js ? 

15.how to pass laravel variable value to vue js variable?

vue js PROPS is used To pass laravel variable value to vue js variable

blade.php :

home.vue :

16.how to import components in vue js ?

To import components in vue js

17.Create basic vue js component layout

basic vue js component layout

18.how to check response data length in vue js? 

19.How to initialize js functions in vue js (materialize modal popup auto initialize) ? 

I have called the same function from VueJs updated event

** But you have to avoid the errors by using try catch on calling function

Vue Updated Scenario:

This function will call up to when the function or method loads without failure or any Error.

20.how to append vuejs value in html ?

To append vuejs value in html please check below syntax

21.How to set cache false and Content-Type in vue axios 

Declare Custom Header and their values linke below