mirror of
https://github.com/unanmed/HumanBreak.git
synced 2026-11-27 12:24:30 +08:00
feat: 自定义设置值修改组件
This commit is contained in:
1 parent
4796334ec4
commit
8fc7e03c97
3 files changed
+12
-47
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import { reactive } from 'vue';
|
||||
import { Component, reactive } from 'vue';
|
||||
import { EmitableEvent, EventEmitter } from '../common/eventEmitter';
|
||||
import { loading } from '../loader/load';
|
||||
import { hook } from './game';
|
||||
@@ -14,6 +14,7 @@ export interface MotaSettingItem<T extends MotaSettingType = MotaSettingType> {
|
||||
defaults?: boolean | number;
|
||||
step?: [number, number, number];
|
||||
display?: (value: T) => string;
|
||||
controller?: Component;
|
||||
special?: string;
|
||||
}
|
||||
|
||||
@@ -147,6 +148,12 @@ export class MotaSetting extends EventEmitter<SettingEvent> {
|
||||
return this;
|
||||
}
|
||||
|
||||
setValueController(key: string, com: Component) {
|
||||
const setting = this.getSettingBy(key.split('.'));
|
||||
setting.controller = com;
|
||||
return this;
|
||||
}
|
||||
|
||||
private getSettingBy(list: string[]) {
|
||||
let now: MotaSetting = this;
|
||||
|
||||
|
||||
Reference in new issue
Block a user