商品页

This commit is contained in:
shikong 2024-10-18 20:46:48 +08:00
parent 51f6596279
commit dd2a0a180d
Signed by: Shikong
GPG Key ID: BD85FF18B373C341
3 changed files with 17 additions and 14 deletions

View File

@ -33,12 +33,12 @@ function isCurrent(index) {
</view> </view>
<view class="w-3/4 p-2 bg-white flex flex-col h-full"> <view class="w-3/4 p-2 bg-white flex flex-col h-full">
<view class="flex-grow-0 flex flex-col h-full"> <view class="flex-grow flex flex-col h-full">
<view class="my-1"> <view class="my-1">
<slot name="title" :current="ctx.current"></slot> <slot name="title" :current="ctx.current"></slot>
</view> </view>
<scroll-view scroll-y class="flex-grow-0 min-h-0"> <scroll-view scroll-y class="flex-grow min-h-0">
<slot name="default" :current="ctx.current" :data="props.categories[ctx.current]"></slot> <slot name="default" :current="ctx.current" :data="props.categories[ctx.current]"></slot>
</scroll-view> </scroll-view>
</view> </view>

View File

@ -65,7 +65,7 @@ onLoad(() => {
<view class="bg-orange-100 h-full"> {{ item.name }}</view> <view class="bg-orange-100 h-full"> {{ item.name }}</view>
<view> {{data.name}} </view> <view> {{data.name}} </view>
<scroll-view scroll-y class="flex-grow-0 min-h-0 text-left"> <scroll-view scroll-y class="flex-grow min-h-0 text-left">
<Item v-for="i in 10" :key="i" <Item v-for="i in 10" :key="i"
@tap="toCommodity(i)" @tap="toCommodity(i)"
img="https://www.httpbin.org/image/png" img="https://www.httpbin.org/image/png"

View File

@ -3,6 +3,7 @@ import {reactive} from "vue";
import qs from "qs"; import qs from "qs";
import SideBarView from "@/components/sidebar-view/index.vue"; import SideBarView from "@/components/sidebar-view/index.vue";
import Item from "./components/item.vue"; import Item from "./components/item.vue";
const ctx = reactive({ const ctx = reactive({
current: 0, current: 0,
categories: [ categories: [
@ -45,7 +46,7 @@ const ctx = reactive({
] ]
}) })
function toCommodity(){ function toCommodity() {
uni.navigateTo({ uni.navigateTo({
url: '/pages/commodity/commodity?' + qs.stringify({ url: '/pages/commodity/commodity?' + qs.stringify({
id: 1, id: 1,
@ -62,17 +63,19 @@ function toCommodity(){
</text> </text>
</template> </template>
<scroll-view scroll-y class="flex-grow-0 min-h-0"> <template #default="{data}">
<Item v-for="i in 10" :key="i" <scroll-view scroll-y class="flex-grow min-h-0 text-left">
@tap="toCommodity(i)" <Item v-for="i in 10" :key="i"
img="https://www.httpbin.org/image/png" @tap="toCommodity(i)"
title="测试商品测试商品测试商品测试商品测试商品测试商品测试商品" price="9999.99"/> img="https://www.httpbin.org/image/png"
title="测试商品测试商品测试商品测试商品测试商品测试商品测试商品" price="9999.99"/>
<Item v-for="i in 20" :key="i" <Item v-for="i in 20" :key="i"
img="https://www.httpbin.org/image/jpeg" img="https://www.httpbin.org/image/jpeg"
title="测试商品" price="9999.99" title="测试商品" price="9999.99"
oldPrice="8888.88"/> oldPrice="8888.88"/>
</scroll-view> </scroll-view>
</template>
</SideBarView> </SideBarView>
</template> </template>