| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- <template>
- <view class="home">
- 首页
- <van-rate value="3" />
- <van-button type="default">默认按钮</van-button>
- <van-button type="primary">主要按钮</van-button>
- <van-button type="info">信息按钮</van-button>
- <van-button type="warning">警告按钮</van-button>
- <van-button type="danger">危险按钮</van-button>
- <view>{{list}}</view>
- <!-- selectable 长按选中 -->
- <text selectable space="nbsp">内 容</text>
- <br />
- <text selectable space="emsp">内 容</text>
- <br />
- <text selectable space="ensp">内 容</text>
- <icon type="success" size="30" color="#ff0000"></icon>
- <view class="iconfont icon-xingxing"></view>
- <view class="iconfont icon-yueliang"></view>
- <h1>哈哈哈</h1>
- <h2>你好</h2>
- <view @click="setName">
- 设置姓名
- </view>
- <button @click="getName">
- 图片
- </button>
- <!-- <view v-for="(item,index) in list" :key="index">
- <view>
- 哈哈
- </view>
- </view> -->
- <image v-for="(item,index) in list" :key="index" :src="item" mode=""></image>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- list: []
- }
- },
- methods: {
- setName() {
- uni.setStorageSync('storage_key', 'hello');
- uni.setStorage({
- key: 'name',
- data: '小明',
- success: function() {
- console.log('success');
- }
- });
- },
- getName() {
- uni.chooseImage({
- count: 6, //默认9
- sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
- sourceType: ['album'], //从相册选择
- success: function(res) {
- console.log(res,'res')
- console.log(JSON.stringify(res.tempFilePaths));
- this.list = res.tempFilePaths;
- console.log(this.list, '列表')
- }
- });
- // uni.clearStorage();
- // console.log(uni.getStorage({key: 'name'}));
- }
- }
- }
- </script>
- <style lang="less">
- /* 类 id 标签 伪元素 */
- @import url('../../css/common.css');
- .home {
- // width: 375rpx;
- height: 100%;
- background: pink;
- h2 {
- color: yellow;
- }
- }
- /* .home */
- /* ::after */
- </style>
|