index.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <template>
  2. <div>
  3. <div style="position: relative;">
  4. <img :src="indexTop" style="max-width: 100%; position: relative;"/>
  5. </div>
  6. <van-row type="flex" justify="space-between" align="center">
  7. <van-col>
  8. <p><strong>我的礼物</strong></p>
  9. </van-col>
  10. <van-col>
  11. <van-button round type="primary" size="small" @click="toShare">邀请好友</van-button>
  12. </van-col>
  13. </van-row>
  14. <ul style="background-color: #fff6e3">
  15. <li
  16. is="index-present"
  17. v-for="(present, index) in presents"
  18. :key="present.id"
  19. :present-desc="present.desc"
  20. :publish-time="present.time"
  21. :status="present.status"
  22. @to-detail="toDetail(index)"
  23. ></li>
  24. </ul>
  25. </div>
  26. </template>
  27. <script>
  28. import IndexPresent from "../components/IndexPresent";
  29. import { Button, Row, Col} from "vant"
  30. export default {
  31. name: "index",
  32. components: {
  33. IndexPresent,
  34. [Button.name]: Button,
  35. [Row.name]: Row, [Col.name]: Col
  36. },
  37. data() {
  38. return {
  39. active: 0,
  40. indexTop: require('../assets/banner.png'),
  41. }
  42. },
  43. computed: {
  44. presents: function() {
  45. // return get_present_data()
  46. return [
  47. {
  48. id: 0,
  49. desc: '描述1blabla',
  50. time: '2018-01-02',
  51. status: 1
  52. },
  53. {
  54. id: 1,
  55. desc: '描述2blabla',
  56. time: '2018-11-02',
  57. status: 2
  58. }
  59. ]
  60. }
  61. },
  62. methods: {
  63. toShare() {
  64. this.$router.push('share')
  65. },
  66. toDetail(id) {
  67. this.$router.push({ path: 'giftDetail', query: { presentId: id } })
  68. }
  69. }
  70. }
  71. </script>
  72. <style scoped>
  73. </style>