Skip to content

Commit c9f054d

Browse files
authored
feat(form): Swith to functional component (#865)
* [form] functional component * switch to FC
1 parent 00e2b6f commit c9f054d

File tree

2 files changed

+42
-1
lines changed

2 files changed

+42
-1
lines changed

lib/components/form.js

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import { mergeData } from "../utils";
2+
3+
export const props = {
4+
id: {
5+
type: String,
6+
default: null
7+
},
8+
inline: {
9+
type: Boolean,
10+
default: false
11+
},
12+
novalidate: {
13+
type: Boolean,
14+
default: false
15+
},
16+
validated: {
17+
type: Boolean,
18+
default: false
19+
}
20+
};
21+
22+
export default {
23+
functional: true,
24+
props,
25+
render(h, { props, data, children }) {
26+
return h(
27+
"form",
28+
mergeData(data, {
29+
class: {
30+
"form-inline": props.inline,
31+
"was-validated": props.validated
32+
},
33+
attrs: {
34+
id: props.id || null,
35+
novalidate: props.novalidate
36+
}
37+
}),
38+
children
39+
);
40+
}
41+
};

lib/components/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import bDropdownItem from "./dropdown-item";
2323
import bDropdownItemButton from "./dropdown-item-button";
2424
import bDropdownDivider from "./dropdown-divider";
2525
import bDropdownHeader from "./dropdown-header";
26-
import bForm from "./form.vue";
26+
import bForm from "./form";
2727
import bFormRow from "./form-row";
2828
import bFormText from "./form-text";
2929
import bFormFeedback from "./form-feedback";

0 commit comments

Comments
 (0)