feat: add visible
This commit is contained in:
@@ -50,6 +50,15 @@ const ContextMenu = () => {
|
||||
>
|
||||
<Button>自定义</Button>
|
||||
</div>
|
||||
<div
|
||||
style={{ width: '100%' }}
|
||||
onClick={() => {
|
||||
commander.exec('hide');
|
||||
handleclick();
|
||||
}}
|
||||
>
|
||||
<Button style={{ width: '100%' }}>隐藏</Button>
|
||||
</div>
|
||||
<div
|
||||
style={{ width: '100%' }}
|
||||
onClick={() => {
|
||||
|
20
packages/dooringx-example/src/plugin/commands/hide.ts
Normal file
20
packages/dooringx-example/src/plugin/commands/hide.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import deepcopy from 'deepcopy';
|
||||
import { CommanderItemFactory } from 'dooringx-lib';
|
||||
import { IStoreData } from 'dooringx-lib/dist/core/store/storetype';
|
||||
|
||||
const hide = new CommanderItemFactory(
|
||||
'hide',
|
||||
'',
|
||||
(store) => {
|
||||
const clonedata: IStoreData = deepcopy(store.getData());
|
||||
clonedata.block.forEach((v) => {
|
||||
if (v.focus) {
|
||||
v.canSee = false;
|
||||
}
|
||||
});
|
||||
store.setData(clonedata);
|
||||
},
|
||||
'隐藏'
|
||||
);
|
||||
|
||||
export default hide;
|
Reference in New Issue
Block a user