Vue点击图片查看详情

一、点击事件传值

复制代码
<router-link :to="{path:'/Particulars/'+item.DId}">
  <img
    :src="item.AMadeImg"
    class="image"
    style="width: 232px; height: 232px"
  />
  <div style="padding: 14px" class="menu-card-detail">
    <strong>菜品名称:{{ item.Headline }}</strong>
    <span>评论:{{ item.Comments }}</span>
    <router-link to="" tag="em">
      作者:{{ item.UserName }}
    </router-link>
复制代码

二、获取值进行显示

复制代码
 data() {
    return {
      page: {
        DId: "",
        UserId: "",
        Headline: "",
        PropertyId: "",
        MenuId: "",
        AMadeImg: "",
        AContent: "",
        Main: "",
        Assist: "",
        BMadeImg: "",
        BContent: "",
        Skill: "",
        Comment: "",
      },
      //路径
      url:"http://localhost:49424/"
    };
  },
  methods: {
    getAll() {
      this.$axios
        .get("http://localhost:49424/api/Getshow?id=" + this.$route.params.id)
        .then((res) => {
          this.page = res.data;
        });
    },
  },
  created() {
    this.getAll();
  },
};
复制代码

三、使用方法

<img :src="url+page.AMadeImg" style="width: 320px; height: 320px" />

 

      待续......

 

posted @   魔术人生  阅读(604)  评论(0编辑  收藏  举报
编辑推荐:
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!
复制代码
点击右上角即可分享
微信分享提示