Fix "current value" for <b-select> element in e.g. edit form views

apparently marking an `<option>` as "selected" does not cut it for Buefy, and
we must bind to a v-model somehow.  not real crazy about the current method,
but it does seem to work okay so far...
This commit is contained in:
Lance Edgar 2019-06-06 14:57:31 -05:00
parent 1ee76878d9
commit 96c5bd0b69
2 changed files with 6 additions and 1 deletions

View file

@ -56,7 +56,9 @@
</script>
</div>
<div tal:condition="use_buefy" tal:omit-tag="">
<div tal:condition="use_buefy"
tal:define="vmodel vmodel|'field_model_' + name;"
tal:omit-tag="">
<b-select tal:attributes="name name;
id oid;
placeholder '(please choose)';
@ -64,6 +66,7 @@
multiple multiple;
size size;
style style;
v-model vmodel;
@input input_handler;">
<tal:loop tal:repeat="item values">

View file

@ -95,6 +95,8 @@
field_model_${field.name}: null,
% elif isinstance(field.schema.typ, deform.FileData):
field_model_${field.name}: null,
% else:
field_model_${field.name}: ${json.dumps(field.cstruct)|n},
% endif
% endif
% endfor