MCPcopy
hub / github.com/fanmingming/live / bindObjectProps

Function bindObjectProps

m3u8/vue.js:2751–2800  ·  view source on GitHub ↗

* Runtime helper for merging v-bind="object" into a VNode's data.

(
    data,
    tag,
    value,
    asProp,
    isSync
  )

Source from the content-addressed store, hash-verified

2749 * Runtime helper for merging v-bind="object" into a VNode's data.
2750 */
2751 function bindObjectProps (
2752 data,
2753 tag,
2754 value,
2755 asProp,
2756 isSync
2757 ) {
2758 if (value) {
2759 if (!isObject(value)) {
2760 warn(
2761 'v-bind without argument expects an Object or Array value',
2762 this
2763 );
2764 } else {
2765 if (Array.isArray(value)) {
2766 value = toObject(value);
2767 }
2768 var hash;
2769 var loop = function ( key ) {
2770 if (
2771 key === 'class' ||
2772 key === 'style' ||
2773 isReservedAttribute(key)
2774 ) {
2775 hash = data;
2776 } else {
2777 var type = data.attrs && data.attrs.type;
2778 hash = asProp || config.mustUseProp(tag, type, key)
2779 ? data.domProps || (data.domProps = {})
2780 : data.attrs || (data.attrs = {});
2781 }
2782 var camelizedKey = camelize(key);
2783 var hyphenatedKey = hyphenate(key);
2784 if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
2785 hash[key] = value[key];
2786
2787 if (isSync) {
2788 var on = data.on || (data.on = {});
2789 on[("update:" + key)] = function ($event) {
2790 value[key] = $event;
2791 };
2792 }
2793 }
2794 };
2795
2796 for (var key in value) loop( key );
2797 }
2798 }
2799 return data
2800 }
2801
2802 /* */
2803

Callers

nothing calls this directly

Calls 4

isObjectFunction · 0.85
warnFunction · 0.85
toObjectFunction · 0.85
loopFunction · 0.85

Tested by

no test coverage detected