当前位置: 代码迷 >> 综合 >> vue的:href和href
  详细解决方案

vue的:href和href

热度:50   发布时间:2024-01-31 01:21:49.0

不要使用vue.min.js,要用vue.js,可以显示报错信息。

代码段

<ol class="breadcrumb"><li><a href="shopkeeper_category_list">所有分类</a></li><li><a :href="'shopkeeper_product_list?cid='+category.id">{{category.name}}</a></li><li class="active">产品管理</li></ol>

如跳转url为shopkeeper_category_list,该链接不需要动态获取data中的数据作为参数,则无需使用:href,使用href即可。

因为:href具有绑定意义,会即刻寻找名为“shopkeeper_category_list”的变量。

如跳转url为'shopkeeper_product_list?cid='+category.id,需要从变量中的category获取category.id,则需要绑定category.id。

 

<td><a href="#nowhere" @click="deleteBean(bean.id)">shopkeeper_category_list<span class="glyphicon glyphicon-trash"></span></a></td>

另外,使用vue不要写:href=“#nowhere”。vue会自动识别名为nowhere的块,并进行绑定。而非预想的无超链接的作用……

  相关解决方案