* Delete a property and trigger change if necessary.
(target, key)
| 1111 | * Delete a property and trigger change if necessary. |
| 1112 | */ |
| 1113 | function del (target, key) { |
| 1114 | if (isUndef(target) || isPrimitive(target) |
| 1115 | ) { |
| 1116 | warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target)))); |
| 1117 | } |
| 1118 | if (Array.isArray(target) && isValidArrayIndex(key)) { |
| 1119 | target.splice(key, 1); |
| 1120 | return |
| 1121 | } |
| 1122 | var ob = (target).__ob__; |
| 1123 | if (target._isVue || (ob && ob.vmCount)) { |
| 1124 | warn( |
| 1125 | 'Avoid deleting properties on a Vue instance or its root $data ' + |
| 1126 | '- just set it to null.' |
| 1127 | ); |
| 1128 | return |
| 1129 | } |
| 1130 | if (!hasOwn(target, key)) { |
| 1131 | return |
| 1132 | } |
| 1133 | delete target[key]; |
| 1134 | if (!ob) { |
| 1135 | return |
| 1136 | } |
| 1137 | ob.dep.notify(); |
| 1138 | } |
| 1139 | |
| 1140 | /** |
| 1141 | * Collect dependencies on array elements when the array is touched, since |
nothing calls this directly
no test coverage detected