123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- <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>
|