Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I don't understand template tag with hashtag in vuejs template file

Tags:

vue.js

vuejs2

Please someone explain me how it is work in vue template. I found this code within laravel jetstream and Inertiajs AppLayout.vue file.

enter image description here

like image 214
Anis Avatar asked Nov 30 '20 08:11

Anis


People also ask

What does template tag do in Vue?

In Vue, templating is the main way we create reusable components. We can use templates to take data, and turn it into real elements on a screen that users can see.

What does template mean in Vue?

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.

Can template tag have class?

You can't bind any classes to the template tag as the template tag itself does not render an element for itself. What you're trying to achieve is not possible despite the comments made on the contrary.

What is Vue tag?

VueTag: AI-Powered Product Data Platform - Vue.ai. Reduce and recover abandoned carts with AI personalization. Create product photos faster, and with fewer resources using AI. Create, assess, and manage catalog text & visual content with AI.


1 Answers

That is the shorthand version of a named slot. It is equivalent to <template v-slot:trigger>.

See https://v2.vuejs.org/v2/guide/components-slots.html#Named-Slots-Shorthand for documentation on slots and shorthand notation.

like image 97
Beyers Avatar answered Oct 19 '22 15:10

Beyers