<template>
	<view class="home">
		首页
		<view class="box"></view>
		<icon type="success" size="26" />
		<icon type="clear" size="26" />
		<icon type="search" size="26" />
		<h1 class="h1">你好</h1>
		<text space='emsp'>今 三</text>
		<h2>你好</h2>
		<text space="nbsp">今 三</text>
		<h2>你好</h2>
		<text space="ensp">今 三</text>
		<button @click="getList">获取列表信息</button>
		<button @click="getMain">新增</button>
		<button @click="showMain">获取</button>
		<button @click="upImage">上传图片</button>
		<view v-for="item in list">
			<view>{{item}}</view>
			<!-- <image :src="item"></image> -->
		</view>
	</view>
</template>

<script>
	import {
		getMsgList
	} from '../../api/home.js'
	export default {
		data() {
			return {
				list:[]
			}
		},
		methods: {
			getList() {

				getMsgList().then(res => {
					console.log(res, 'res ')
				})
			},
			getMain() {
				// new Promise((resolve,reject)=>{
				// })
				// const aa = Promise.resolve()
				// aa.then(()=>{
				// 	console.log(2)
				// })
				// console.log(1)
				uni.setStorageSync('storage_key1', 'hello1')
				uni.setStorage({
					key: 'storage_key2',
					data: 'hello2',
				});
			},
			showMain() {
				console.log(uni.getStorageSync('storage_key1'), '异步')
				console.log(uni.getStorage({
					key: 'storage_key2',
					success: function(res) {
						console.log(res.data);
					}
				}), '同步')

			},
			upImage() {
				uni.chooseImage({
					count: 6,
					success: function (res) {
						console.log(res);
						this.list = res.tempFilePaths;
						console.log(this.list,'aaa')
					}
				});

			}
		}
	}
</script>

<style scoped lang="scss">
	@import url("../../test.css");

	text {
		color: $uni-color-primary;
	}

	.box {
		width: 300rpx;
		height: 300rpx;
		background: #00f;
	}
</style>