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

npm run build:runtime

上级 19672629
...@@ -1079,6 +1079,18 @@ function handleEvent (event) { ...@@ -1079,6 +1079,18 @@ function handleEvent (event) {
handlerCtx.$parent.$parent handlerCtx.$parent.$parent
) { // mp-weixin,mp-toutiao 抽象节点模拟 scoped slots ) { // mp-weixin,mp-toutiao 抽象节点模拟 scoped slots
handlerCtx = handlerCtx.$parent.$parent; handlerCtx = handlerCtx.$parent.$parent;
}
if (methodName === '$emit') {
handlerCtx.$emit.apply(handlerCtx,
processEventArgs(
this.$vm,
event,
eventArray[1],
eventArray[2],
isCustom,
methodName
));
return
} }
const handler = handlerCtx[methodName]; const handler = handlerCtx[methodName];
if (!isFn(handler)) { if (!isFn(handler)) {
......
...@@ -1471,6 +1471,18 @@ function handleEvent (event) { ...@@ -1471,6 +1471,18 @@ function handleEvent (event) {
handlerCtx.$parent.$parent handlerCtx.$parent.$parent
) { // mp-weixin,mp-toutiao 抽象节点模拟 scoped slots ) { // mp-weixin,mp-toutiao 抽象节点模拟 scoped slots
handlerCtx = handlerCtx.$parent.$parent; handlerCtx = handlerCtx.$parent.$parent;
}
if (methodName === '$emit') {
handlerCtx.$emit.apply(handlerCtx,
processEventArgs(
this.$vm,
event,
eventArray[1],
eventArray[2],
isCustom,
methodName
));
return
} }
const handler = handlerCtx[methodName]; const handler = handlerCtx[methodName];
if (!isFn(handler)) { if (!isFn(handler)) {
...@@ -1665,7 +1677,7 @@ const customizeRE = /:/g; ...@@ -1665,7 +1677,7 @@ const customizeRE = /:/g;
const customize = cached((str) => { const customize = cached((str) => {
return camelize(str.replace(customizeRE, '-')) return camelize(str.replace(customizeRE, '-'))
}); });
const isComponent2 = my.canIUse('component2'); const isComponent2 = my.canIUse('component2');
...@@ -1763,7 +1775,7 @@ function handleRef (ref) { ...@@ -1763,7 +1775,7 @@ function handleRef (ref) {
if (refName) { if (refName) {
this.$vm.$refs[refName] = ref.$vm || ref; this.$vm.$refs[refName] = ref.$vm || ref;
} else if (refInForName) { } else if (refInForName) {
this.$vm.$refs[refInForName] = [ref.$vm || ref]; (this.$vm.$refs[refInForName] || (this.$vm.$refs[refInForName] = [])).push(ref.$vm || ref);
} }
} }
......
...@@ -1216,6 +1216,18 @@ function handleEvent (event) { ...@@ -1216,6 +1216,18 @@ function handleEvent (event) {
handlerCtx.$parent.$parent handlerCtx.$parent.$parent
) { // mp-weixin,mp-toutiao 抽象节点模拟 scoped slots ) { // mp-weixin,mp-toutiao 抽象节点模拟 scoped slots
handlerCtx = handlerCtx.$parent.$parent; handlerCtx = handlerCtx.$parent.$parent;
}
if (methodName === '$emit') {
handlerCtx.$emit.apply(handlerCtx,
processEventArgs(
this.$vm,
event,
eventArray[1],
eventArray[2],
isCustom,
methodName
));
return
} }
const handler = handlerCtx[methodName]; const handler = handlerCtx[methodName];
if (!isFn(handler)) { if (!isFn(handler)) {
...@@ -1509,9 +1521,9 @@ function parseComponent (vueOptions) { ...@@ -1509,9 +1521,9 @@ function parseComponent (vueOptions) {
initRelation initRelation
}); });
// 关于百度小程序新生命周期(2.0)的说明(组件作为页面时): // 关于百度小程序生命周期的说明(组件作为页面时):
// lifetimes:attached --> methods:onShow --> methods:onLoad --> methods:onReady // lifetimes:attached --> methods:onShow --> methods:onLoad --> methods:onReady
// 这里在新生命周期强制将onShow挪到onLoad之后触发,另外一处修改在page-parser.js // 这里在强制将onShow挪到onLoad之后触发,另外一处修改在page-parser.js
const oldAttached = componentOptions.lifetimes.attached; const oldAttached = componentOptions.lifetimes.attached;
componentOptions.lifetimes.attached = function attached () { componentOptions.lifetimes.attached = function attached () {
oldAttached.call(this); oldAttached.call(this);
...@@ -1596,12 +1608,12 @@ function parsePage (vuePageOptions) { ...@@ -1596,12 +1608,12 @@ function parsePage (vuePageOptions) {
initRelation initRelation
}); });
const newLifecycle = swan.canIUse('lifecycle-2-0'); // 纠正百度小程序生命周期methods:onShow在methods:onLoad之前触发的问题
pageOptions.methods.onShow = function onShow () {
// 纠正百度小程序新生命周期(2.0)methods:onShow在methods:onLoad之前触发的问题 if (this.$vm && this.$vm.$mp.query) {
if (newLifecycle) { this.$vm.__call_hook('onShow');
delete pageOptions.methods.onShow; }
} };
pageOptions.methods.onLoad = function onLoad (args) { pageOptions.methods.onLoad = function onLoad (args) {
// 百度 onLoad 在 attached 之前触发,先存储 args, 在 attached 里边触发 onLoad // 百度 onLoad 在 attached 之前触发,先存储 args, 在 attached 里边触发 onLoad
......
...@@ -1134,6 +1134,18 @@ function handleEvent (event) { ...@@ -1134,6 +1134,18 @@ function handleEvent (event) {
handlerCtx.$parent.$parent handlerCtx.$parent.$parent
) { // mp-weixin,mp-toutiao 抽象节点模拟 scoped slots ) { // mp-weixin,mp-toutiao 抽象节点模拟 scoped slots
handlerCtx = handlerCtx.$parent.$parent; handlerCtx = handlerCtx.$parent.$parent;
}
if (methodName === '$emit') {
handlerCtx.$emit.apply(handlerCtx,
processEventArgs(
this.$vm,
event,
eventArray[1],
eventArray[2],
isCustom,
methodName
));
return
} }
const handler = handlerCtx[methodName]; const handler = handlerCtx[methodName];
if (!isFn(handler)) { if (!isFn(handler)) {
......
...@@ -1226,6 +1226,18 @@ function handleEvent (event) { ...@@ -1226,6 +1226,18 @@ function handleEvent (event) {
handlerCtx.$parent.$parent handlerCtx.$parent.$parent
) { // mp-weixin,mp-toutiao 抽象节点模拟 scoped slots ) { // mp-weixin,mp-toutiao 抽象节点模拟 scoped slots
handlerCtx = handlerCtx.$parent.$parent; handlerCtx = handlerCtx.$parent.$parent;
}
if (methodName === '$emit') {
handlerCtx.$emit.apply(handlerCtx,
processEventArgs(
this.$vm,
event,
eventArray[1],
eventArray[2],
isCustom,
methodName
));
return
} }
const handler = handlerCtx[methodName]; const handler = handlerCtx[methodName];
if (!isFn(handler)) { if (!isFn(handler)) {
......
...@@ -1074,6 +1074,18 @@ function handleEvent (event) { ...@@ -1074,6 +1074,18 @@ function handleEvent (event) {
handlerCtx.$parent.$parent handlerCtx.$parent.$parent
) { // mp-weixin,mp-toutiao 抽象节点模拟 scoped slots ) { // mp-weixin,mp-toutiao 抽象节点模拟 scoped slots
handlerCtx = handlerCtx.$parent.$parent; handlerCtx = handlerCtx.$parent.$parent;
}
if (methodName === '$emit') {
handlerCtx.$emit.apply(handlerCtx,
processEventArgs(
this.$vm,
event,
eventArray[1],
eventArray[2],
isCustom,
methodName
));
return
} }
const handler = handlerCtx[methodName]; const handler = handlerCtx[methodName];
if (!isFn(handler)) { if (!isFn(handler)) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册