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

fix(v3): mp runtime relations

上级 01222d09
......@@ -12237,7 +12237,10 @@ var serviceContext = (function () {
}
removeVm (vm) {
delete this.vms[vm._$id];
const cid = vm._$id;
// 移除尚未同步的data
this.batchData = this.batchData.filter(data => data[1][0] !== cid);
delete this.vms[cid];
}
addElement (elm) {
......
......@@ -48,10 +48,12 @@ module.exports = function transformFile(input, options) {
const styleCode = transformStyleFile(filepath + styleExtname, options, deps) || ''
const scriptCode = transformScriptFile(filepath + '.js', jsCode, options, deps)
return [
const commentsCode = options.silent ? '' :
`<!-- @dcloudio/uni-migration@${pkg.version} -->
<!-- ${new Date().toLocaleString()} -->
<template>
<!-- ${new Date().toLocaleString()} -->
`
return [
`${commentsCode}<template>
${templateCode}
</template>
${wxsCode}
......
......@@ -220,14 +220,14 @@ const BEHAVIORS = {
const props = mpOptions.properties;
// TODO form submit,reset
if (!props.name) {
if (!hasOwn(props, 'name')) {
props.name = {
type: String
};
}
if (!props.value) {
if (!hasOwn(props, 'value')) {
props.value = {
type: String // 默认类型为 String,否则默认值为 null,导致一些自定义 input 显示不正确
type: String // 默认类型调整为 String,否则默认值为 null,导致一些自定义 input 显示不正确
};
}
}
......@@ -728,8 +728,9 @@ function initMethods (vm) {
vm.triggerEvent(...args);
};
vm.getRelationNodes = (relationKey) => {
// 需要过滤已被销毁的vm
/* eslint-disable no-mixed-operators */
return vm._$relationNodes && vm._$relationNodes[relationKey] || []
return (vm._$relationNodes && vm._$relationNodes[relationKey] || []).filter(vm => !vm._isDestroyed)
};
vm._$updateProperties = updateProperties;
......@@ -766,7 +767,7 @@ var polyfill = {
mounted () {
handleObservers(this);
},
beforeDestroy () {
destroyed () {
handleRelations(this, 'unlinked');
}
};
......
import {
hasOwn
} from 'uni-shared'
import {
parseData
} from './data-parser'
......@@ -54,14 +58,14 @@ const BEHAVIORS = {
const props = mpOptions.properties
// TODO form submit,reset
if (!props.name) {
if (!hasOwn(props, 'name')) {
props.name = {
type: String
}
}
if (!props.value) {
if (!hasOwn(props, 'value')) {
props.value = {
type: String // 默认类型为 String,否则默认值为 null,导致一些自定义 input 显示不正确
type: String // 默认类型调整为 String,否则默认值为 null,导致一些自定义 input 显示不正确
}
}
}
......
......@@ -28,7 +28,7 @@ export default {
mounted () {
handleObservers(this)
},
beforeDestroy () {
destroyed () {
handleRelations(this, 'unlinked')
}
}
......@@ -28,8 +28,9 @@ export function initMethods (vm) {
vm.triggerEvent(...args)
}
vm.getRelationNodes = (relationKey) => {
// 需要过滤已被销毁的vm
/* eslint-disable no-mixed-operators */
return vm._$relationNodes && vm._$relationNodes[relationKey] || []
return (vm._$relationNodes && vm._$relationNodes[relationKey] || []).filter(vm => !vm._isDestroyed)
}
vm._$updateProperties = updateProperties
......
......@@ -137,7 +137,10 @@ export class VDomSync {
}
removeVm (vm) {
delete this.vms[vm._$id]
const cid = vm._$id
// 移除尚未同步的data
this.batchData = this.batchData.filter(data => data[1][0] !== cid)
delete this.vms[cid]
}
addElement (elm) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册