150小时Vue.js学习指南:从入门到精通
<p>"<template>\n <v-app>\n <v-header>\n <Header />\n </v-header>\n <v-main>\n <v-scroll-view class="infinite-list-wrapper" style="height: 577px;" v-scroll="onScroll">\n <v-row v-for="i in count" :key="i" class="list-item">\n <v-col :cols="24">\n <v-card>\n <v-card-title>\n 150小时教你熟练使用vue.js\n </v-card-title>\n <v-card-text>\n </v-card-text>\n <v-card-actions>\n <v-btn icon>\n <v-icon>mdi-share-variant</v-icon>\n </v-btn>\n <v-btn icon>\n <v-icon>mdi-comment-outline</v-icon>\n </v-btn>\n <v-btn icon>\n <v-icon>mdi-thumb-up-outline</v-icon>\n </v-btn>\n </v-card-actions>\n </v-card>\n </v-col>\n </v-row>\n </v-scroll-view>\n <v-overlay v-if="loading">\n <v-progress-circular indeterminate color="primary">\n </v-progress-circular>\n <span class="loading-text">加载中...\n </span>\n </v-overlay>\n <div class="no-more" v-if="noMore">\n <span class="no-more-text">已经没有啦!\n </span>\n </div>\n <v-btn v-if="!disabled" class="edit-button" fab small color="primary" @click="load">\n <v-icon>mdi-pencil</v-icon>\n </v-btn>\n </v-main>\n <v-footer>\n <Footer />\n </v-footer>\n </v-app>\n</template>\n\n<script>\nimport VHeader from '../components/Header.vue'\nimport VFooter from '../components/Footer.vue'\nimport { ref, computed } from 'vue'\n\nexport default {\n components: {\n VHeader,\n VFooter\n },\n setup() {\n const count = ref(20)\n const loading = ref(false)\n const noMore = computed(() => count.value >= 10000)\n const disabled = computed(() => loading.value || noMore.value)\n const load = () => {\n loading.value = true\n setTimeout(() => {\n count.value += 9\n loading.value = false\n }, 2000)\n }\n\n const onScroll = () => {\n // 处理滚动事件\n }\n\n return {\n count,\n loading,\n noMore,\n disabled,\n load,\n onScroll\n }\n }\n}\n</script>\n\n<style>\n/* 页头容器 <em>/\n.v-header {\n height: 40px;\n}\n\n/</em> 内容容器 */\n.v-main {\n width: 100%;\n height: 577px;\n}\n\n.v-footer {\n height: 50px;\n}\n\n.list-item {\n margin: 0;\n padding: 0;\n list-style: none;\n}\n\n.v-overlay {\n display: flex;\n justify-content: center;\n align-items: center;\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background-color: rgba(0, 0, 0, 0.5);\n z-index: 9999;\n}\n\n.loading-text {\n color: #808080;\n}\n\n.no-more {\n display: flex;\n justify-content: center;\n align-items: center;\n height: 40px;\n}\n\n.no-more-text {\n color: #808080;\n}\n\n.edit-button {\n position: fixed;\n bottom: 80px;\n right: 20px;\n}\n\n</style>\n</p>
原文地址: https://www.cveoy.top/t/topic/qflF 著作权归作者所有。请勿转载和采集!