web-view-scroll.uvue 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <template>
  2. <enum-data title="android-nested-scroll(默认值为all)" :items="types" @change="onTypeChange"></enum-data>
  3. <scroll-view style="flex:1;">
  4. <view v-for="item in 5" class="scroll-item">
  5. <text class="scroll-item-title">item{{item}}</text>
  6. </view>
  7. <web-view class="web-view" src="/hybrid/html/local.html" :android-nested-scroll="type"></web-view>
  8. <view v-for="item in 5" class="scroll-item">
  9. <text class="scroll-item-title">item{{item}}</text>
  10. </view>
  11. <web-view class="web-view" src="/hybrid/html/simple.html" :android-nested-scroll="type"></web-view>
  12. <view v-for="item in 5" class="scroll-item">
  13. <text class="scroll-item-title">item{{item}}</text>
  14. </view>
  15. <text style="color: coral;text-align: center;margin-top: 6px;">下面是测试嵌套横向滚动scroll-view的场景</text>
  16. <scroll-view style="flex-direction: row;" direction="horizontal">
  17. <view v-for="item in 5" class="scroll-item2">
  18. <text class="scroll-item-title2">item{{item}}</text>
  19. </view>
  20. <web-view class="web-view" src="/hybrid/html/local.html" :android-nested-scroll="type"></web-view>
  21. <view v-for="item in 5" class="scroll-item2">
  22. <text class="scroll-item-title2">item{{item}}</text>
  23. </view>
  24. <web-view class="web-view" src="/hybrid/html/simple.html" :android-nested-scroll="type"></web-view>
  25. <view v-for="item in 5" class="scroll-item2">
  26. <text class="scroll-item-title2">item{{item}}</text>
  27. </view>
  28. </scroll-view>
  29. <view v-for="item in 5" class="scroll-item">
  30. <text class="scroll-item-title">item{{item}}</text>
  31. </view>
  32. </scroll-view>
  33. </template>
  34. <script setup>
  35. import { ItemType } from '@/components/enum-data/enum-data-types';
  36. const types : ItemType[] = [{ "value": 0, "name": "all" }, { "value": 1, "name": "vertical" }, { "value": 2, "name": "horizontal" }, { "value": 3, "name": "none" }];
  37. const type = ref("all");
  38. const onTypeChange = (value : number) => {
  39. type.value = types[value].name;
  40. };
  41. </script>
  42. <style>
  43. .web-view {
  44. width: 300px;
  45. height: 300px;
  46. margin-left: 6px;
  47. margin-right: 6px;
  48. margin-top: 6px;
  49. border: black 1px solid;
  50. align-self: center;
  51. }
  52. .scroll-item {
  53. margin-left: 6px;
  54. margin-right: 6px;
  55. margin-top: 6px;
  56. background-color: #fff;
  57. }
  58. .scroll-item2 {
  59. width: 80px;
  60. justify-content: center;
  61. margin-left: 6px;
  62. margin-right: 6px;
  63. margin-top: 6px;
  64. background-color: #fff;
  65. }
  66. .scroll-item-title {
  67. line-height: 60px;
  68. text-align: center;
  69. color: #555;
  70. }
  71. .scroll-item-title2 {
  72. text-align: center;
  73. color: #555;
  74. }
  75. </style>