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

fix(h5): wxs

上级 9ec2a554
...@@ -189,14 +189,13 @@ function createComponentDescriptor( ...@@ -189,14 +189,13 @@ function createComponentDescriptor(
vm: ComponentPublicInstance, vm: ComponentPublicInstance,
isOwnerInstance = true isOwnerInstance = true
) { ) {
if ( if (isOwnerInstance && vm) {
isOwnerInstance && let componentName = vm.$options && vm.$options.name
vm && while (componentName && isBuiltInComponent(hyphenate(componentName))) {
vm.$options.name && // ownerInstance 内置组件需要使用父 vm
isBuiltInComponent(hyphenate(vm.$options.name)) vm = vm.$parent!
) { componentName = vm.$options && vm.$options.name
// ownerInstance 内置组件需要使用父 vm }
vm = vm.$parent!
} }
if (vm && vm.$el) { if (vm && vm.$el) {
if (!vm.$el.__wxsComponentDescriptor) { if (!vm.$el.__wxsComponentDescriptor) {
......
...@@ -9146,8 +9146,9 @@ function patchWxs(el, rawName, nextValue, instance = null) { ...@@ -9146,8 +9146,9 @@ function patchWxs(el, rawName, nextValue, instance = null) {
const proxy = instance.proxy; const proxy = instance.proxy;
const name = rawName.split(':')[1]; const name = rawName.split(':')[1];
el.__wxsWatches[rawName] = proxy.$watch(() => instance.attrs[name], (value, oldValue) => { el.__wxsWatches[rawName] = proxy.$watch(() => instance.attrs[name], (value, oldValue) => {
// TODO ownerInstance,instance nextTick(() => {
nextValue(value, oldValue, proxy.$gcd(proxy, true), proxy.$gcd(proxy, true)); nextValue(value, oldValue, proxy.$gcd(proxy, true), proxy.$gcd(proxy, false));
});
}, { }, {
deep: true deep: true
}); });
......
...@@ -11014,8 +11014,9 @@ function patchWxs(el, rawName, nextValue, instance = null) { ...@@ -11014,8 +11014,9 @@ function patchWxs(el, rawName, nextValue, instance = null) {
const proxy = instance.proxy; const proxy = instance.proxy;
const name = rawName.split(':')[1]; const name = rawName.split(':')[1];
el.__wxsWatches[rawName] = proxy.$watch(() => instance.attrs[name], (value, oldValue) => { el.__wxsWatches[rawName] = proxy.$watch(() => instance.attrs[name], (value, oldValue) => {
// TODO ownerInstance,instance nextTick(() => {
nextValue(value, oldValue, proxy.$gcd(proxy, true), proxy.$gcd(proxy, true)); nextValue(value, oldValue, proxy.$gcd(proxy, true), proxy.$gcd(proxy, false));
});
}, { }, {
deep: true deep: true
}); });
......
...@@ -11070,8 +11070,9 @@ function patchWxs(el, rawName, nextValue, instance = null) { ...@@ -11070,8 +11070,9 @@ function patchWxs(el, rawName, nextValue, instance = null) {
const proxy = instance.proxy; const proxy = instance.proxy;
const name = rawName.split(':')[1]; const name = rawName.split(':')[1];
el.__wxsWatches[rawName] = proxy.$watch(() => instance.attrs[name], (value, oldValue) => { el.__wxsWatches[rawName] = proxy.$watch(() => instance.attrs[name], (value, oldValue) => {
// TODO ownerInstance,instance nextTick(() => {
nextValue(value, oldValue, proxy.$gcd(proxy, true), proxy.$gcd(proxy, true)); nextValue(value, oldValue, proxy.$gcd(proxy, true), proxy.$gcd(proxy, false));
});
}, { }, {
deep: true deep: true
}); });
......
...@@ -9198,8 +9198,9 @@ function patchWxs(el, rawName, nextValue, instance = null) { ...@@ -9198,8 +9198,9 @@ function patchWxs(el, rawName, nextValue, instance = null) {
const proxy = instance.proxy; const proxy = instance.proxy;
const name = rawName.split(':')[1]; const name = rawName.split(':')[1];
el.__wxsWatches[rawName] = proxy.$watch(() => instance.attrs[name], (value, oldValue) => { el.__wxsWatches[rawName] = proxy.$watch(() => instance.attrs[name], (value, oldValue) => {
// TODO ownerInstance,instance nextTick(() => {
nextValue(value, oldValue, proxy.$gcd(proxy, true), proxy.$gcd(proxy, true)); nextValue(value, oldValue, proxy.$gcd(proxy, true), proxy.$gcd(proxy, false));
});
}, { }, {
deep: true deep: true
}); });
......
...@@ -1323,8 +1323,12 @@ class ComponentDescriptor { ...@@ -1323,8 +1323,12 @@ class ComponentDescriptor {
} }
} }
function createComponentDescriptor(vm, isOwnerInstance = true) { function createComponentDescriptor(vm, isOwnerInstance = true) {
if (isOwnerInstance && vm && vm.$options.name && isBuiltInComponent(hyphenate(vm.$options.name))) { if (isOwnerInstance && vm) {
vm = vm.$parent; let componentName = vm.$options && vm.$options.name;
while (componentName && isBuiltInComponent(hyphenate(componentName))) {
vm = vm.$parent;
componentName = vm.$options && vm.$options.name;
}
} }
if (vm && vm.$el) { if (vm && vm.$el) {
if (!vm.$el.__wxsComponentDescriptor) { if (!vm.$el.__wxsComponentDescriptor) {
......
...@@ -55,9 +55,9 @@ export function uniPreVuePlugin(): Plugin { ...@@ -55,9 +55,9 @@ export function uniPreVuePlugin(): Plugin {
if (hasWxs) { if (hasWxs) {
code = normalizeWxsCode(ast, code) code = normalizeWxsCode(ast, code)
} }
if (errors.length) { // if (errors.length) {
this.error(errors.join('\n')) // this.error(errors.join('\n'))
} // }
sourceToSFC.set(sourceKey, code) sourceToSFC.set(sourceKey, code)
return code // 暂不提供sourcemap,意义不大 return code // 暂不提供sourcemap,意义不大
}, },
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册