antd

Import UI library modularized in nuxtjs

不想你离开。 提交于 2020-02-25 08:31:09
问题 I'm learning nuxtjs and i use ant-design-vue as my ui library, i'm able to import the library as a plugin and it works fine import Vue from 'vue' import Antd from 'ant-design-vue'; export default () => { Vue.use(Antd) } but this import the components globally, but what i wanted to do is to import individual components into specific pages not globally since nuxt will auto lazy load this, ps: i can import individual components using the plugin and it works but it's still global import. for

React Hook Form with AntD Styling

只愿长相守 提交于 2020-02-25 06:31:44
问题 I'm trying to figure out how to use react-hook-form with antd front end. I have made this form and it seems to be working (it's part 1 of a multipart form wizard) except that the error messages do not display. Can anyone see what I've done wrong in merging these two form systems? I'm not getting any errors, but I think I have asked for both form fields to be required but if I press submit without completing them the error messages are not displayed. import React from "react"; import useForm

React Hook Form with AntD Styling

♀尐吖头ヾ 提交于 2020-02-25 06:29:08
问题 I'm trying to figure out how to use react-hook-form with antd front end. I have made this form and it seems to be working (it's part 1 of a multipart form wizard) except that the error messages do not display. Can anyone see what I've done wrong in merging these two form systems? I'm not getting any errors, but I think I have asked for both form fields to be required but if I press submit without completing them the error messages are not displayed. import React from "react"; import useForm

Allow only numbers in Input in React (antd styling)

血红的双手。 提交于 2020-02-08 10:14:51
问题 I know type=number works but that is not what i want. my HTML: <FormItem style={{ display: "inline-block" }}> {getFieldDecorator('matchPercentage', { initialValue: this.state.matchPercentage })( <Input type="number" value={this.state.matchPercentage} onChange={this.handlePercentMatch} style={{ width: 100, marginLeft: 10 }} /> )} </FormItem> my Function: handlePercentMatch = (e) => { const isInteger = /^[0-9]+$/; if (e.target.value === '' || isInteger.test(e.target.value)) { this.setState({

Allow only numbers in Input in React (antd styling)

一笑奈何 提交于 2020-02-08 10:14:43
问题 I know type=number works but that is not what i want. my HTML: <FormItem style={{ display: "inline-block" }}> {getFieldDecorator('matchPercentage', { initialValue: this.state.matchPercentage })( <Input type="number" value={this.state.matchPercentage} onChange={this.handlePercentMatch} style={{ width: 100, marginLeft: 10 }} /> )} </FormItem> my Function: handlePercentMatch = (e) => { const isInteger = /^[0-9]+$/; if (e.target.value === '' || isInteger.test(e.target.value)) { this.setState({

Sort an antd (Ant Design) table that has selection enabled

最后都变了- 提交于 2020-02-04 06:38:42
问题 I am trying to make a table with antd that allows sorting and row selection (using checkboxes). Right now I have both enabled, however, when I sort by ascending/descending order, the selection does not sort. The checked boxes just stay at the same index as before. To fix this I tried making a custom sort function that could possibly sort the selectedRowKeys the same way it is sorting the table rows, but I am not able to retrieve the information I need in the callback function to do this. Has

How to disallow consecutive five digits and more using regex?

♀尐吖头ヾ 提交于 2020-01-30 13:08:22
问题 I would like to disallow if the string contains consecutive five digits and more like: 12345, 11111, 123456. I have got success in disallowing any number in string using following regex: /^[^0-9]+$/ I have created a sandbox demo. I want to disallow five consecutive numbers/digits. Currently it is disallowing any number. 回答1: The regex matching 5 consecutive digits is \d{5} . To disallow such a string (actually, even more consecutive digits), at any position in the source string, this regex

How to use Radio groups inside Antd table?

末鹿安然 提交于 2020-01-25 10:18:05
问题 I want to do this: each row is a Radio group, each cell is a Radio button, like the picture: An example of Radio group is like: <Radio.Group onChange={this.onChange} value={this.state.value}> <Radio value={1}>A</Radio> <Radio value={2}>B</Radio> <Radio value={3}>C</Radio> <Radio value={4}>D</Radio> </Radio.Group> But I don't know how to add a Radio group to wrap each Antd table row? My current code is: renderTable() { let columns = []; columns.push( { title: '', dataIndex: 'name', key: 'name'

Storybook requires default Ant Design component to be exported for styling to be applied

扶醉桌前 提交于 2020-01-25 05:41:05
问题 I'm looking to design some of my React Components using Ant Design and documenting them in Storybook. Both the storybook and components are written correctly and working. modal.stories.js import React from "react"; import { action } from "@storybook/addon-actions"; import { Button } from "@storybook/react/demo"; import { BasicModal } from "./BasicModal"; import { Modal } from "antd"; // IF I REMOVE THIS ANT DESIGN DOESN'T APPLY. export default { title: "Modals" }; export const basicModal = ()

Antd select element: how can I disable typing?

大憨熊 提交于 2020-01-25 04:46:07
问题 I'm trying to use a select element with mode="multiple". I'd like for input to be disabled, meaning that a user can only choose between existing options, not enter text. How do I do this? My element: import { Select } from 'antd'; import 'antd/dist/antd.css'; const { Option, OptGroup } = Select; <Select defaultValue={['current', 'grower', 'variety', 'varietyP90']} size={'large'} style={{ width: '13rem' }} onChange={value => this.setState({ yield: value })} mode="multiple" maxTagCount={0}