Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: closure issue #658

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions packages/mpvue/index.js
Expand Up @@ -4148,7 +4148,7 @@ Object.defineProperty(Vue$3.prototype, '$ssrContext', {
});

Vue$3.version = '2.4.1';
Vue$3.mpvueVersion = '1.0.12';
Vue$3.mpvueVersion = '1.0.13';

/* globals renderer */

Expand Down Expand Up @@ -5050,22 +5050,22 @@ function normalizeProps$1 (props, res, vm) {
}

// fix vueProps to properties
for (var key$1 in res) {
if (res.hasOwnProperty(key$1)) {
var item = res[key$1];
Object.keys(res).forEach(function (key) {
if (res.hasOwnProperty(key)) {
var item = res[key];
if (item.default) {
item.value = item.default;
}
var oldObserver = item.observer;
item.observer = function (newVal, oldVal) {
vm[name] = newVal;
vm[key] = newVal;
// 先修改值再触发原始的 observer,跟 watch 行为保持一致
if (typeof oldObserver === 'function') {
oldObserver.call(vm, newVal, oldVal);
}
};
}
}
});

return res
}
Expand Down
6 changes: 3 additions & 3 deletions src/platforms/mp/runtime/lifecycle.js
Expand Up @@ -119,22 +119,22 @@ function normalizeProps (props, res, vm) {
}

// fix vueProps to properties
for (const key in res) {
Object.keys(res).forEach(key => {
if (res.hasOwnProperty(key)) {
const item = res[key]
if (item.default) {
item.value = item.default
}
const oldObserver = item.observer
item.observer = function (newVal, oldVal) {
vm[name] = newVal
vm[key] = newVal
// 先修改值再触发原始的 observer,跟 watch 行为保持一致
if (typeof oldObserver === 'function') {
oldObserver.call(vm, newVal, oldVal)
}
}
}
}
})

return res
}
Expand Down
4 changes: 4 additions & 0 deletions yarn.lock
Expand Up @@ -4198,6 +4198,10 @@ preserve@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b"

prettier@^1.11.1:
version "1.13.5"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.13.5.tgz#7ae2076998c8edce79d63834e9b7b09fead6bfd0"

private@^0.1.6:
version "0.1.7"
resolved "https://registry.yarnpkg.com/private/-/private-0.1.7.tgz#68ce5e8a1ef0a23bb570cc28537b5332aba63ef1"
Expand Down