What does the colon represent inside a VueJS/Vuetify/HTML component tag

99封情书 提交于 2021-02-04 14:52:45

问题


I am using Vuetify, so this could be either a VueJS, Vuetify or even HTML question, but my component looks like this :

<v-list-tile 
  v-for="item in menuItem.items" 
  :key="item.type" 
  :style="`background: ${item.colour}`" 
  :html="item.type">
</v-list-tile>

Take the :key for example, what does the colon (:) before the word key mean? And where can I find what values I can use ?


回答1:


:key is a shorthand for v-bind:key:

The v- prefix serves as a visual cue for identifying Vue-specific attributes in your templates. This is useful when you are using Vue.js to apply dynamic behavior to some existing markup, but can feel verbose for some frequently used directives. At the same time, the need for the v- prefix becomes less important when you are building a SPA where Vue.js manages every template. Therefore, Vue.js provides special shorthands for two of the most often used directives, v-bind and v-on

https://v1.vuejs.org/guide/syntax.html#v-bind-Shorthand



来源:https://stackoverflow.com/questions/51541835/what-does-the-colon-represent-inside-a-vuejs-vuetify-html-component-tag

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!