Vue——vue3中setup、data、beforeCreate、created的响应顺序
Vue——vue3中setup、data、beforeCreate、created的响应顺序
·
按渲染排序是:
setup
beforeCreate
data
created
<script>
import { ref, reactive, toRefs } from 'vue'
export default {
name: 'App',
data () {
console.log('data');
return {
}
},
methods: {
},
setup () {
console.log('setup')
},
beforeCreate () { console.log('beforeCreate:数据初始化之前'); },
created () { console.log('created:数字初始化之后'); },
}
</script>
打印顺序是:
setup
beforeCreate:数据初始化之前
data
created:数字初始化之后
更多推荐
已为社区贡献12条内容
所有评论(0)