mx-paper-navigator-popup.vue 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <template>
  2. <mx-popup-template :title="title" v-bind="extBinding" ref="popup">
  3. <view class="grid grid-cols-4 gap-20">
  4. <mx-paper-tab-item v-for="q in list" :item="q" clean-mode class="!h-[44px] !w-auto"
  5. @click="handleNavigateQuestion(q)"/>
  6. </view>
  7. </mx-popup-template>
  8. </template>
  9. <script setup>
  10. import {ref} from 'vue'
  11. import MxPaperTabItem from "@/components/mx-paper/components/mx-paper-tab-item.vue";
  12. import {useInjectPaperService} from "@/components/mx-paper/usePaperInjection";
  13. const popup = ref(null)
  14. const title = ref('')
  15. const list = ref([])
  16. const extBinding = ref({})
  17. const {goToQuestion} = useInjectPaperService()
  18. const handleNavigateQuestion = function (q) {
  19. goToQuestion(q)
  20. close()
  21. }
  22. const open = function (questions, description, ext = {left: '', right: ''}) {
  23. list.value = questions
  24. title.value = description
  25. extBinding.value = ext
  26. popup.value.open()
  27. }
  28. const close = function () {
  29. popup.value.close()
  30. }
  31. defineExpose({open, close})
  32. </script>
  33. <style scoped>
  34. </style>