danyuanMulu.vue 1.2 KB

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