SlideShare a Scribd company logo
Learning Vue Directives
This is taken from Sara Drasner's course on Frontend Masters. I did the original one
when I was just learning Vue for the first time. Since then I have worked with Vue
for a good few years and there are still things I am learning. These are my notes
from the first few lessons. Hope it helps someone else learn something they didn't
already know.
v-text
v-text works by setting the element's textContent property, so it will overwrite any existing
content inside the element. If you need to update the part of textContent, you should use
mustache interpolations instead.
<span v-text="msg"></span>
<!-- same as -->
<span>{{msg}}</span>
v-html
Contents of v-html are inserted as plain HTML - Vue template syntax will not be processed.
If you find yourself trying to compose templates using v-html, try to rethink the solution by
using components instead.
<div v-html="html"></div>
v-show
Toggle the element's visibility based on the truthy-ness of the expression value.
v-show works by setting the display CSS property via inline styles, and will try to respect
the initial display value when the element is visible. It also triggers transitions when its
condition changes.
v-if
Conditionally render an element or a template fragment based on the truthy-ness of the
expression value.
When a v-if element is toggled, the element and its contained directives / components are
destroyed and re-constructed. If the initial condition is falsy, then the inner content won't be
rendered at all.
Can be used on <template> to denote a conditional block containing only text or multiple
elements.
This directive triggers transitions when its condition changes.
When used together, v-if has a higher priority than v-for. We don't recommend using these
two directives together on one element — see the list rendering guide for details.
v-else
Denote the "else block" for v-if or a v-if / v-else-if chain.
○ Restriction: previous sibling element must have v-if or v-else-if.
○ Can be used on <template> to denote a conditional block containing only
text or multiple elements.
Example
<div v-if="Math.random() > 0.5">
Now you see me
</div>
<div v-else>
Now you don't
</div>
v-else-if
Denote the "else if block" for v-if. Can be chained.
○ Restriction: previous sibling element must have v-if or v-else-if.
○ Can be used on <template> to denote a conditional block containing only
text or multiple elements.
● Example
<div v-if="type === 'A'">
A
</div>
<div v-else-if="type === 'B'">
B
</div>
<div v-else-if="type === 'C'">
C
</div>
<div v-else>
Not A/B/C
</div>
Lazy Models
v-model.lazy for when you don't want it to be always watching for changes and
only modify the DOM when you click something for example when you type and
then click and it appears on the page only when you click and not as you type.
<input v-model.lazy="msg" />
Trimming your Models
v-modal-trim will automatically trim whitespace in your inputs.
<input v-model.trim="msg" />
Making your Models a Number
v-model-number will convert any string to a number. We can use type="number"
but the value of HTML input elements will always return a string and if it can't be
parsed with parseFloat() the original value is returned. Therefore using
v-model-number ensures our input is of type Number.
<input v-model.number="age" type="number" />
Only show your Element Once
v-once is used to show things only once. If you modify the input text you will not
see the results change. The v-once will remain to show the same text. When the
page re-renders, the element/component and all its children will be treated as static
content and skipped.
<span v-once>This will never be updated: {{msg}}</span>
V-pre for Documenting
V-pre will not evaluate any text that adds moustache syntax, for example, and will
show it exactly as it is written.
<span v-pre>{{ this will not be compiled }}</span>
tag with $data
<pre> tag can be used with {{$data}} inside it and it will show you all the data you
have in your data property of that file/component.
Click and Mouse Events
v-on is the same as @ symbol and is great for binding events like click and
mouseenter.
<button v-on:click="counter += 1">Add 1</button>
You can use a ternary operator inside a click event which is good for showing
making sure a counter doesn't go below 0, for example.
<button @click="counter > 0 ? counter -=1 : 0">Add 1</button>
You can do multiple bindings which are ideal for games such as mouseup and
mousedown doing different things.
@mousemove.stop is comparable to e.stopPropagation().
@mousemove.prevent is like e.preventDefault().
@submit.prevent will stop the page from refreshing when submitting.
@click.once this click event will be triggered once not to be confused with v-once.
The click event will only be triggered once as opposed to v-once where the text
will be only rendered once. Good for when you want to stop something from
submitting multiple times or something to be clicked and then you don't want the
user to be able to keep on clicking, they can but it doesn't keep submitting or doing
what it has probably already done
@click.native so you can listen to native events in the DOM.
Key Codes
You can use key codes but this is changing in vue 3 to only use names same as
HTML spec.
Rendering HTML
v-html is not recommended if coming from an external source.
<div v-html="html"></div>
Rendering Text
v-text is the same as using the moustache templates, {{}}, and if you want to
dynamically update then it is recommended to use moustache templates and not
v-text
Read more on programming tutorials and download cheat sheets

More Related Content

Similar to Learning Vue Directives.pdf

Javascript basics
Javascript basicsJavascript basics
Javascript basics
shreesenthil
 
13 javascript techniques to improve your code
13 javascript techniques to improve your code13 javascript techniques to improve your code
13 javascript techniques to improve your code
Surendra kumar
 
