Comments (6)
我感觉我描述的不清楚,那个标签被过滤了,我贴下组件代码:
`
<a-form @submit="handleSubmit" :autoFormCreate="(form)=>{this.form = form}">
<a-form-item
label="出生日期"
:labelCol="{lg: {span: 2}, sm: {span: 7}}"
:wrapperCol="{lg: {span: 10}, sm: {span: 17} }"
fieldDecoratorId="birthday"
:fieldDecoratorOptions="{rules: [{ required: false, message: '请选择出生日期' }]}"
>
<a-date-picker name="birthday" style="width: 100%" />
</a-form-item>
获取的值无法格式化到yyyy-MM-dd
<a-form-item
label="出生时间"
:labelCol="{lg: {span: 2}, sm: {span: 7}}"
:wrapperCol="{lg: {span: 10}, sm: {span: 17} }"
fieldDecoratorId="birthtime"
:fieldDecoratorOptions="{rules: [{ required: false, message: '请选择出生时间' }]}"
>
<a-time-picker name="birthday" style="width: 30%" />
</a-form-item>
<a-form-item
label="性别"
:labelCol="{lg: {span: 2}, sm: {span: 7}}"
:wrapperCol="{lg: {span: 10}, sm: {span: 17} }"
fieldDecoratorId="sex"
:fieldDecoratorOptions="{rules: [{ required: true, message: '请选择出生日期' }]}"
>
<a-radio-group v-model="sex">
<a-radio :value="1">男</a-radio>
<a-radio :value="2">女</a-radio>
</a-radio-group>
</a-form-item>
绑定的值只能数字,中文汉字无效,纠结了半天,如果绑定了fieldDecoratorId,会导致vue加载单选框默认不选中,但是如果不给fieldDecoratorId,form就取不到值,原因未知。
<a-form-item
label="居住城市"
:labelCol="{lg: {span: 2}, sm: {span: 7}}"
:wrapperCol="{lg: {span: 10}, sm: {span: 17} }"
fieldDecoratorId="city"
:fieldDecoratorOptions="{rules: [{ required: true, message: '请选择居住城市' }]}"
>
<a-checkbox-group @change="onCheckboxChange">
<a-checkbox value="上海">上海</a-checkbox>
<a-checkbox value="无锡" >无锡</a-checkbox>
<a-checkbox value="苏州" >苏州</a-checkbox>
<a-checkbox value="杭州" >杭州</a-checkbox>
</a-checkbox-group>
</a-form-item>
<a-form-item
label="工作时间"
:labelCol="{lg: {span: 2}, sm: {span: 7}}"
:wrapperCol="{lg: {span: 10}, sm: {span: 17} }"
fieldDecoratorId="workTime"
:fieldDecoratorOptions="{rules: [{ required: true, message: '请选择工作时间' }]}"
>
<a-range-picker name="workTime" style="width: 100%"/>
</a-form-item>
<a-form-item
label="自我描述"
:labelCol="{lg: {span: 2}, sm: {span: 7}}"
:wrapperCol="{lg: {span: 10}, sm: {span: 17} }"
fieldDecoratorId="description"
:fieldDecoratorOptions="{rules: [{ required: true, message: '请输入自我描述' }]}"
>
<a-textarea rows="5" placeholder="请输入自我描述"/>
</a-form-item>
<a-form-item
label="兴趣爱好"
:labelCol="{lg: {span: 2}, sm: {span: 7}}"
:wrapperCol="{lg: {span: 10}, sm: {span: 17} }"
fieldDecoratorId="like"
:fieldDecoratorOptions="{rules: [{ required: false, message: '请选择兴趣爱好' }]}"
>
<a-select defaultValue="movie">
<a-select-option value="game">游戏</a-select-option>
<a-select-option value="movie">电影</a-select-option>
<a-select-option value="lvyou">旅游</a-select-option>
</a-select>
</a-form-item>
<a-form-item
label="掌握语言"
:labelCol="{lg: {span: 2}, sm: {span: 7}}"
:wrapperCol="{lg: {span: 10}, sm: {span: 17} }"
fieldDecoratorId="language"
:fieldDecoratorOptions="{rules: [{ required: false, message: '请选择掌握语言' }]}"
>
<a-select mode="multiple">
<a-select-option value="java">java</a-select-option>
<a-select-option value=".net">.net</a-select-option>
<a-select-option value="javascript">javascript</a-select-option>
<a-select-option value="html5">html5</a-select-option>
<a-select-option value="android">android</a-select-option>
</a-select>
</a-form-item>
默认是单选框模式,需要在select上加上mode="multiple"后变成多选框模式
必须指定所有option的value的值,否则控件不显示,目前还不够灵活,如果指定默认选中需要在select上加上mode="multiple"
并且defaultValue="movie" 无效。
<a-form-item :wrapperCol="{ span: 24 }" style="text-align: center">
<a-button htmlType="submit" type="primary">提交</a-button>
<a-button style="margin-left: 8px" v-on:click="tempSave">暂存</a-button>
</a-form-item>
</a-form>
<div id="result" v-html="result"></div>
`
from ant-design-vue-pro.
第一个问题找到方法了,需要自己转换下:
if(queryParam.publishTime){ queryParam.publishTime = queryParam.publishTime.format('YYYY-MM-DD'); }
from ant-design-vue-pro.
时间自己用 moment
转换
from ant-design-vue-pro.
你们好辛苦啊,不容易!
from ant-design-vue-pro.
时间不能自己转一下吗 既然设置了format获取到的值应该是格式化之后的结果才对啊
from ant-design-vue-pro.
@lettgers format的值@change第二个参数dateString里面获取.
from ant-design-vue-pro.
Related Issues (20)
- 大佬项目还维护吗 隔壁的elemen-plus垃圾的要死 如果还维护我们就用你们的啦 HOT 1
- 我想知道在使用表格嵌套时,如何让子表格得到父表格的record或者index?
- 能否同时支持mock + devServer proxy? HOT 1
- 访问内部静态网页
- npm i 报错
- 求教下:批量引入组件的实现方式
- 什么时候适配 ant design vue 4.0 ? HOT 1
- 屏蔽mock之后,登陆成功无法跳转
- pro-layout 怎么自定义菜单栏内容呀?
- 代理后端服务器地址不生效
- 点击一级菜单时,能否默认选中其路由配置的redirect的二级菜单,并打开相应的页面
- 部署完 微信上打开 登录失败 但是pc端正常
- yarnpkg run serve后chunk-vendors.js文件几十兆
- run serve报错 HOT 3
- 解答:为什么热更新不可以
- 项目加载会请求https://gw.alipayobjects.com,如何才能将者些请求屏蔽,或者去掉?离线项目已经不需要了
- 登录Login请求中then不执行
- 为什么 暗黑模式禁用了??? HOT 1
- 界面滚动bug
- yarn报错[email protected]: The engine "node" is incompatible with this module. Expected version ">=18". Got "16.14.2" HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ant-design-vue-pro.