index.vue 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <template>
  2. <div class="page pg-bg pg4">
  3. <!-- <Map @click="onMapClick" /> -->
  4. <Rule />
  5. <Flower
  6. :show="!flowerShow"
  7. :country="countryRef"
  8. @planted="onPlanted"
  9. @cancel="flowerShow = false"
  10. />
  11. <Share
  12. v-if="planted"
  13. class="share abs"
  14. @share="onShare"
  15. @badge="badgeShow = true"
  16. />
  17. <Badge :show="badgeShow" @cancel="badgeShow = false" />
  18. </div>
  19. </template>
  20. <script setup>
  21. import { onMounted, ref, watch } from 'vue';
  22. import { useRouter } from 'vue-router';
  23. import Rule from './Rule.vue';
  24. import Map from './Map.vue';
  25. import Flower from './Flower.vue';
  26. import Share from './Share.vue';
  27. import Badge from './Badge.vue';
  28. const router = useRouter();
  29. const countryRef = ref();
  30. const flowerShow = ref();
  31. const planted = ref(false);
  32. const badgeShow = ref(false);
  33. const onMapClick = (country) => {
  34. countryRef.value = country;
  35. flowerShow.value = true;
  36. }
  37. const onPlanted = () => {
  38. planted.value = true;
  39. flowerShow.value = false;
  40. }
  41. const onShare = () => {
  42. router.push('/share')
  43. }
  44. </script>
  45. <style lang="less">
  46. .share {
  47. bottom: 0;
  48. left: 0;
  49. }
  50. </style>