Merge pull request #30 from tengfei-xy/main

修改take()方法的获取方式
This commit is contained in:
Frostime 2024-04-25 21:31:11 +08:00 committed by GitHub
commit 2c45caf80f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 9 deletions

View file

@ -246,11 +246,9 @@ export default class PluginSample extends Plugin {
step: 1, step: 1,
}, },
action:{ action:{
// The callback is called after the action of Silder changes,
// so it should be the this.settingUtils.get() method.
callback: () => { callback: () => {
// Read data in real time // Read data in real time
let value = this.settingUtils.get("Slider") let value = this.settingUtils.take("Slider")
console.log(value); console.log(value);
} }
} }

View file

@ -80,12 +80,12 @@ export class SettingUtils {
* @returns value in html * @returns value in html
*/ */
take(key: string) { take(key: string) {
let item = this.getElement(key) let element = this.elements.get(key) as any;
this.settings.set(key, item) if (!element){
if (item.type === 'button') { return
return item.value
} }
return item.value this.settings.set(key, element.value)
return element.value
} }
/** /**