danyuanMulu.vue 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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">{{item.name}}</view>
  13. </view>
  14. </view>
  15. </uni-popup>
  16. </template>
  17. <script setup>
  18. import {
  19. ref
  20. } from 'vue';
  21. const list = [];
  22. const popupRef = ref(null)
  23. const emits = defineEmits(['close', 'select'])
  24. import * as httpApi from "@/api/chanpinShuxue.js";
  25. function goUpPage() {
  26. popupRef.value.close();
  27. emits('close')
  28. }
  29. function showPopup(banbenId) {
  30. list.value = [];
  31. httpApi.getShuxueChanpinDanyuanMulu({banbenId}).then(res => {
  32. list.value = res.data;
  33. popupRef.value.open();
  34. })
  35. }
  36. function closePopup() {
  37. popupRef.value.close();
  38. }
  39. function handleSelect(item) {
  40. emits('select', item)
  41. closePopup();
  42. }
  43. defineExpose({
  44. showPopup
  45. })
  46. </script>
  47. <style>
  48. </style>