我试图使用QR码制作简单的网站。我使用来自github的instascan的QR Code扫描仪。此行用于显示扫描结果
<li v-for="scan in scans" :key="scan.date" :title="scan.content">@{{ scan.content }}</li>
如何在像<a href="/products/show/{{ scan.content }}">@{{ scan.content }}</a>
这样的href标签中使用该结果链接应该是http://example.com/products/show/qrscanresult
谢谢,抱歉我的英语不好。
您可以像处理问题中的其他属性一样绑定值,并将其连接到url的初始部分:
<a :href="'/products/show/' + scan.content">@{{ scan.content }}</a>
假设{{scan.script}}是更改的js变量。
<a href="/products/show/<script>{{ scan.content }}</script>">@{{ scan.content }}</a>
要么
<script>var link = '<a href="/products/show/"+{{ scan.content }}></a>Text Goes here</a>'</script>