123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- <template>
- <view>
-
- <image class="header" src="https://www.mescroll.com/img/xinlang/header.jpg" mode="aspectFit"/>
- <view :style="{'top':top}" class="download-tip">1条新微博</view>
-
- <mescroll-body-diy ref="mescrollRef" @init="mescrollInit" top="100" bottom="100" :down="downOption" @down="downCallback" @up="upCallback">
-
- <view class="news-li" v-for="news in addList" :key="news.id">
- <view>{{news.title}}</view>
- <view class="new-content">{{news.content}}</view>
- </view>
-
- <image src="https://www.mescroll.com/img/xinlang/xinlang1.jpg" mode="widthFix"/>
-
- <view class="news-li" v-for="news in dataList" :key="news.id">
- <view>{{news.title}}</view>
- <view class="new-content">{{news.content}}</view>
- </view>
- </mescroll-body-diy>
-
-
- <image class="footer" src="https://www.mescroll.com/img/xinlang/footer.jpg" mode="aspectFit"/>
- </view>
- </template>
- <script>
- import MescrollBodyDiy from "@/components/mescroll-diy/xinlang/mescroll-body.vue";
- import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
- import {apiWeiboList} from "@/api/mock.js"
-
- export default {
- mixins: [MescrollMixin],
- components: {
- MescrollBodyDiy,
- },
- data() {
- return {
- downOption:{
- auto:false,
- },
- addList:[],
- dataList: [],
- top: 0
- }
- },
- methods: {
-
- downCallback(){
-
-
-
- apiWeiboList().then(curPageData=>{
-
- this.mescroll.endSuccess();
-
- this.addList.unshift(curPageData[0]);
-
-
- this.top=uni.upx2px(100+88)+"px";
-
-
-
- this.top=uni.upx2px(100)+"px";
-
- setTimeout(()=> {
- this.top=0;
- },2000);
- }).catch(()=>{
-
- this.mescroll.endErr();
- })
- },
-
- upCallback(page) {
-
- apiWeiboList(page.num, page.size).then(curPageData=>{
-
- this.mescroll.endSuccess(curPageData.length);
-
- this.dataList=this.dataList.concat(curPageData);
- }).catch(()=>{
-
- this.mescroll.endErr();
- })
- }
- }
- }
- </script>
- <style>
- image{width: 100%;vertical-align: bottom;height:auto}
- .header{z-index: 9900;position: fixed;top: --window-top;left: 0;height: 100upx;background: #fff;}
- .footer{z-index: 9900;position: fixed;bottom: 0;left: 0;height: 100upx;background: white;}
-
- .download-tip{
- z-index: 900;
- position: fixed;
- top: calc(var(--window-top) + 20upx);
- left: 0;
- width: 100%;
- height: 60upx;
- line-height: 60upx;
- font-size: 24upx;
- text-align: center;
- background-color: rgba(255,130,1,.7);
- color: white;
- -webkit-transition: top 300ms;
- transition: top 300ms;
- }
-
-
- .news-li{
- padding: 32upx;
- border-bottom: 1upx solid #eee;
- }
- .news-li .new-content{
- font-size: 28upx;
- margin-top: 10upx;
- margin-left: 20upx;
- color: #666;
- }
- </style>
|