Vue v-if
and ref
build error: Property 'value' does not exist on type 'boolean'. Did you mean 'valueOf'?
I've created a simple vue page with the code below: Vue link
however, when building, I've got an error:
I've tried to change "loading.value" to "loading", but the page isn't working, obviously it's not an option.
Also, the type check seems fine if I use "loading.value" in the js block.
It seems there are some magic going on in the "v-if" block. It's supposed to convert
Ref<boolean>
to boolean
automatically.
I use bun
and vite
.
- install bun: powershell -c "irm bun.sh/install.ps1 | iex"
- create project:
bun create vite
. - select Vue+TypeScript.
- run
bun install
. - Replace the code in
App.vue
. - run
bun run dev
to check the web page. - run
bun run build
.