71 lines
1.9 KiB
Vue
71 lines
1.9 KiB
Vue
|
<script setup>
|
||
|
import { ref} from "vue"
|
||
|
const props = defineProps(['type','list'])
|
||
|
const showAll = ref(false)
|
||
|
function switchFunc() {
|
||
|
showAll.value=!showAll.value
|
||
|
console.log(showAll.value)
|
||
|
}
|
||
|
function toDetailFunc(item) {
|
||
|
uni.navigateTo({
|
||
|
url:"/pages/notice/index?content="+encodeURIComponent(item.content)
|
||
|
})
|
||
|
}
|
||
|
</script>
|
||
|
<template>
|
||
|
<view class="notice-box">
|
||
|
<view class="n-row" v-if="!showAll" @tap="toDetailFunc(list[0])">
|
||
|
<view class="nr-left">
|
||
|
<image class="icon-custom" src="@/static/notice.png" mode=""></image>
|
||
|
<view class="nr-text text-ellipsis-1" :class="{smalltext:type=='small'}">
|
||
|
{{list[0]?.content}}
|
||
|
</view>
|
||
|
</view>
|
||
|
<view v-if="list.length > 1 && !showAll" class="showmore-btn" @tap="switchFunc" :class="{smalltext:type=='small'}">
|
||
|
更多
|
||
|
<uni-icons type="bottom" size="15"></uni-icons>
|
||
|
</view>
|
||
|
</view>
|
||
|
<view class="n-row-part" v-else>
|
||
|
<view class="n-row" v-for="(item,i) in list" @tap="toDetailFunc(item)">
|
||
|
<view class="nr-left">
|
||
|
<image class="icon-custom" src="@/static/notice.png" mode=""></image>
|
||
|
<view class="nr-text text-ellipsis-1" :class="{smalltext:type=='small'}">
|
||
|
{{item?.content}}
|
||
|
</view>
|
||
|
</view>
|
||
|
</view>
|
||
|
<view v-if="showAll" class="showmore-btn" style="text-align: right;" :class="{smalltext:type=='small'}">
|
||
|
<text @tap="switchFunc">收起</text>
|
||
|
<uni-icons type="top" size="15"></uni-icons>
|
||
|
</view>
|
||
|
</view>
|
||
|
</view>
|
||
|
</template>
|
||
|
<style lang="scss">
|
||
|
.smalltext{
|
||
|
color: gray !important;
|
||
|
font-size: 28rpx !important;
|
||
|
font-weight: unset !important;
|
||
|
}
|
||
|
.n-row{
|
||
|
display: flex;
|
||
|
justify-content: space-between;
|
||
|
margin: 20rpx 0;
|
||
|
.icon-custom{
|
||
|
margin-right: 10px;
|
||
|
}
|
||
|
.nr-left{
|
||
|
display: flex;
|
||
|
align-items: center;
|
||
|
}
|
||
|
.nr-text{
|
||
|
width: 85%;
|
||
|
font-weight: bolder;
|
||
|
}
|
||
|
.showmore-btn{
|
||
|
white-space: nowrap;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
</style>
|