Introduction to Vue.js
Introduction to Vue.jsIntroduction to Vue.js
Introduction to Vue.js
Meir Rotstein
 
Paca java script slid
Paca java script slidPaca java script slid
Paca java script slidpacatarpit
 
Rails-like JavaScript using CoffeeScript, Backbone.js and Jasmine
Rails-like JavaScript using CoffeeScript, Backbone.js and JasmineRails-like JavaScript using CoffeeScript, Backbone.js and Jasmine
Rails-like JavaScript using CoffeeScript, Backbone.js and JasmineRaimonds Simanovskis
 
Advanced VB: Review of the basics
Advanced VB: Review of the basicsAdvanced VB: Review of the basics
Advanced VB: Review of the basicsrobertbenard
 
Advanced VB: Review of the basics
Advanced VB: Review of the basicsAdvanced VB: Review of the basics
Advanced VB: Review of the basicsrobertbenard
 
Vb script tutorial for qtp[1]
Vb script tutorial for qtp[1]Vb script tutorial for qtp[1]
Vb script tutorial for qtp[1]srikanthbkm
 
POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAPOLITEKNIK MALAYSIA
POLITEKNIK MALAYSIA
Aiman Hud
 
Angular js animate shashikant bhongale -20-7-16
Angular js animate shashikant bhongale -20-7-16Angular js animate shashikant bhongale -20-7-16
Angular js animate shashikant bhongale -20-7-16
Shashikant Bhongale
 
Real life-coffeescript
Real life-coffeescriptReal life-coffeescript
Real life-coffeescript
David Furber
 
wp-UNIT_III.pptx
wp-UNIT_III.pptxwp-UNIT_III.pptx
wp-UNIT_III.pptx
GANDHAMKUMAR2
 
Knockoutjs
KnockoutjsKnockoutjs
RSpec 3: The new, the old, the good
RSpec 3: The new, the old, the goodRSpec 3: The new, the old, the good
RSpec 3: The new, the old, the good
mglrnm
 
Eloquent ruby
Eloquent rubyEloquent ruby
Eloquent ruby
Santu Koley
 
Future proofing design work with Web components
Future proofing design work with Web componentsFuture proofing design work with Web components
Future proofing design work with Web components
btopro
 
My 70-480 HTML5 certification learning
My 70-480 HTML5 certification learningMy 70-480 HTML5 certification learning
My 70-480 HTML5 certification learning
Syed Irtaza Ali
 
Data binding in silverlight
Data binding in silverlightData binding in silverlight
Data binding in silverlightmsarangam
 

Similar to Learning Vue Directives.pdf (20)

Javascript basics
Javascript basicsJavascript basics
Javascript basics
 
13 javascript techniques to improve your code
13 javascript techniques to improve your code13 javascript techniques to improve your code
13 javascript techniques to improve your code
 
Introduction to Vue.js
Introduction to Vue.jsIntroduction to Vue.js
Introduction to Vue.js
 
Paca java script slid
Paca java script slidPaca java script slid
Paca java script slid
 
Rails-like JavaScript using CoffeeScript, Backbone.js and Jasmine
Rails-like JavaScript using CoffeeScript, Backbone.js and JasmineRails-like JavaScript using CoffeeScript, Backbone.js and Jasmine
Rails-like JavaScript using CoffeeScript, Backbone.js and Jasmine
 
Advanced VB: Review of the basics
Advanced VB: Review of the basicsAdvanced VB: Review of the basics
Advanced VB: Review of the basics
 
Advanced VB: Review of the basics
Advanced VB: Review of the basicsAdvanced VB: Review of the basics
Advanced VB: Review of the basics
 
Vb script tutorial
Vb script tutorialVb script tutorial
Vb script tutorial
 
Vb script tutorial for qtp[1]
Vb script tutorial for qtp[1]Vb script tutorial for qtp[1]
Vb script tutorial for qtp[1]
 
POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAPOLITEKNIK MALAYSIA
POLITEKNIK MALAYSIA
 
Angular js animate shashikant bhongale -20-7-16
Angular js animate shashikant bhongale -20-7-16Angular js animate shashikant bhongale -20-7-16
Angular js animate shashikant bhongale -20-7-16
 
Unit 2.4
Unit 2.4Unit 2.4
Unit 2.4
 
Real life-coffeescript
Real life-coffeescriptReal life-coffeescript
Real life-coffeescript
 
wp-UNIT_III.pptx
wp-UNIT_III.pptxwp-UNIT_III.pptx
wp-UNIT_III.pptx
 
Knockoutjs
KnockoutjsKnockoutjs
Knockoutjs
 
RSpec 3: The new, the old, the good
RSpec 3: The new, the old, the goodRSpec 3: The new, the old, the good
RSpec 3: The new, the old, the good
 
Eloquent ruby
Eloquent rubyEloquent ruby
Eloquent ruby
 
Future proofing design work with Web components
Future proofing design work with Web componentsFuture proofing design work with Web components
Future proofing design work with Web components
 
