Subscribe on changes!

defineModal default can't use const value

avatar
Jan 12th 2024

This is expected because the options for defineModel is used as the props options and will be moved outside of setup scope. Similar to the options in defineProps and defineOptions.

Note if the constant is a primitive value that can be safely hoisted out, this will work; however, your constant value is an object that may be mutated, so it cannot be hoisted out and therefore cannot be referenced.