bookstore.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <template>
  2. <view class="content">
  3. <view class="item_demo" @click="onClickTest"> 测试更换数据 </view>
  4. <view class="item_demo" @click="onClickNav">跳转</view>
  5. <view class="container">
  6. <template-book3 :dataList='book_3_data_list'></template-book3>
  7. <template-book-list></template-book-list>
  8. </view>
  9. </view>
  10. </template>
  11. <script setup lang="ts">
  12. import { onLoad } from '@dcloudio/uni-app';
  13. import { ref } from 'vue';
  14. import { util } from '../../framework/util';
  15. import { tools } from '../../framework/tools';
  16. import templateBook3 from '../bookstore/template/template-book-3.vue'
  17. import templateBookList from '../bookstore/template/template-book-list.vue'
  18. let book_3_data_list = ref<Array<string>>([])
  19. var bool:boolean = true
  20. onLoad((options)=>{
  21. console.log('bookstore-options=',options)
  22. tools.setNavigationBar()
  23. requestData(bool)
  24. })
  25. function requestData(is:boolean) {
  26. if(is) {
  27. book_3_data_list.value = ['4','5','6']
  28. } else {
  29. book_3_data_list.value = ['1','1','1']
  30. }
  31. }
  32. function onClickTest() {
  33. util.showLoading()
  34. setTimeout(()=>{
  35. util.hideLoading()
  36. bool = !bool
  37. requestData(bool)
  38. },200)
  39. // util.showInfoToast('信息')
  40. // util.showSuccessToast('成功')
  41. // util.showErrorToast('失败')
  42. // util.showModal('标题',null,()=>{
  43. // console.log('11111111')
  44. // },null,'是吧')
  45. // util.showModalNoCancel('标题',null)
  46. // util.showActionSheet('你好', ['1','2','3'], (index:number)=>{
  47. // console.log('确定index=',index)
  48. // })
  49. }
  50. function onClickNav() {
  51. uni.navigateTo({
  52. url:'/pages/search/search' + '?' + 'id=123',
  53. })
  54. }
  55. </script>
  56. <style lang="scss">
  57. .content{
  58. display: flex;
  59. flex-direction: column;
  60. width: 100%;
  61. .container{
  62. display: flex;
  63. flex-direction: column;
  64. }
  65. }
  66. .item_demo{
  67. display: flex;
  68. margin-top: 30rpx;
  69. height: 100rpx;
  70. font-size: 30px;
  71. background-color: red;
  72. justify-content: center;
  73. align-items: center;
  74. }
  75. </style>