list-view-multiplex-input.uvue 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <template>
  2. <!-- #ifdef WEB -->
  3. <view>
  4. <!-- #endif -->
  5. <list-view id="listview" style="flex: 1;" show-scrollbar=false @scrolltolower="onScrollTolower">
  6. <list-item v-for="index in item_count" class="item" @click="itemClick(index)">
  7. <text>item-------<text>{{index}}</text></text>
  8. <input style="border-width: 1px; border-style: solid;" :placeholder="index + ''"
  9. :value="index ==1 ? `第一个` :index " />
  10. </list-item>
  11. </list-view>
  12. <!-- #ifdef WEB -->
  13. </view>
  14. <!-- #endif -->
  15. </template>
  16. <script>
  17. export default {
  18. data() {
  19. return {
  20. item_count: 20,
  21. listViewElement: null as UniListViewElement | null,
  22. isTesting: false
  23. }
  24. },
  25. onReady() {
  26. this.listViewElement = uni.getElementById<UniListViewElement>('listview')
  27. },
  28. methods: {
  29. onScrollTolower(_ : ScrollToLowerEvent) {
  30. setTimeout(() => {
  31. if (this.isTesting && this.item_count > 20) {
  32. return
  33. }
  34. this.item_count += 20
  35. }, 300)
  36. },
  37. itemClick(index : number) {
  38. console.log("itemTextClick---" + index)
  39. }
  40. }
  41. }
  42. </script>
  43. <style>
  44. .item {
  45. padding: 15px;
  46. margin: 0 0 5px 0;
  47. background-color: #fff;
  48. border-radius: 5px;
  49. }
  50. .button_item {
  51. width: 200px;
  52. }
  53. </style>