MCPcopy Create free account
hub / github.com/TruthHun/BookStack / model

Function model

static/vuejs/vue.esm.js:5690–5742  ·  view source on GitHub ↗
(
  el,
  dir,
  _warn
)

Source from the content-addressed store, hash-verified

5688var CHECKBOX_RADIO_TOKEN = '__c';
5689
5690function model (
5691 el,
5692 dir,
5693 _warn
5694) {
5695 warn$1 = _warn;
5696 var value = dir.value;
5697 var modifiers = dir.modifiers;
5698 var tag = el.tag;
5699 var type = el.attrsMap.type;
5700
5701 if (process.env.NODE_ENV !== 'production') {
5702 var dynamicType = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
5703 if (tag === 'input' && dynamicType) {
5704 warn$1(
5705 "<input :type=\"" + dynamicType + "\" v-model=\"" + value + "\">:\n" +
5706 "v-model does not support dynamic input types. Use v-if branches instead."
5707 );
5708 }
5709 // inputs with type="file" are read only and setting the input's
5710 // value will throw an error.
5711 if (tag === 'input' && type === 'file') {
5712 warn$1(
5713 "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
5714 "File inputs are read only. Use a v-on:change listener instead."
5715 );
5716 }
5717 }
5718
5719 if (tag === 'select') {
5720 genSelect(el, value, modifiers);
5721 } else if (tag === 'input' && type === 'checkbox') {
5722 genCheckboxModel(el, value, modifiers);
5723 } else if (tag === 'input' && type === 'radio') {
5724 genRadioModel(el, value, modifiers);
5725 } else if (tag === 'input' || tag === 'textarea') {
5726 genDefaultModel(el, value, modifiers);
5727 } else if (!config.isReservedTag(tag)) {
5728 genComponentModel(el, value, modifiers);
5729 // component v-model doesn't need extra runtime
5730 return false
5731 } else if (process.env.NODE_ENV !== 'production') {
5732 warn$1(
5733 "<" + (el.tag) + " v-model=\"" + value + "\">: " +
5734 "v-model is not supported on this element type. " +
5735 'If you are working with contenteditable, it\'s recommended to ' +
5736 'wrap a library dedicated for that purpose inside a custom component.'
5737 );
5738 }
5739
5740 // ensure runtime directive metadata
5741 return true
5742}
5743
5744function genCheckboxModel (
5745 el,

Callers

nothing calls this directly

Calls 5

genSelectFunction · 0.70
genCheckboxModelFunction · 0.70
genRadioModelFunction · 0.70
genDefaultModelFunction · 0.70
genComponentModelFunction · 0.70

Tested by

no test coverage detected