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

build uni runtime

上级 b0805960
......@@ -215,7 +215,11 @@ function wrapper (methodName, method) {
arg1 = processArgs(methodName, arg1, options.args, options.returnValue);
const returnValue = wx[options.name || methodName](arg1, arg2);
const args = [arg1];
if (typeof arg2 !== 'undefined') {
args.push(arg2);
}
const returnValue = wx[options.name || methodName].apply(wx, args);
if (isSyncApi(methodName)) { // 同步 api
return processReturnValue(methodName, returnValue, options.returnValue, isContextApi(methodName))
}
......@@ -757,7 +761,15 @@ function handleEvent (event) {
eventsArray.forEach(eventArray => {
const methodName = eventArray[0];
if (methodName) {
const handler = this.$vm[methodName];
let handlerCtx = this.$vm;
if (
handlerCtx.$options.generic &&
handlerCtx.$parent &&
handlerCtx.$parent.$parent
) { // mp-weixin,mp-toutiao 抽象节点模拟 scoped slots
handlerCtx = handlerCtx.$parent.$parent;
}
const handler = handlerCtx[methodName];
if (!isFn(handler)) {
throw new Error(` _vm.${methodName} is not a function`)
}
......@@ -767,7 +779,7 @@ function handleEvent (event) {
}
handler.once = true;
}
handler.apply(this.$vm, processEventArgs(
handler.apply(handlerCtx, processEventArgs(
this.$vm,
event,
eventArray[1],
......@@ -1101,7 +1113,8 @@ todos.forEach(todoApi => {
});
canIUses.forEach(canIUseApi => {
const apiName = protocols[canIUseApi] && protocols[canIUseApi].name ? protocols[canIUseApi].name : canIUseApi;
const apiName = protocols[canIUseApi] && protocols[canIUseApi].name ? protocols[canIUseApi].name
: canIUseApi;
if (!wx.canIUse(apiName)) {
protocols[canIUseApi] = false;
}
......@@ -1138,6 +1151,10 @@ if (typeof Proxy !== 'undefined') {
});
}
wx.createApp = createApp;
wx.createPage = createPage;
wx.createComponent = createComponent;
var uni$1 = uni;
export default uni$1;
......
{
"name": "@dcloudio/uni-app-plus",
"version": "0.0.235",
"version": "0.0.236",
"description": "uni-app app-plus",
"main": "dist/index.js",
"scripts": {
......
......@@ -581,7 +581,11 @@ function wrapper (methodName, method) {
arg1 = processArgs(methodName, arg1, options.args, options.returnValue);
const returnValue = my[options.name || methodName](arg1, arg2);
const args = [arg1];
if (typeof arg2 !== 'undefined') {
args.push(arg2);
}
const returnValue = my[options.name || methodName].apply(my, args);
if (isSyncApi(methodName)) { // 同步 api
return processReturnValue(methodName, returnValue, options.returnValue, isContextApi(methodName))
}
......@@ -1067,7 +1071,15 @@ function handleEvent (event) {
eventsArray.forEach(eventArray => {
const methodName = eventArray[0];
if (methodName) {
const handler = this.$vm[methodName];
let handlerCtx = this.$vm;
if (
handlerCtx.$options.generic &&
handlerCtx.$parent &&
handlerCtx.$parent.$parent
) { // mp-weixin,mp-toutiao 抽象节点模拟 scoped slots
handlerCtx = handlerCtx.$parent.$parent;
}
const handler = handlerCtx[methodName];
if (!isFn(handler)) {
throw new Error(` _vm.${methodName} is not a function`)
}
......@@ -1077,7 +1089,7 @@ function handleEvent (event) {
}
handler.once = true;
}
handler.apply(this.$vm, processEventArgs(
handler.apply(handlerCtx, processEventArgs(
this.$vm,
event,
eventArray[1],
......@@ -1466,6 +1478,10 @@ function parsePage (vuePageOptions) {
initHooks(pageOptions, hooks$1);
if (vueOptions.methods && vueOptions.methods.formReset) {
pageOptions.formReset = vueOptions.methods.formReset;
}
return pageOptions
}
......@@ -1590,7 +1606,8 @@ todos.forEach(todoApi => {
});
canIUses.forEach(canIUseApi => {
const apiName = protocols[canIUseApi] && protocols[canIUseApi].name ? protocols[canIUseApi].name : canIUseApi;
const apiName = protocols[canIUseApi] && protocols[canIUseApi].name ? protocols[canIUseApi].name
: canIUseApi;
if (!my.canIUse(apiName)) {
protocols[canIUseApi] = false;
}
......@@ -1644,6 +1661,10 @@ if (typeof Proxy !== 'undefined') {
});
}
my.createApp = createApp;
my.createPage = createPage;
my.createComponent = createComponent;
var uni$1 = uni;
export default uni$1;
......
{
"name": "@dcloudio/uni-mp-alipay",
"version": "0.0.805",
"version": "0.0.806",
"description": "uni-app mp-alipay",
"main": "dist/index.js",
"scripts": {
......
......@@ -338,7 +338,11 @@ function wrapper (methodName, method) {
arg1 = processArgs(methodName, arg1, options.args, options.returnValue);
const returnValue = swan[options.name || methodName](arg1, arg2);
const args = [arg1];
if (typeof arg2 !== 'undefined') {
args.push(arg2);
}
const returnValue = swan[options.name || methodName].apply(swan, args);
if (isSyncApi(methodName)) { // 同步 api
return processReturnValue(methodName, returnValue, options.returnValue, isContextApi(methodName))
}
......@@ -884,7 +888,15 @@ function handleEvent (event) {
eventsArray.forEach(eventArray => {
const methodName = eventArray[0];
if (methodName) {
const handler = this.$vm[methodName];
let handlerCtx = this.$vm;
if (
handlerCtx.$options.generic &&
handlerCtx.$parent &&
handlerCtx.$parent.$parent
) { // mp-weixin,mp-toutiao 抽象节点模拟 scoped slots
handlerCtx = handlerCtx.$parent.$parent;
}
const handler = handlerCtx[methodName];
if (!isFn(handler)) {
throw new Error(` _vm.${methodName} is not a function`)
}
......@@ -894,7 +906,7 @@ function handleEvent (event) {
}
handler.once = true;
}
handler.apply(this.$vm, processEventArgs(
handler.apply(handlerCtx, processEventArgs(
this.$vm,
event,
eventArray[1],
......@@ -1237,7 +1249,8 @@ todos.forEach(todoApi => {
});
canIUses.forEach(canIUseApi => {
const apiName = protocols[canIUseApi] && protocols[canIUseApi].name ? protocols[canIUseApi].name : canIUseApi;
const apiName = protocols[canIUseApi] && protocols[canIUseApi].name ? protocols[canIUseApi].name
: canIUseApi;
if (!swan.canIUse(apiName)) {
protocols[canIUseApi] = false;
}
......@@ -1291,6 +1304,10 @@ if (typeof Proxy !== 'undefined') {
});
}
swan.createApp = createApp;
swan.createPage = createPage;
swan.createComponent = createComponent;
var uni$1 = uni;
export default uni$1;
......
{
"name": "@dcloudio/uni-mp-baidu",
"version": "0.0.833",
"version": "0.0.834",
"description": "uni-app mp-baidu",
"main": "dist/index.js",
"scripts": {
......
......@@ -399,7 +399,11 @@ function wrapper (methodName, method) {
arg1 = processArgs(methodName, arg1, options.args, options.returnValue);
const returnValue = tt[options.name || methodName](arg1, arg2);
const args = [arg1];
if (typeof arg2 !== 'undefined') {
args.push(arg2);
}
const returnValue = tt[options.name || methodName].apply(tt, args);
if (isSyncApi(methodName)) { // 同步 api
return processReturnValue(methodName, returnValue, options.returnValue, isContextApi(methodName))
}
......@@ -903,7 +907,15 @@ function handleEvent (event) {
eventsArray.forEach(eventArray => {
const methodName = eventArray[0];
if (methodName) {
const handler = this.$vm[methodName];
let handlerCtx = this.$vm;
if (
handlerCtx.$options.generic &&
handlerCtx.$parent &&
handlerCtx.$parent.$parent
) { // mp-weixin,mp-toutiao 抽象节点模拟 scoped slots
handlerCtx = handlerCtx.$parent.$parent;
}
const handler = handlerCtx[methodName];
if (!isFn(handler)) {
throw new Error(` _vm.${methodName} is not a function`)
}
......@@ -913,7 +925,7 @@ function handleEvent (event) {
}
handler.once = true;
}
handler.apply(this.$vm, processEventArgs(
handler.apply(handlerCtx, processEventArgs(
this.$vm,
event,
eventArray[1],
......@@ -1312,7 +1324,8 @@ todos.forEach(todoApi => {
});
canIUses.forEach(canIUseApi => {
const apiName = protocols[canIUseApi] && protocols[canIUseApi].name ? protocols[canIUseApi].name : canIUseApi;
const apiName = protocols[canIUseApi] && protocols[canIUseApi].name ? protocols[canIUseApi].name
: canIUseApi;
if (!tt.canIUse(apiName)) {
protocols[canIUseApi] = false;
}
......@@ -1366,6 +1379,10 @@ if (typeof Proxy !== 'undefined') {
});
}
tt.createApp = createApp;
tt.createPage = createPage;
tt.createComponent = createComponent;
var uni$1 = uni;
export default uni$1;
......
{
"name": "@dcloudio/uni-mp-toutiao",
"version": "0.0.333",
"version": "0.0.334",
"description": "uni-app mp-toutiao",
"main": "dist/index.js",
"scripts": {
......
......@@ -251,7 +251,11 @@ function wrapper (methodName, method) {
arg1 = processArgs(methodName, arg1, options.args, options.returnValue);
const returnValue = wx[options.name || methodName](arg1, arg2);
const args = [arg1];
if (typeof arg2 !== 'undefined') {
args.push(arg2);
}
const returnValue = wx[options.name || methodName].apply(wx, args);
if (isSyncApi(methodName)) { // 同步 api
return processReturnValue(methodName, returnValue, options.returnValue, isContextApi(methodName))
}
......@@ -760,7 +764,15 @@ function handleEvent (event) {
eventsArray.forEach(eventArray => {
const methodName = eventArray[0];
if (methodName) {
const handler = this.$vm[methodName];
let handlerCtx = this.$vm;
if (
handlerCtx.$options.generic &&
handlerCtx.$parent &&
handlerCtx.$parent.$parent
) { // mp-weixin,mp-toutiao 抽象节点模拟 scoped slots
handlerCtx = handlerCtx.$parent.$parent;
}
const handler = handlerCtx[methodName];
if (!isFn(handler)) {
throw new Error(` _vm.${methodName} is not a function`)
}
......@@ -770,7 +782,7 @@ function handleEvent (event) {
}
handler.once = true;
}
handler.apply(this.$vm, processEventArgs(
handler.apply(handlerCtx, processEventArgs(
this.$vm,
event,
eventArray[1],
......@@ -1072,7 +1084,8 @@ todos.forEach(todoApi => {
});
canIUses.forEach(canIUseApi => {
const apiName = protocols[canIUseApi] && protocols[canIUseApi].name ? protocols[canIUseApi].name : canIUseApi;
const apiName = protocols[canIUseApi] && protocols[canIUseApi].name ? protocols[canIUseApi].name
: canIUseApi;
if (!wx.canIUse(apiName)) {
protocols[canIUseApi] = false;
}
......@@ -1126,6 +1139,10 @@ if (typeof Proxy !== 'undefined') {
});
}
wx.createApp = createApp;
wx.createPage = createPage;
wx.createComponent = createComponent;
var uni$1 = uni;
export default uni$1;
......
{
"name": "@dcloudio/uni-mp-weixin",
"version": "0.0.955",
"version": "0.0.956",
"description": "uni-app mp-weixin",
"main": "dist/index.js",
"scripts": {
......
......@@ -18,14 +18,23 @@ import * as extraApi from './extra'
import * as api from 'uni-platform/service/api/index.js'
import { protocols, todos, canIUses } from 'uni-platform/service/api/protocols'
import {
protocols,
todos,
canIUses
} from 'uni-platform/service/api/protocols'
import createApp from './wrapper/create-app'
import createPage from './wrapper/create-page'
import createComponent from './wrapper/create-component'
todos.forEach(todoApi => {
protocols[todoApi] = false
})
canIUses.forEach(canIUseApi => {
const apiName = protocols[canIUseApi] && protocols[canIUseApi].name ? protocols[canIUseApi].name : canIUseApi
const apiName = protocols[canIUseApi] && protocols[canIUseApi].name ? protocols[canIUseApi].name
: canIUseApi
if (!__GLOBAL__.canIUse(apiName)) {
protocols[canIUseApi] = false
}
......@@ -79,8 +88,14 @@ if (typeof Proxy !== 'undefined') {
})
}
export * from './wrapper/create-app'
export * from './wrapper/create-page'
export * from './wrapper/create-component'
__GLOBAL__.createApp = createApp
__GLOBAL__.createPage = createPage
__GLOBAL__.createComponent = createComponent
export {
createApp,
createPage,
createComponent
}
export default uni
......@@ -77,7 +77,11 @@ export default function wrapper (methodName, method) {
arg1 = processArgs(methodName, arg1, options.args, options.returnValue)
const returnValue = __GLOBAL__[options.name || methodName](arg1, arg2)
const args = [arg1]
if (typeof arg2 !== 'undefined') {
args.push(arg2)
}
const returnValue = __GLOBAL__[options.name || methodName].apply(__GLOBAL__, args)
if (isSyncApi(methodName)) { // 同步 api
return processReturnValue(methodName, returnValue, options.returnValue, isContextApi(methodName))
}
......
......@@ -2,7 +2,7 @@ import 'uni-platform/runtime/index'
import parseApp from 'uni-platform/runtime/wrapper/app-parser'
export function createApp (vm) {
export default function createApp (vm) {
App(parseApp(vm))
return vm
}
import parseComponent from 'uni-platform/runtime/wrapper/component-parser'
export function createComponent (vueOptions) {
export default function createComponent (vueOptions) {
if (__PLATFORM__ === 'mp-alipay') {
return my.createComponent(parseComponent(vueOptions))
} else {
......
import parsePage from 'uni-platform/runtime/wrapper/page-parser'
export function createPage (vuePageOptions) {
export default function createPage (vuePageOptions) {
if (__PLATFORM__ === 'mp-alipay') {
return Page(parsePage(vuePageOptions))
} else {
......
......@@ -418,7 +418,15 @@ export function handleEvent (event) {
eventsArray.forEach(eventArray => {
const methodName = eventArray[0]
if (methodName) {
const handler = this.$vm[methodName]
let handlerCtx = this.$vm
if (
handlerCtx.$options.generic &&
handlerCtx.$parent &&
handlerCtx.$parent.$parent
) { // mp-weixin,mp-toutiao 抽象节点模拟 scoped slots
handlerCtx = handlerCtx.$parent.$parent
}
const handler = handlerCtx[methodName]
if (!isFn(handler)) {
throw new Error(` _vm.${methodName} is not a function`)
}
......@@ -428,7 +436,7 @@ export function handleEvent (event) {
}
handler.once = true
}
handler.apply(this.$vm, processEventArgs(
handler.apply(handlerCtx, processEventArgs(
this.$vm,
event,
eventArray[1],
......
......@@ -69,5 +69,9 @@ export default function parsePage (vuePageOptions) {
initHooks(pageOptions, hooks)
if (vueOptions.methods && vueOptions.methods.formReset) {
pageOptions.formReset = vueOptions.methods.formReset
}
return pageOptions
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册