" />
<template> <ul class = "prolist"> <!-- //产品 --> <!-- :to = "/detail/item.id" --> <!-- 声明式跳转 :to = "{ name: 'detail',params: { id: item.id } }" --> <!-- <router-link :to = "{ name: 'detail',params: { id: item.id } }" tag = "li" class = "proitem" v-for="(item,index) of iss大量的英语" :key='index'> <div class = "itemimg"> <img :src="item.images.small" :alt="item.alt"> </div> <div class = "iteminfo"> <h3>{{ item.title }}</h3> <div class = "directors"> <span v-for="(itm,idx) of item.directors" :key="idx"> {{ itm.name }}/ </span> </div> <rating :rating='(item.rating.average / 2).tofixed(1)' /> </div> </router-link> --> <!-- 编程式跳转 --> 财神节是哪天 <!-- @click="godetail(item.id) --> <li class = "proitem" v-for="(item,index) of iss" @click="godetail(item.id)" :key='index'> <div 大学计算机专业class = "itemimg"> <img :src="item.images.small" :alt="item.alt"> </div> <div class = "iteminfo"> <h3>{{ item.title }}</h3> <div class = "directors"> 导演:<span v-for="(itm,idx) of item.directors" :key="idx"> {{ itm.name }}/ </span> </div> <div class = "casts"> 演员:<span v-for="(itm,idx) of item.casts" :key="idx"> {{ itm.name }}/ </span> </div> <rating :rating="(item.rating.average / 2).tofixed(1)"/> </div> </li> </ul></template>
<script>import rating from '@/components/common/rating'export default { methods: { godetail (id) { // console.log(this.$router) // this.$router.push('/detail/' + id) //id由函数获得 // this.$router.push({ name: 'detail', params: { id: id } }) // 另一种方法 平分线 this.$router.push({ path: '/detail/' + id }) // 另一种方法 } }, props: ['iss'], components: { rating }}</script>
router.js:
{ // path: '/detail', path: '/detail/:id', // 详情需要配一个id,获取遍历 name: 'detail', component: () => import('./views/detail/index.vue') },
本文发布于:2023-04-03 03:03:29,感谢您对本站的认可!
本文链接:https://www.wtabcd.cn/fanwen/zuowen/ee31d2ed234971f63542c5d09b4a2568.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文word下载地址:Vue编程式跳转.doc
本文 PDF 下载地址:Vue编程式跳转.pdf
留言与评论(共有 0 条评论) |