Zwx's blog Zwx's blog
首页
  • 前端文章

    • JavaScript
  • 学习笔记

    • 《JavaScript教程》
    • 《JavaScript高级程序设计》
    • 《ES6 教程》
    • 《Vue》
    • 《React》
    • 《TypeScript 从零实现 axios》
    • 《Git》
    • TypeScript
    • JS设计模式总结
  • HTML
  • CSS
  • 技术文档
  • GitHub技巧
  • Nodejs
  • 博客搭建
  • 工作笔记
  • 学习
  • 面试
  • 心情杂货
  • 实用技巧
  • 友情链接
关于
收藏
  • 分类
  • 标签
  • 归档

Zwx

Aal izz well 一切顺利
首页
  • 前端文章

    • JavaScript
  • 学习笔记

    • 《JavaScript教程》
    • 《JavaScript高级程序设计》
    • 《ES6 教程》
    • 《Vue》
    • 《React》
    • 《TypeScript 从零实现 axios》
    • 《Git》
    • TypeScript
    • JS设计模式总结
  • HTML
  • CSS
  • 技术文档
  • GitHub技巧
  • Nodejs
  • 博客搭建
  • 工作笔记
  • 学习
  • 面试
  • 心情杂货
  • 实用技巧
  • 友情链接
关于
收藏
  • 分类
  • 标签
  • 归档
  • 技术文档

  • GitHub技巧

  • Nodejs

  • 博客搭建

  • 工作笔记

  • 模板

    • swiper
    • nvue
    • 日常记录

    • 技术
    • 模板
    Zwx
    2022-01-22
    0

    nvue

    # nvue大概模板

    <template>
    	<view class="body">
    		<!-- 头部 -->
    		<view class="header" :style="{paddingTop:iStatusBarTop + 'px'}">
    			<view class="header-box">
    				<image class="box-img" mode="aspectFill" src="@/static/arrow-left.png"></image>
    				<text class="box-text">标题</text>
    				<image class="box-img" mode="aspectFill" src="@/static/more-dark.png"></image>
    			</view>
    		</view>
    		
    		<!-- 内容 -->
    		<view class="content">
    			<!-- 添加list才能滚动 -->
    			<list ref="list" loadmoreoffset="10" @loadmore="loadMore">
    				<!-- 注意事项: 不能使用 index 作为 key 的唯一标识 -->
    				
    				 <refresh 
    					:display="refreshing ? 'show' : 'hide'" 
    					@refresh="onrefresh" 
    					@pullingdown="onpullingdown"
    					>
    						<view class="loading-more">
    							<text>{{refreshText}}</text>
    						</view>
    						<loading-indicator></loading-indicator>
    					</refresh>
    				<!-- <cell>
    					<p v-for="item in 50">{{item}}</p>
    				</cell> -->
    				<cell>
    					<p v-for="item in 10">啊</p>
    				</cell>
    				<header>
    					吸顶吸顶吸顶
    				</header>
    				<cell v-for="(item, index) in listData" :key="index">
    					<text>{{item}}</text>
    				</cell>
    			</list>
    		</view>
    	
    		<!-- 底部 -->
    		<view class="footer" :style="{paddingBottom:iStatusBarBottom + 'px'}">
    			<view class="footer-box">
    				<text class="box-text">按钮</text>
    			</view>
    		</view>
    	</view>
    </template>
    
    <script>
    export default {
    	data () {
    		return {
    			iStatusBarTop : 0,
    			iStatusBarBottom : 0,
    			refreshing : false,
    			refreshText  : '',
    			listData : [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30],
    			tabTitle : ['王者','荣耀'],
    		}
    	},
    	onLoad () {
    		this.iStatusBarTop = uni.getSystemInfoSync().statusBarHeight;
    		this.iStatusBarBottom = uni.getSystemInfoSync().safeAreaInsets.bottom;
    	},
    	// onReachBottom () {
    	// 	console.log('触底了');
    	// },
    	methods : {
    		// lower1 () {
    		// 	console.log('触底了触底了触底了');
    		// },
    		loadMore () {
    			// this.$refs["list"].resetLoadmore();
    			this.listData.push(...[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30]);
    			uni.showToast({
    				icon : 'none',
    				title : '触底了触底了触底了'
    			})
    			console.log('触底了触底了触底了');
    		},
    		onrefresh () {
    			// this.$refs["list"].resetLoadmore();
    			this.listData = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30];
    			uni.showToast({
    				icon : 'none',
    				title : '下拉刷新了'
    			})
    			console.log('下拉刷新了');
    			console.log('onrefresh');
    			this.refreshing = true;
    			setTimeout(() => {
    				this.refreshing = false;
    			}, 1000);
    		},
    		onpullingdown (e) {
    			if (this.refreshing) {
    				console.log('111111111111');
    				return;
    			}
    			if (Math.abs(e.pullingDistance) > Math.abs(e.viewHeight)) {
    				this.refreshText = '释放立即刷新';
    			} else {
    				this.refreshText = '下拉可以刷新';
    			}
    			// uni.showToast({
    			// 	icon : 'none',
    			// 	title : '手触摸了'
    			// })
    			// console.log('onpullingdown');
    		}
    	},
    	// loadmore () {
    	// 	console.log('触底了触底了触底了');
    	// }
    }
    </script>
    
    <style lang="scss" scoped>
    .body {
    	flex:1;
    	.header {
    		background-color: #58a3ff;
    		.header-box {
    			flex-direction: row;
    			align-items: center;
    			justify-content: space-between;
    			padding:0 40rpx;
    			height: 44px;
    			background-color: #58a3ff;
    			.box-img {
    				height:48rpx;
    				width:48rpx;
    			}
    			.box-text {
    				font-size: 32rpx;
    				font-weight: bold;
    			}
    		}
    	}
    	
    	.content {
    		flex:1;
    		background-color: #f0e8dd;
    	}
    	
    	.footer {
    		padding:10rpx 40rpx;
    		box-shadow: 0 -6rpx 20rpx rgba(0, 0, 0, 0.05);
    		.footer-box {
    			padding:24rpx 0;
    			background: #FF6E01;
    			border-radius: 44rpx;
    			.box-text {
    				text-align: center;
    				font-size: 28rpx;
    				color: #FFFFFF;
    				font-weight: bold;
    			}
    		}
    	}
    }
    .loading-more {
    	align-items: center;
    	justify-content: center;
    	padding-top: 14px;
    	padding-bottom: 14px;
    	text-align: center;
    	flex-direction: row;
    	width:750rpx;
    }
    		
    </style>
    
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    上次更新: 5/13/2023, 5:48:10 PM
    swiper
    Vue 报错Error error0308010Cdigital envelope routinesunsupported

    ← swiper Vue 报错Error error0308010Cdigital envelope routinesunsupported→

    最近更新
    01
    在 M1 芯片 Mac 上使用 Homebrew
    11-08
    02
    GIT 遇到问题
    11-06
    03
    react Router嵌套路由不生效
    10-27
    更多文章>
    Theme by Vdoing | Copyright © 2019-2023 Evan Xu | MIT License
    • 跟随系统
    • 浅色模式
    • 深色模式
    • 阅读模式
    ×