1、html属性绑定既有字符串又有变量的写法

<a :href="`tel:${item.mobile}`">
      <img class="phone-icon" src="../assets/images/icon-phone.png" alt="">
</a>

 

2、路由绑定写法:

<router-link :to="navlist.link">
3、html上绑定由data返回的class名
<span :class="[ navlist.nav_icon ,xxx]"></span>
4、直接在html中的src会被打包编译,但是html绑定data返回的图片地址路径不会被webpack打包编译问题。通过require引入相对路径,可解决。
<span :style="wexinlist.imgSrc"></span>
wexinlists:[
  imgSrc:'background:url('+ require("../assets/images/bug.gif")+') center no-repeat;background-size:100%'
]
 

相关文章:

  • 2021-12-18
  • 2022-12-23
  • 2021-08-22
  • 2021-08-01
  • 2021-12-14
  • 2022-12-23
  • 2021-11-19
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-28
  • 2021-11-17
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案