在Vue Bootstrap B表单元内创建链接 [英] Create a link inside vue bootstrap b-table cell

查看:63
本文介绍了在Vue Bootstrap B表单元内创建链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 b表组合

<b-table responsive 
         hover 
         :items="myItems" 
         :fields="myField">

在我的商品上,我从后端返回一个网址,因此我想在模板上进行操作

On my items, I return a url from the back-end, so I want to do on my template

<template slot="my-link" slot-scope="data">
    <a href="data.item.link">link</a>
 </template>

上面的方法不起作用,它会渲染

The above doesn't work, it renders

<a href="data.item.link">link</a>

代替

<a href="https://mylink.com">link</a>

推荐答案

您应使用 v-bind:href ="..." 或不久之后的:href =将其绑定..." b-link 组件:

You should bind it using v-bind:href="..." or shortly :href="..." with b-link component :

 <template slot="my-link" slot-scope="data">
    <b-link :href="data.item.link">link</b-link>
</template>

这篇关于在Vue Bootstrap B表单元内创建链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