feat: update tree
parent
8ca8fbd453
commit
f35ae0efae
|
@ -1 +1 @@
|
|||
Subproject commit 7713f7b97f8ce3493094935d5fc1eaaf4ea501aa
|
||||
Subproject commit fe4a4e29aebe7cc1a5bbacf43c2b34671b00c880
|
|
@ -57,7 +57,8 @@ export default {
|
|||
data() {
|
||||
const props = getOptionProps(this);
|
||||
const { defaultExpandAll, defaultExpandParent, expandedKeys, defaultExpandedKeys } = props;
|
||||
const { keyEntities } = convertTreeToEntities(this.$slots.default);
|
||||
const children = getSlot(this);
|
||||
const { keyEntities } = convertTreeToEntities(children);
|
||||
const state = {};
|
||||
// Selected keys
|
||||
state._selectedKeys = props.selectedKeys || props.defaultSelectedKeys || [];
|
||||
|
@ -67,7 +68,7 @@ export default {
|
|||
if (props.treeData) {
|
||||
state._expandedKeys = getFullKeyListByTreeData(props.treeData);
|
||||
} else {
|
||||
state._expandedKeys = getFullKeyList(this.$slots.default);
|
||||
state._expandedKeys = getFullKeyList(children);
|
||||
}
|
||||
} else if (defaultExpandParent) {
|
||||
state._expandedKeys = conductExpandParent(expandedKeys || defaultExpandedKeys, keyEntities);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { getNodeChildren, convertTreeToEntities } from '../vc-tree/src/util';
|
||||
import { getSlots } from '../_util/props-util';
|
||||
import { getSlot } from '../_util/props-util';
|
||||
|
||||
const Record = {
|
||||
None: 'node',
|
||||
|
@ -13,9 +13,9 @@ function traverseNodesKey(rootChildren, callback) {
|
|||
|
||||
function processNode(node) {
|
||||
const { key } = node;
|
||||
const children = getSlots(node);
|
||||
const children = getSlot(node);
|
||||
if (callback(key, node) !== false) {
|
||||
traverseNodesKey(typeof children === 'function' ? children() : children, callback);
|
||||
traverseNodesKey(children, callback);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import PropTypes from '../../_util/vue-types';
|
||||
import classNames from 'classnames';
|
||||
import warning from 'warning';
|
||||
import { hasProp, initDefaultProps, getOptionProps, getSlots } from '../../_util/props-util';
|
||||
import { hasProp, initDefaultProps, getOptionProps, getSlot } from '../../_util/props-util';
|
||||
import { cloneElement } from '../../_util/vnode';
|
||||
import BaseMixin from '../../_util/BaseMixin';
|
||||
import {
|
||||
|
@ -237,7 +237,7 @@ const Tree = {
|
|||
onNodeDragStart(event, node) {
|
||||
const { _expandedKeys } = this.$data;
|
||||
const { eventKey } = node;
|
||||
const children = getSlots(node);
|
||||
const children = getSlot(node);
|
||||
this.dragNode = node;
|
||||
|
||||
this.setState({
|
||||
|
|
|
@ -54,6 +54,7 @@ const TreeNode = {
|
|||
),
|
||||
|
||||
data() {
|
||||
this.children = null;
|
||||
return {
|
||||
dragNodeHighlight: false,
|
||||
};
|
||||
|
@ -241,7 +242,7 @@ const TreeNode = {
|
|||
},
|
||||
|
||||
getNodeChildren() {
|
||||
const originList = getSlot(this);
|
||||
const originList = this.children;
|
||||
const targetList = getNodeChildren(originList);
|
||||
|
||||
if (originList.length !== targetList.length) {
|
||||
|
@ -521,6 +522,7 @@ const TreeNode = {
|
|||
},
|
||||
|
||||
render() {
|
||||
this.children = getSlot(this);
|
||||
const {
|
||||
dragOver,
|
||||
dragOverGapTop,
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import demo from '../antdv-demo/docs/tree/demo/customized-icon';
|
||||
import demo from '../antdv-demo/docs/tree/demo/directory';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
|
|
Loading…
Reference in New Issue