Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the @ symbol do in Vue.js?

Tags:

vue.js

I am new to Vue.js and I am looking at someone's code. I noticed they are using the @ symbol. What does this do and what is it used for?

export default {
  methods: {
    handleCreate() {
      console.log('Child has been created.');
    }
  }
};

<template>
  <ChildComponent @created="handleCreate" />
</template>

// ChildComponent
export default {
  created() {
    this.$emit('created');
  }
}
like image 882
Whymess Avatar asked Oct 10 '19 00:10

Whymess


People also ask

What is at symbol in VueJS?

In your case, the @ symbol, symbol is shorthand for v-on . It can also be used when importing to resolve things.

What is $t in VueJS?

Vuex is a state management pattern for vue. js. $t is the injected method from vue. js or Vue.

What is Vue template tag?

Vue uses an HTML-based template syntax that allows you to declaratively bind the rendered DOM to the underlying component instance's data. All Vue templates are syntactically valid HTML that can be parsed by spec-compliant browsers and HTML parsers.


1 Answers

In your case, the @ symbol, symbol is shorthand for v-on. It can also be used when importing to resolve things.

like image 126
Foxhound Avatar answered Oct 07 '22 21:10

Foxhound