rule.vue 553 B

1234567891011121314151617181920212223242526
  1. <template>
  2. <view class="">
  3. <scroll-view scroll-y="true" :scroll-into-view="scrollIntoViewId" style="height: 300px;">
  4. <view id="a" style="height: 700px;">A</view>
  5. <view id="b" style="height: 300px;">B</view>
  6. <view id="c" style="height: 300px;">C</view>
  7. <!-- 更多内容 -->
  8. </scroll-view>
  9. <view class="" @click="scrollTo()">滚动到B</view>
  10. </view>
  11. </template>
  12. <script>
  13. export default {
  14. data() {
  15. return {
  16. scrollIntoViewId: ''
  17. };
  18. },
  19. methods: {
  20. scrollTo() {
  21. this.scrollIntoViewId = 'b';
  22. }
  23. }
  24. };
  25. </script>