| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.toReactive = toReactive;
- var _vue = require("vue");
- /**
- * Converts ref to reactive.
- *
- * @see https://vueuse.org/toReactive
- * @param objectRef A ref of object
- */
- function toReactive(objectRef) {
- if (!(0, _vue.isRef)(objectRef)) return (0, _vue.reactive)(objectRef);
- const proxy = new Proxy({}, {
- get(_, p, receiver) {
- return Reflect.get(objectRef.value, p, receiver);
- },
- set(_, p, value) {
- objectRef.value[p] = value;
- return true;
- },
- deleteProperty(_, p) {
- return Reflect.deleteProperty(objectRef.value, p);
- },
- has(_, p) {
- return Reflect.has(objectRef.value, p);
- },
- ownKeys() {
- return Object.keys(objectRef.value);
- },
- getOwnPropertyDescriptor() {
- return {
- enumerable: true,
- configurable: true
- };
- }
- });
- return (0, _vue.reactive)(proxy);
- }
|