danyuanMulu.vue 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <template>
  2. <uni-popup ref="popupRef" :animation="false" :is-mask-click="false"
  3. mask-background-color="rgba(255, 255, 255, 0.1);" type="bottom">
  4. <view class="xuexi-dyml-page">
  5. <!-- 头部 -->
  6. <view class="dyml-title">
  7. <text>单元目录</text>
  8. <icon @click="goUpPage"></icon>
  9. </view>
  10. <!-- 目录 -->
  11. <view class="xuexi-dyml-body">
  12. <view class="dyml-item-box" v-for="item in list" @click="handleSelect" :key="item.danyuanId">
  13. <text class="dy-num">{{item.danyuanName}}</text>
  14. <text class="dy-title">{{item.intro}}</text>
  15. <icon></icon>
  16. </view>
  17. </view>
  18. </view>
  19. </uni-popup>
  20. </template>
  21. <script setup>
  22. import {
  23. ref
  24. } from 'vue';
  25. const list = ref([]);
  26. const popupRef = ref(null)
  27. const emits = defineEmits(['close', 'select'])
  28. import * as httpApi from "@/api/chanpinShuxue.js";
  29. function goUpPage() {
  30. popupRef.value.close();
  31. emits('close')
  32. }
  33. function showPopup(banbenId) {
  34. list.value = [];
  35. httpApi.getShuxueChanpinDanyuanMulu({banbenId}).then(res => {
  36. list.value = res.data;
  37. popupRef.value.open();
  38. })
  39. }
  40. function closePopup() {
  41. popupRef.value.close();
  42. }
  43. function handleSelect(item) {
  44. emits('select', item)
  45. closePopup();
  46. }
  47. defineExpose({
  48. showPopup
  49. })
  50. </script>
  51. <style>
  52. </style>