给字段添加校验

This commit is contained in:
zhouxinyu1029 2026-01-20 10:55:38 +08:00
parent c912eeeb85
commit 60998393c6
1 changed files with 39 additions and 29 deletions

View File

@ -1,42 +1,52 @@
<template> <template>
<scroll-view scroll-y class="pro-container box-border" :style="{backgroundImage: 'url('+config[brandName]?.src+')',height:`${config[brandName].height}rpx`}"> <scroll-view
scroll-y
class="pro-container box-border"
:style="{
backgroundImage: 'url(' + config[brandName]?.src + ')',
height: `${config[brandName]?.height}rpx`,
}"
>
<view class="pro-wrapper flex flex-wrap"> <view class="pro-wrapper flex flex-wrap">
<view v-for="(item,index) in products" :key="index" class="product-container"> <view
<ProductItem :detail="item" :index="index"/> v-for="(item, index) in products"
:key="index"
class="product-container"
>
<ProductItem :detail="item" :index="index" />
</view> </view>
</view> </view>
</scroll-view> </scroll-view>
</template> </template>
<script setup> <script setup>
import ProductItem from './product-item' import ProductItem from "./product-item";
import config from '../config' import config from "../config";
const props = defineProps({ const props = defineProps({
products:{ products: {
type:Array, type: Array,
required: true, required: true,
default:() => ([]) default: () => [],
}, },
brandName:{ brandName: {
type:String, type: String,
required:true, required: true,
default:'' default: "",
} },
}) });
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.pro-container{ .pro-container {
width:780rpx; width: 780rpx;
padding: 136rpx 60rpx 72rpx; padding: 136rpx 60rpx 72rpx;
// margin-bottom: -24rpx; // margin-bottom: -24rpx;
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: contain; background-size: contain;
overflow-y: auto; overflow-y: auto;
} }
.pro-wrapper{ .pro-wrapper {
.product-container{ .product-container {
width: calc((100% - 40rpx) / 3); width: calc((100% - 40rpx) / 3);
margin-right: 20rpx; margin-right: 20rpx;
margin-bottom: 20rpx; margin-bottom: 20rpx;
@ -45,14 +55,14 @@
// margin-right:0 !important; // margin-right:0 !important;
// } // }
view:nth-child(3n) { view:nth-child(3n) {
margin-right:0 !important; margin-right: 0 !important;
} }
// view:nth-child(3n+1):nth-last-child(-n+3) > .pro-item-wrapper, // view:nth-child(3n+1):nth-last-child(-n+3) > .pro-item-wrapper,
// view:nth-child(3n+1):nth-last-child(-n+3)~view > .pro-item-wrapper{ // view:nth-child(3n+1):nth-last-child(-n+3)~view > .pro-item-wrapper{
// margin-bottom: 0 !important; // margin-bottom: 0 !important;
// } // }
view:nth-child(3n+1):nth-last-child(-n+3), view:nth-child(3n + 1):nth-last-child(-n + 3),
view:nth-child(3n+1):nth-last-child(-n+3)~view{ view:nth-child(3n + 1):nth-last-child(-n + 3) ~ view {
margin-bottom: 0 !important; margin-bottom: 0 !important;
} }
} }