[{"createTime":1735734952000,"id":1,"img":"hwy_ms_500_252.jpeg","link":"https://activity.huaweicloud.com/cps.html?fromacct=261f35b6-af54-4511-a2ca-910fa15905d1&utm_source=V1g3MDY4NTY=&utm_medium=cps&utm_campaign=201905","name":"华为云秒杀","status":9,"txt":"华为云38元秒杀","type":1,"updateTime":1735747411000,"userId":3},{"createTime":1736173885000,"id":2,"img":"txy_480_300.png","link":"https://cloud.tencent.com/act/cps/redirect?redirect=1077&cps_key=edb15096bfff75effaaa8c8bb66138bd&from=console","name":"腾讯云秒杀","status":9,"txt":"腾讯云限量秒杀","type":1,"updateTime":1736173885000,"userId":3},{"createTime":1736177492000,"id":3,"img":"aly_251_140.png","link":"https://www.aliyun.com/minisite/goods?userCode=pwp8kmv3","memo":"","name":"阿里云","status":9,"txt":"阿里云2折起","type":1,"updateTime":1736177492000,"userId":3},{"createTime":1735660800000,"id":4,"img":"vultr_560_300.png","link":"https://www.vultr.com/?ref=9603742-8H","name":"Vultr","status":9,"txt":"Vultr送$100","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":5,"img":"jdy_663_320.jpg","link":"https://3.cn/2ay1-e5t","name":"京东云","status":9,"txt":"京东云特惠专区","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":6,"img":"new_ads.png","link":"https://www.iodraw.com/ads","name":"发布广告","status":9,"txt":"发布广告","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":7,"img":"yun_910_50.png","link":"https://activity.huaweicloud.com/discount_area_v5/index.html?fromacct=261f35b6-af54-4511-a2ca-910fa15905d1&utm_source=aXhpYW95YW5nOA===&utm_medium=cps&utm_campaign=201905","name":"底部","status":9,"txt":"高性能云服务器2折起","type":2,"updateTime":1735660800000,"userId":3}]
ant design vue 中 form 表单在使用的时候 labelCol wrapperCol 所设的值把我搞懵了。尤其还有xxl, xl,
lg, md 这些参数。labelCol 是label所占的百分比,wrapperCol 是label后面的内容所占的百分比。xxl, xl, lg, md
这些参数是在不同的分辨率下 labelCol wrapperCol所占的百分比。
代码如下:
<template> <a-form :form="form" class="form-wrapper" labelAlign="right"
:selfUpdate="true" :labelCol="labelCol" :wrapperCol="wrapperCol"
layout="inline" > <a-form-item label="姓名"> <a-input :allowClear="true"
placeholder="请输入" /> </a-form-item> <a-form-item label="性别"> <a-select
placeholder="请输入"> <a-select-option v-for="item in sexOptions" :key="item.id">{
{ item.sex }}</a-select-option> </a-select> </a-form-item> <a-form-item
label="地址"> <a-input :allowClear="true" placeholder="请输入" /> </a-form-item>
<a-form-item label="联系方式"> <a-input :allowClear="true" placeholder="请输入" />
</a-form-item> </a-form> </template> <script> export default { data () { return
{ form: this.$form.createForm(this, { name: 'dynamic_rule' }), labelCol: { //
24格栅格系统,label所占为 a xxl: 5, // ≥1600px 响应式栅格 xl: 8, // ≥1200px 响应式栅格 lg: 10, //
≥992px 响应式栅格 md: 12 // ≥768px 响应式栅格 }, wrapperCol: { // 24格栅格系统,label后面内容所占为
24-a xxl: 19, xl: 16, lg: 14, md: 12 }, sexOptions: [ { id: 0, sex: 'male' }, {
id: 0, sex: 'female' } ] } }, methods: { } } </script> <style scoped>
.form-wrapper { display: grid; grid-template-columns: 25% 25% 25% 25%; }
</style>
上边图片右下角.ant-col-xxl-5 宽度width:20.833333% 因为分辨率为1920*1080的所以 选择的是xxl参数,
label为5
上边图片右下角.ant-col-xxl-19 宽度width: 79.1666667%