v-if Object.keys causes repeated calls to onBeforeMount
Vue version
3.0.0
Link to minimal reproduction
1
Steps to reproduce
page
v-if="Object.keys(data.pipelineData.status).length!==0"
onBeforeMount(() => {
console.log(111)
})
What is expected?
Method is called only once
What is actually happening?
google chrome 107.0.5304.121(正式版本) (64 位)
console.log(111) Output multiple times
System Info
System:
OS: Windows Server 2016 10.0.14393
CPU: (32) ia32 Intel(R) Xeon(R) CPU E5-2640 v3 @ 2.60GHz
Memory: 54.39 GB / 64.00 GB
Binaries:
Node: 12.20.0 - C:\Program Files (x86)\nodejs\node.EXE
npm: 6.14.8 - C:\Program Files (x86)\nodejs\npm.CMD
Browsers:
Internet Explorer: 11.0.14393.2007
npmPackages:
vue: ^3.0.0 => 3.1.5
Any additional comments?
No response
This is expected behavior: any function in the template will get called when the component updates.
Please, next time consider using the forum, the Discord server or StackOverflow for questions first. But feel free to come back and open an issue if it turns out to be a bug 🙂