<template>
	<view class="u-demo">
		<view class="u-demo-wrap">
			<view class="u-demo-title">演示效果</view>
			<view class="u-demo-area">
				<text class="no-net-tips">请断开手机的WiFi和移动数据来查看效果</text>
				<u-no-network :tips="tips" :image="image"></u-no-network>
			</view>
		</view>
		<view class="u-config-wrap">
			<view class="u-config-title u-border-bottom">
				参数配置
			</view>
			<view class="u-config-item">
				<view class="u-item-title">自定义提示语</view>
				<u-subsection vibrateShort :current="1" :list="['是', '否']" @change="tipsChange"></u-subsection>
			</view>
			<view class="u-config-item">
				<view class="u-item-title">自定义图标</view>
				<u-subsection vibrateShort :current="1" :list="['是', '否']" @change="imageChange"></u-subsection>
			</view>
		</view>
	</view>
</template>

<script>
	let image = 'data:image/png;base64,[encoded data, 15464 characters]';
	export default {
		data() {
			return {
				tips: '哎呀，网络信号丢失',
				image: image,
			}
		},
		methods: {
			tipsChange(index) {
				this.tips = index == 0 ? '人生得意须尽欢' : '哎呀，网络信号丢失';
			},
			imageChange(index) {
				this.image = index == 0 ? 'https://cdn.uviewui.com/uview/no-network/no_network.png' : image;
			}
		}
	}
</script>

<style scoped lang="scss">
	.no-net-tips {
		color: $u-tips-color;
		font-size: 26rpx;
	}
</style>