video-card.vue 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <!-- TODO 使用 item-card 页面替换 -->
  2. <template>
  3. <!-- padding-left: 10px; padding-right: 10px; -->
  4. <div style="width: 320px">
  5. <router-link :to="`/video/${videoInfo.videoId}`">
  6. <div style="position: relative; width: 320px; height: 180px;">
  7. <v-img
  8. :src="videoInfo.coverUrl"
  9. outlined
  10. aspect-ratio="1.77"
  11. />
  12. <span style="position: absolute; bottom: 0; right: 0; color:red">{{ videoInfo.duration }}</span>
  13. </div>
  14. </router-link>
  15. <v-row>
  16. <v-col cols="2">
  17. <router-link :to="`/u/${videoInfo.userId}`">
  18. <v-avatar size="48">
  19. <v-img :src="videoInfo.avatarUrl" />
  20. </v-avatar>
  21. </router-link>
  22. </v-col>
  23. <v-col cols="10">
  24. <p class="text-over" style="font-size: 15px; margin-bottom: 0px;color: black;">
  25. <router-link :to="`/video/${videoInfo.videoId}`" style="color: black;"> {{ videoInfo.title }} </router-link>
  26. </p>
  27. <p style="font-size: 10px; color: #606060;">
  28. <router-link :to="`/u/${videoInfo.userId}`"> {{ videoInfo.username }}</router-link>
  29. <br>
  30. {{ videoInfo.viewCount }} 观看 <span v-html="`&nbsp;&nbsp;`" />
  31. {{ videoInfo.commentCount }} 评论 <span v-html="`&nbsp;&nbsp;`" />
  32. <span v-text="TimeUtil.timeToNowStrning(videoInfo.pubDate)" />
  33. </p>
  34. </v-col>
  35. </v-row>
  36. </div>
  37. </template>
  38. <script>
  39. import TimeUtil from '@/utils/time-util.vue'
  40. export default {
  41. name: 'UserVideoCard',
  42. props: {
  43. video: {
  44. type: Object,
  45. default: () => {}
  46. }
  47. },
  48. data() {
  49. return {
  50. TimeUtil,
  51. videoInfo: this.video
  52. }
  53. },
  54. created() {
  55. }
  56. }
  57. </script>
  58. <style>
  59. .text-over {
  60. /* 指定宽度 */
  61. white-space: nowrap; /* 不换行,如果是span就可以不用这个 */
  62. overflow: hidden; /* 溢出内容隐藏 */
  63. text-overflow: ellipsis; /* 文本溢出时显示省略号 */
  64. }
  65. </style>