fix: 右侧配置面板面包屑点击无效

This commit is contained in:
mario.gk 2020-07-13 21:20:43 +08:00
parent 00c28dde6f
commit 353fb10e21

View File

@ -42,22 +42,26 @@ export class SettingsPrimaryPane extends Component<{ editor: Editor }> {
const items = []; const items = [];
let l = 3; let l = 3;
while (l-- > 0 && node) { while (l-- > 0 && node) {
const _node = node;
const props = const props =
l === 2 l === 2
? {} ? {}
: { : {
onMouseOver: hoverNode.bind(null, node, true), onMouseOver: hoverNode.bind(null, _node, true),
onMouseOut: hoverNode.bind(null, node, false), onMouseOut: hoverNode.bind(null, _node, false),
onClick: () => { onClick: () => {
selectNode.call(null, node); if (!_node) {
const getName = (node) => { return;
}
selectNode.call(null, _node);
const getName = (node: any) => {
const npm = node?.componentMeta?.npm; const npm = node?.componentMeta?.npm;
return [npm?.package, npm?.componentName].filter((item) => !!item).join('-') || return [npm?.package, npm?.componentName].filter((item) => !!item).join('-') ||
node?.componentMeta?.componentName || node?.componentMeta?.componentName ||
''; '';
}; };
const selected = getName(current); const selected = getName(current);
const target = getName(node); const target = getName(_node);
editor?.emit('skeleton.settingsPane.Breadcrumb', { editor?.emit('skeleton.settingsPane.Breadcrumb', {
selected, selected,
target, target,