question-pre-next.vue 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <template>
  2. <view class="questionBankAnswer-contentbtnbox">
  3. <view :class="timu_order <= 1 ? 'noprevbtn' : ''" class="questionBankAnswer-contentprevbtn" @tap="prevpage">
  4. 上一题
  5. </view>
  6. <view :class="timu_order >= total_num ? 'nonextbtn' : ''" class="questionBankAnswer-contentnextbtn"
  7. @tap="nextpage">
  8. 下一题
  9. </view>
  10. </view>
  11. </template>
  12. <script>
  13. export default {
  14. props: {
  15. timu_list: {
  16. type: Array,
  17. default: function() {
  18. return [];
  19. },
  20. },
  21. timu_order: {
  22. type: Number,
  23. default: 0
  24. },
  25. total_num: {
  26. type: Number,
  27. default: -1
  28. },
  29. confirmText: {
  30. type: String,
  31. default: '结束练习'
  32. },
  33. },
  34. data() {
  35. return {
  36. }
  37. },
  38. methods: {
  39. prevpage() {
  40. if (this.timu_order <= 1) {
  41. this.$myUtils.$prompt.showToast({
  42. icon: 'none',
  43. title: '没有上一题'
  44. });
  45. } else {
  46. this.$emit('choice_timu_by_id', this.timu_order - 2)
  47. }
  48. },
  49. nextpage() {
  50. if (this.timu_order >= this.timu_list.length) {
  51. this.$myUtils.$prompt.showToast({
  52. icon: 'none',
  53. title: '没有下一题'
  54. });
  55. // uni.showModal({
  56. // title: '提示',
  57. // content: '已没有下一题',
  58. // confirmText: this.confirmText,
  59. // confirmColor: '#3c7bfc',
  60. // success: (res) => {
  61. // if (res.confirm) {
  62. // this.$emit('tap_handler',1);
  63. // } else if (res.cancel) {
  64. // // console.log('用户点击取消');
  65. // }
  66. // }
  67. // });
  68. } else {
  69. this.$emit('choice_timu_by_id', this.timu_order)
  70. }
  71. },
  72. }
  73. }
  74. </script>
  75. <style>
  76. </style>