danyuanMulu.vue 1.3 KB

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