mirror of
https://github.com/siyuan-note/plugin-sample-vite-svelte.git
synced 2025-06-07 18:46:01 +00:00
commit
2c45caf80f
2 changed files with 7 additions and 9 deletions
|
@ -246,11 +246,9 @@ export default class PluginSample extends Plugin {
|
|||
step: 1,
|
||||
},
|
||||
action:{
|
||||
// The callback is called after the action of Silder changes,
|
||||
// so it should be the this.settingUtils.get() method.
|
||||
callback: () => {
|
||||
// Read data in real time
|
||||
let value = this.settingUtils.get("Slider")
|
||||
let value = this.settingUtils.take("Slider")
|
||||
console.log(value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -80,12 +80,12 @@ export class SettingUtils {
|
|||
* @returns value in html
|
||||
*/
|
||||
take(key: string) {
|
||||
let item = this.getElement(key)
|
||||
this.settings.set(key, item)
|
||||
if (item.type === 'button') {
|
||||
return item.value
|
||||
let element = this.elements.get(key) as any;
|
||||
if (!element){
|
||||
return
|
||||
}
|
||||
return item.value
|
||||
this.settings.set(key, element.value)
|
||||
return element.value
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue