插值字符串{{}},模板字符串`${}`,属性命令v-bind:

  1. 插值字符串{ {}}
    其中间可以放js表达式 如:
{
    
    {
    
     变量 }}
{
    
    {
    
     三元表达式 }}
{
    
    {
    
     赋值表达式 }}
  1. 模板字符串` ${}`

其中``就是模板字符串的表示(反引号),${}内部是放变量的
const string = “我今年 ’ + age + ’ 岁”
const string =` 我今年 ${age} 岁`

  1. 属性命令v-bind:
    v-bind:style="这里写js代码" 如:
//{}代表js中的对象
//这里是对象中的:(属性:属性值)
v-bind:style="{ background-color: red}"

猜你喜欢

转载自blog.csdn.net/puhuihui/article/details/124734710