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

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

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