MCPcopy
hub / github.com/ygs-code/vue / proxy

Function proxy

vue.js:4841–4849  ·  view source on GitHub ↗
(target, sourceKey, key)

Source from the content-addressed store, hash-verified

4839 // 设置 监听 观察者, 该函数是可以让 对象中的三级key 直接冒泡到1级key中
4840 //比如 name 只能在Odata.data.name 获取到数据,执行 proxy(Odata,'data','name')之后可以Odata.name 获取值
4841 function proxy(target, sourceKey, key) {
4842 sharedPropertyDefinition.get = function proxyGetter() { //设置get函数
4843 return this[sourceKey][key]
4844 };
4845 sharedPropertyDefinition.set = function proxySetter(val) {//设置set函数
4846 this[sourceKey][key] = val;
4847 };
4848 Object.defineProperty(target, key, sharedPropertyDefinition); //设置监听观察者
4849 }
4850
4851 //初始化状态
4852 function initState(vm) {

Callers 3

loopFunction · 0.85
initDataFunction · 0.85
initProps$1Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected