@@ -149,46 +149,52 @@ export default {
149
149
};
150
150
delete field .value ;
151
151
switch (field .type ) {
152
- case ' textarea' :
153
- if (element .option .native ) {
154
- input .domProps .innerHTML = fieldValue;
155
- }
156
- break ;
157
- case ' radio' :
158
- case ' checkbox' :
159
- if (field .hasOwnProperty (' items' )) {
160
- field .items .forEach (item => {
161
- const itemOptions = this .elementOptions (components[field .type ], item, item, item);
162
- children .push (createElement (components[field .type ].component , itemOptions, item .label ));
163
- });
164
- }
165
- break ;
166
- case ' select' :
167
- if (! field .required ) {
168
- children .push (createElement (components .option .component ));
169
- }
170
- field .items .forEach (option => {
171
- const optionOptions = this .elementOptions (
172
- components .option ,
173
- {
174
- value: option .value ,
175
- },
176
- field
177
- );
178
- children .push (
179
- createElement (
180
- components .option .component ,
152
+ case ' text' :
153
+ if (field .hasOwnProperty (' placeholder' )) {
154
+ if (! input .attrs ) input .attrs = {}
155
+ input .attrs .placeholder = field .placeholder
156
+ }
157
+ break ;
158
+ case ' textarea' :
159
+ if (element .option .native ) {
160
+ input .domProps .innerHTML = fieldValue;
161
+ }
162
+ break ;
163
+ case ' radio' :
164
+ case ' checkbox' :
165
+ if (field .hasOwnProperty (' items' )) {
166
+ field .items .forEach (item => {
167
+ const itemOptions = this .elementOptions (components[field .type ], item, item, item);
168
+ children .push (createElement (components[field .type ].component , itemOptions, item .label ));
169
+ });
170
+ }
171
+ break ;
172
+ case ' select' :
173
+ if (! field .required ) {
174
+ children .push (createElement (components .option .component ));
175
+ }
176
+ field .items .forEach (option => {
177
+ const optionOptions = this .elementOptions (
178
+ components .option ,
181
179
{
182
- domProps: {
183
- value: option .value ,
184
- },
185
- ... optionOptions,
180
+ value: option .value ,
186
181
},
187
- option .label
188
- )
189
- );
190
- });
191
- break ;
182
+ field
183
+ );
184
+ children .push (
185
+ createElement (
186
+ components .option .component ,
187
+ {
188
+ domProps: {
189
+ value: option .value ,
190
+ },
191
+ ... optionOptions,
192
+ },
193
+ option .label
194
+ )
195
+ );
196
+ });
197
+ break ;
192
198
}
193
199
const inputElement = createElement (element .component , input, children);
194
200
0 commit comments