1234567891011121314151617181920212223242526 |
- <template>
- <view class="">
- <scroll-view scroll-y="true" :scroll-into-view="scrollIntoViewId" style="height: 300px;">
- <view id="a" style="height: 700px;">A</view>
- <view id="b" style="height: 300px;">B</view>
- <view id="c" style="height: 300px;">C</view>
- <!-- 更多内容 -->
- </scroll-view>
- <view class="" @click="scrollTo()">滚动到B</view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- scrollIntoViewId: ''
- };
- },
- methods: {
- scrollTo() {
- this.scrollIntoViewId = 'b';
- }
- }
- };
- </script>
|