import { Connect } from "dob-react" import * as React from "react" import * as Styled from "./index.style" import * as typings from "./index.type" @Connect class Crumbs extends React.Component { public static defaultProps = new typings.Props() public state = new typings.State() public render() { let childs: Array> if (this.props.stores.ViewportStore.currentEditInstanceKey) { // 递归寻找这个组件父元素 childs = this.props.actions.ViewportAction.getInstancePath(this.props.stores.ViewportStore.currentEditInstanceKey).map((instanceKey, index) => { const instance = this.props.stores.ViewportStore.instances.get(instanceKey) const componentClass = this.props.actions.ApplicationAction.getComponentClassByKey(instance.gaeaKey) const setting = this.props.actions.ApplicationAction.getSettingByInstance(instance) return ( {setting.name} ) }) } return ( {childs} ) } private handleClick(instanceKey: string) { this.props.actions.ViewportAction.setCurrentEditInstanceKey(instanceKey) } private handleHover(instanceKey: string) { this.props.actions.ViewportAction.setCurrentHoverInstanceKey(instanceKey) } private handleMouseLeave = () => { this.props.actions.ViewportAction.setCurrentHoverInstanceKey(null) } } export default { position: "bottomBar", class: Crumbs }