My 70-480 HTML5 certification learning
My 70-480 HTML5 certification learningMy 70-480 HTML5 certification learning
My 70-480 HTML5 certification learning
 
Data binding in silverlight
Data binding in silverlightData binding in silverlight
Data binding in silverlight
 

Recently uploaded

The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
CarlosHernanMontoyab2
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
Nguyen Thanh Tu Collection
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
timhan337
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 

Recently uploaded (20)

The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 

Learning Vue Directives.pdf

  • 1. Learning Vue Directives This is taken from Sara Drasner's course on Frontend Masters. I did the original one when I was just learning Vue for the first time. Since then I have worked with Vue for a good few years and there are still things I am learning. These are my notes from the first few lessons. Hope it helps someone else learn something they didn't already know. v-text v-text works by setting the element's textContent property, so it will overwrite any existing content inside the element. If you need to update the part of textContent, you should use mustache interpolations instead. <span v-text="msg"></span> <!-- same as --> <span>{{msg}}</span> v-html Contents of v-html are inserted as plain HTML - Vue template syntax will not be processed. If you find yourself trying to compose templates using v-html, try to rethink the solution by using components instead. <div v-html="html"></div> v-show Toggle the element's visibility based on the truthy-ness of the expression value. v-show works by setting the display CSS property via inline styles, and will try to respect the initial display value when the element is visible. It also triggers transitions when its condition changes.
  • 2. v-if Conditionally render an element or a template fragment based on the truthy-ness of the expression value. When a v-if element is toggled, the element and its contained directives / components are destroyed and re-constructed. If the initial condition is falsy, then the inner content won't be rendered at all. Can be used on <template> to denote a conditional block containing only text or multiple elements. This directive triggers transitions when its condition changes. When used together, v-if has a higher priority than v-for. We don't recommend using these two directives together on one element — see the list rendering guide for details. v-else Denote the "else block" for v-if or a v-if / v-else-if chain. ○ Restriction: previous sibling element must have v-if or v-else-if. ○ Can be used on <template> to denote a conditional block containing only text or multiple elements. Example <div v-if="Math.random() > 0.5"> Now you see me </div> <div v-else> Now you don't </div> v-else-if Denote the "else if block" for v-if. Can be chained. ○ Restriction: previous sibling element must have v-if or v-else-if.
  • 3. ○ Can be used on <template> to denote a conditional block containing only text or multiple elements. ● Example <div v-if="type === 'A'"> A </div> <div v-else-if="type === 'B'"> B </div> <div v-else-if="type === 'C'"> C </div> <div v-else> Not A/B/C </div> Lazy Models v-model.lazy for when you don't want it to be always watching for changes and only modify the DOM when you click something for example when you type and then click and it appears on the page only when you click and not as you type. <input v-model.lazy="msg" /> Trimming your Models v-modal-trim will automatically trim whitespace in your inputs. <input v-model.trim="msg" /> Making your Models a Number
  • 4. v-model-number will convert any string to a number. We can use type="number" but the value of HTML input elements will always return a string and if it can't be parsed with parseFloat() the original value is returned. Therefore using v-model-number ensures our input is of type Number. <input v-model.number="age" type="number" /> Only show your Element Once v-once is used to show things only once. If you modify the input text you will not see the results change. The v-once will remain to show the same text. When the page re-renders, the element/component and all its children will be treated as static content and skipped. <span v-once>This will never be updated: {{msg}}</span> V-pre for Documenting V-pre will not evaluate any text that adds moustache syntax, for example, and will show it exactly as it is written. <span v-pre>{{ this will not be compiled }}</span> tag with $data
  • 5. <pre> tag can be used with {{$data}} inside it and it will show you all the data you have in your data property of that file/component. Click and Mouse Events v-on is the same as @ symbol and is great for binding events like click and mouseenter. <button v-on:click="counter += 1">Add 1</button> You can use a ternary operator inside a click event which is good for showing making sure a counter doesn't go below 0, for example. <button @click="counter > 0 ? counter -=1 : 0">Add 1</button> You can do multiple bindings which are ideal for games such as mouseup and mousedown doing different things. @mousemove.stop is comparable to e.stopPropagation(). @mousemove.prevent is like e.preventDefault(). @submit.prevent will stop the page from refreshing when submitting. @click.once this click event will be triggered once not to be confused with v-once. The click event will only be triggered once as opposed to v-once where the text will be only rendered once. Good for when you want to stop something from submitting multiple times or something to be clicked and then you don't want the user to be able to keep on clicking, they can but it doesn't keep submitting or doing what it has probably already done @click.native so you can listen to native events in the DOM. Key Codes You can use key codes but this is changing in vue 3 to only use names same as HTML spec. Rendering HTML
  • 6. v-html is not recommended if coming from an external source. <div v-html="html"></div> Rendering Text v-text is the same as using the moustache templates, {{}}, and if you want to dynamically update then it is recommended to use moustache templates and not v-text Read more on programming tutorials and download cheat sheets