N00ts / vue3-treeview

a simple treeview in vue js 3
MIT License
71 stars 61 forks source link

checkMode auto #45

Closed laurentleb-comnum closed 6 months ago

laurentleb-comnum commented 7 months ago

How checkMode is supposed to work ? On the demo, when checking checkMode auto, it works exactly as I expect. But in my code, adding checkMode: "auto" to the config does not work.

Thanks in advance

N00ts commented 6 months ago

I don't know what is your code, please post some exemple (fiddle / sandbox or other)

soooru commented 6 months ago

Hello, The checkMode property accepts the values 0 or 1 instead of 'manual' and 'auto' in example code

code sandbox ( it's yours ... ) : https://codesandbox.io/p/sandbox/configuration-umz56?file=%2Fsrc%2FApp.vue%3A115%2C29-115%2C37&from-embed=

When using 0 and 1, the following error message appears in the console: "Computed is still dirty after getter evaluation, likely because a computed is mutating its own dependency in its getter. State mutations in computed getters should be avoided."

When using 'auto', it doesn't work as I intended, but when using '0' and '1', it behaves as desired.

N00ts commented 6 months ago

Yeah that is because it is an enum :)

BenHeath0 commented 6 months ago

can you update the documentation to include this? Im also unable to figure out get checkMode: auto working. My code is:


<tree :nodes="layers" :config="config"></tree>
...

computed: {
  config() {
            return {
                roots: this.layerRoots,
                checkboxes: true,
                checkMode: 'auto',
            }
        }
}
...