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,
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue