index.vue 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. <add-present-button :can_add="button_active"/>
  26. </div>
  27. </template>
  28. <script>
  29. import IndexPresent from "../components/IndexPresent";
  30. import { Button, Row, Col} from "vant"
  31. import AddPresentButton from "../components/addPresentButton";
  32. export default {
  33. name: "index",
  34. components: {
  35. AddPresentButton,
  36. IndexPresent,
  37. [Button.name]: Button,
  38. [Row.name]: Row, [Col.name]: Col
  39. },
  40. data() {
  41. return {
  42. active: 0,
  43. indexTop: require('../assets/banner.png'),
  44. button_active: false,
  45. }
  46. },
  47. computed: {
  48. presents: function() {
  49. // return get_present_data()
  50. return [
  51. {
  52. id: 0,
  53. desc: '描述1blabla',
  54. time: '2018-01-02',
  55. status: 1
  56. },
  57. {
  58. id: 1,
  59. desc: '描述2blabla',
  60. time: '2018-11-02',
  61. status: 2
  62. }
  63. ]
  64. }
  65. },
  66. methods: {
  67. toShare() {
  68. this.$router.push('share')
  69. },
  70. toDetail(id) {
  71. this.$router.push({ path: 'giftDetail', query: { presentId: id } })
  72. }
  73. }
  74. }
  75. </script>
  76. <style scoped>
  77. </style>