简体   繁体   English

如何在vue中的列表中添加一个项目的外部链接?

[英]How to add a external link to a item within a list in vue?

I have a list in vue that displays a bunch of filtered messages like this:我在 vue 中有一个列表,它显示了一堆过滤后的消息,如下所示:

<v-card>
   <v-list-item-group
        v-model="model">
           <v-list-item
            v-for="msg in selectedMessages"
            :key="msg"
            :value="msg">
                <v-btn
                icon
                disabled
                <v-icon>mdi-star</v-icon>
                </v-btn>
                <v-list-item-content>
                   <v-list-item-title>
                   <strong>{{msg.Subject}} </strong>
                   </v-list-item-title>
                   <v-list-item-subtitle>
                   {{msg.MsgFrom}}
                   </v-list-item-subtitle>
                </v-list-item-content>
          </v-list-item>
   </v-list-item-group>
</v-card>

Here I am displaying each msg within a group of filtered messages ( selectedMessages ).在这里,我显示了一组过滤消息 ( selectedMessages ) 中的每个消息。 I also added a button next to every msg within the list so that I can click on that button and the associated message's MessagePath will load on another page.我还在列表中的每个消息旁边添加了一个按钮,这样我就可以单击该按钮,相关消息的MessagePath将加载到另一个页面上。 MessagePath is just a url to a website that I want. MessagePath只是我想要的网站的 url。 Each message has a different MessagePath .每条消息都有不同的MessagePath With each message there is this kind of data:每条消息都有这种数据:

  "mailbox": "example",
  "MsgFrom": "example@gmail.com",
  "MsgTo": "sample@outlook.com,
  "Subject": "subject_one"
  "MessagePath": "www.google.com"

I want to be able to click on the button next to the individual message that is in the list and have it load the MessagePath for that specific email. How would I go about this?我希望能够单击列表中单个消息旁边的按钮,并让它加载特定 email 的MessagePath 。我 go 对此如何?

Try to add anchor tag instead button <a:href="msg.MessagePath" target="_blank">{{msg.MessagePath}}</a>尝试添加锚标记而不是按钮<a:href="msg.MessagePath" target="_blank">{{msg.MessagePath}}</a>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM