提交 e5c3df14 编写于 作者: fxy060608's avatar fxy060608

feat(runtime): uni 对象支持赋值操作

上级 ce2e1171
src/core/helpers/html-parser.js src/core/helpers/html-parser.js
src/platforms/app-plus-nvue/runtime
build/rollup-plugin-require-context build/rollup-plugin-require-context
...@@ -1434,6 +1434,9 @@ let uni = {}; ...@@ -1434,6 +1434,9 @@ let uni = {};
if (typeof Proxy !== 'undefined' && "app-plus" !== 'app-plus') { if (typeof Proxy !== 'undefined' && "app-plus" !== 'app-plus') {
uni = new Proxy({}, { uni = new Proxy({}, {
get (target, name) { get (target, name) {
if (target[name]) {
return target[name]
}
if (baseApi[name]) { if (baseApi[name]) {
return baseApi[name] return baseApi[name]
} }
...@@ -1447,6 +1450,9 @@ if (typeof Proxy !== 'undefined' && "app-plus" !== 'app-plus') { ...@@ -1447,6 +1450,9 @@ if (typeof Proxy !== 'undefined' && "app-plus" !== 'app-plus') {
return return
} }
return promisify(name, wrapper(name, wx[name])) return promisify(name, wrapper(name, wx[name]))
},
set (target, name, value) {
target[name] = value;
} }
}); });
} else { } else {
......
{ {
"name": "@dcloudio/uni-app-plus", "name": "@dcloudio/uni-app-plus",
"version": "0.0.249", "version": "0.0.250",
"description": "uni-app app-plus", "description": "uni-app app-plus",
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {
......
...@@ -2009,6 +2009,9 @@ let uni = {}; ...@@ -2009,6 +2009,9 @@ let uni = {};
if (typeof Proxy !== 'undefined' && "mp-alipay" !== 'app-plus') { if (typeof Proxy !== 'undefined' && "mp-alipay" !== 'app-plus') {
uni = new Proxy({}, { uni = new Proxy({}, {
get (target, name) { get (target, name) {
if (target[name]) {
return target[name]
}
if (baseApi[name]) { if (baseApi[name]) {
return baseApi[name] return baseApi[name]
} }
...@@ -2030,6 +2033,9 @@ if (typeof Proxy !== 'undefined' && "mp-alipay" !== 'app-plus') { ...@@ -2030,6 +2033,9 @@ if (typeof Proxy !== 'undefined' && "mp-alipay" !== 'app-plus') {
return return
} }
return promisify(name, wrapper(name, my[name])) return promisify(name, wrapper(name, my[name]))
},
set (target, name, value) {
target[name] = value;
} }
}); });
} else { } else {
......
{ {
"name": "@dcloudio/uni-mp-alipay", "name": "@dcloudio/uni-mp-alipay",
"version": "0.0.823", "version": "0.0.824",
"description": "uni-app mp-alipay", "description": "uni-app mp-alipay",
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {
......
...@@ -1592,6 +1592,9 @@ let uni = {}; ...@@ -1592,6 +1592,9 @@ let uni = {};
if (typeof Proxy !== 'undefined' && "mp-baidu" !== 'app-plus') { if (typeof Proxy !== 'undefined' && "mp-baidu" !== 'app-plus') {
uni = new Proxy({}, { uni = new Proxy({}, {
get (target, name) { get (target, name) {
if (target[name]) {
return target[name]
}
if (baseApi[name]) { if (baseApi[name]) {
return baseApi[name] return baseApi[name]
} }
...@@ -1613,6 +1616,9 @@ if (typeof Proxy !== 'undefined' && "mp-baidu" !== 'app-plus') { ...@@ -1613,6 +1616,9 @@ if (typeof Proxy !== 'undefined' && "mp-baidu" !== 'app-plus') {
return return
} }
return promisify(name, wrapper(name, swan[name])) return promisify(name, wrapper(name, swan[name]))
},
set (target, name, value) {
target[name] = value;
} }
}); });
} else { } else {
......
{ {
"name": "@dcloudio/uni-mp-baidu", "name": "@dcloudio/uni-mp-baidu",
"version": "0.0.853", "version": "0.0.854",
"description": "uni-app mp-baidu", "description": "uni-app mp-baidu",
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {
......
...@@ -1473,6 +1473,9 @@ let uni = {}; ...@@ -1473,6 +1473,9 @@ let uni = {};
if (typeof Proxy !== 'undefined' && "mp-qq" !== 'app-plus') { if (typeof Proxy !== 'undefined' && "mp-qq" !== 'app-plus') {
uni = new Proxy({}, { uni = new Proxy({}, {
get (target, name) { get (target, name) {
if (target[name]) {
return target[name]
}
if (baseApi[name]) { if (baseApi[name]) {
return baseApi[name] return baseApi[name]
} }
...@@ -1494,6 +1497,9 @@ if (typeof Proxy !== 'undefined' && "mp-qq" !== 'app-plus') { ...@@ -1494,6 +1497,9 @@ if (typeof Proxy !== 'undefined' && "mp-qq" !== 'app-plus') {
return return
} }
return promisify(name, wrapper(name, wx[name])) return promisify(name, wrapper(name, wx[name]))
},
set (target, name, value) {
target[name] = value;
} }
}); });
} else { } else {
......
{ {
"name": "@dcloudio/uni-mp-qq", "name": "@dcloudio/uni-mp-qq",
"version": "0.0.107", "version": "0.0.108",
"description": "uni-app mp-qq", "description": "uni-app mp-qq",
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {
......
...@@ -1652,6 +1652,9 @@ let uni = {}; ...@@ -1652,6 +1652,9 @@ let uni = {};
if (typeof Proxy !== 'undefined' && "mp-toutiao" !== 'app-plus') { if (typeof Proxy !== 'undefined' && "mp-toutiao" !== 'app-plus') {
uni = new Proxy({}, { uni = new Proxy({}, {
get (target, name) { get (target, name) {
if (target[name]) {
return target[name]
}
if (baseApi[name]) { if (baseApi[name]) {
return baseApi[name] return baseApi[name]
} }
...@@ -1673,6 +1676,9 @@ if (typeof Proxy !== 'undefined' && "mp-toutiao" !== 'app-plus') { ...@@ -1673,6 +1676,9 @@ if (typeof Proxy !== 'undefined' && "mp-toutiao" !== 'app-plus') {
return return
} }
return promisify(name, wrapper(name, tt[name])) return promisify(name, wrapper(name, tt[name]))
},
set (target, name, value) {
target[name] = value;
} }
}); });
} else { } else {
......
{ {
"name": "@dcloudio/uni-mp-toutiao", "name": "@dcloudio/uni-mp-toutiao",
"version": "0.0.347", "version": "0.0.348",
"description": "uni-app mp-toutiao", "description": "uni-app mp-toutiao",
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {
......
...@@ -1404,6 +1404,9 @@ let uni = {}; ...@@ -1404,6 +1404,9 @@ let uni = {};
if (typeof Proxy !== 'undefined' && "mp-weixin" !== 'app-plus') { if (typeof Proxy !== 'undefined' && "mp-weixin" !== 'app-plus') {
uni = new Proxy({}, { uni = new Proxy({}, {
get (target, name) { get (target, name) {
if (target[name]) {
return target[name]
}
if (baseApi[name]) { if (baseApi[name]) {
return baseApi[name] return baseApi[name]
} }
...@@ -1425,6 +1428,9 @@ if (typeof Proxy !== 'undefined' && "mp-weixin" !== 'app-plus') { ...@@ -1425,6 +1428,9 @@ if (typeof Proxy !== 'undefined' && "mp-weixin" !== 'app-plus') {
return return
} }
return promisify(name, wrapper(name, wx[name])) return promisify(name, wrapper(name, wx[name]))
},
set (target, name, value) {
target[name] = value;
} }
}); });
} else { } else {
......
{ {
"name": "@dcloudio/uni-mp-weixin", "name": "@dcloudio/uni-mp-weixin",
"version": "0.0.969", "version": "0.0.970",
"description": "uni-app mp-weixin", "description": "uni-app mp-weixin",
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {
......
...@@ -45,6 +45,9 @@ let uni = {} ...@@ -45,6 +45,9 @@ let uni = {}
if (typeof Proxy !== 'undefined' && __PLATFORM__ !== 'app-plus') { if (typeof Proxy !== 'undefined' && __PLATFORM__ !== 'app-plus') {
uni = new Proxy({}, { uni = new Proxy({}, {
get (target, name) { get (target, name) {
if (target[name]) {
return target[name]
}
if (baseApi[name]) { if (baseApi[name]) {
return baseApi[name] return baseApi[name]
} }
...@@ -66,6 +69,9 @@ if (typeof Proxy !== 'undefined' && __PLATFORM__ !== 'app-plus') { ...@@ -66,6 +69,9 @@ if (typeof Proxy !== 'undefined' && __PLATFORM__ !== 'app-plus') {
return return
} }
return promisify(name, wrapper(name, __GLOBAL__[name])) return promisify(name, wrapper(name, __GLOBAL__[name]))
},
set (target, name, value) {
target[name] = value
} }
}) })
} else { } else {
......
...@@ -32,6 +32,9 @@ export default function initUni (uni, nvue, plus, BroadcastChannel) { ...@@ -32,6 +32,9 @@ export default function initUni (uni, nvue, plus, BroadcastChannel) {
if (typeof Proxy !== 'undefined') { if (typeof Proxy !== 'undefined') {
return new Proxy({}, { return new Proxy({}, {
get (target, name) { get (target, name) {
if (target[name]) {
return target[name]
}
if (apis[name]) { if (apis[name]) {
return apis[name] return apis[name]
} }
...@@ -42,6 +45,9 @@ export default function initUni (uni, nvue, plus, BroadcastChannel) { ...@@ -42,6 +45,9 @@ export default function initUni (uni, nvue, plus, BroadcastChannel) {
return return
} }
return promisify(name, uni[name]) return promisify(name, uni[name])
},
set (target, name, value) {
target[name] = value
} }
}) })
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册