MCPcopy Index your code
hub / github.com/pywebio/PyWebIO / setup_select_options

Method setup_select_options

webiojs/src/models/input/select.ts:63–82  ·  view source on GitHub ↗
(elem: JQuery, options: any)

Source from the content-addressed store, hash-verified

61 }
62
63 setup_select_options(elem: JQuery, options: any) {
64 let input_elem = elem.find('select');
65 let opts = input_elem.find('option');
66 for (let idx = 0; idx < options.length; idx++)
67 opts.eq(idx).val(JSON.stringify(options[idx].value));
68
69 // 将额外的html参数加到input标签上
70 const ignore_keys = make_set(['type', 'label', 'invalid_feedback', 'valid_feedback', 'help_text',
71 'options', 'datalist', 'multiple', 'onchange', 'onblur'])
72
73 for (let key in this.spec) {
74 if (key in ignore_keys) continue;
75 input_elem.attr(key, this.spec[key]);
76 }
77
78 if (this.use_bootstrap_select) {
79 // @ts-ignore
80 input_elem.selectpicker('refresh');
81 }
82 }
83
84 update_input(spec: any): any {
85 let attributes = spec.attributes;

Callers 2

create_elementMethod · 0.95
update_inputMethod · 0.95

Calls 1

make_setFunction · 0.90

Tested by

no test coverage detected