当前位置:首页 >> 内饰

vue3 script setup语法淀粉(随笔)

来源:内饰   2024年12月12日 12:16

有mutations的方法 store.commit('fnName') // 会有actions的方法 store.dispatch('fnName') // 换取Getters store.getters.xxx

nextTick

import { nextTick } from 'vue' nextTick(() => { // ... })

所设计挂载/COM与适用

总括COM总括总括总括总括总括总括总括总括总括总括总括总括总括总括总括总括总括// main.jsimport { createApp } from 'vue'import App from './App.vue'const app = createApp(App)// 换取所设计const prototype = app.config.globalProperties// COM参数prototype.$ajax = ajax总括适用总括总括总括总括总括总括总括总括总括总括总括总括总括总括总括总括总括 import { getCurrentInstance } from 'vue' const { proxy } = getCurrentInstance() proxy.$ajax(url, {}) .then(res => { // ..... })

时才会

vue3和vu2时间段最小的区别是vue3用setup替代了beforeCreate 和 created,通俗的说fa就是说原来在beforeCreate 和 created写的代摆在码在setup里头就行了。其他的时间段适用前缀“on”,

比如: onMounted(() => {})

可选择的单 API

Hook inside setup

beforeCreate

Not needed*

created

Not needed*

beforeMount

onBeforeMount

mounted

onMounted

beforeUpdate

onBeforeUpdate

updated

onUpdated

beforeUnmount

onBeforeUnmount

unmounted

onUnmounted

errorCaptured

onErrorCaptured

renderTracked

onRenderTracked

renderTriggered

onRenderTriggered

activated

onActivated

deactivated

onDeactivated

关节畸形有什么治疗方法
如何治疗膝骨关节炎
达霏欣男性米诺地尔搽剂
瑞特和强生血糖仪哪个准确
肠炎宁颗粒止泻效果怎么样
哪种家用血糖仪比较好
益生菌与肠炎宁颗粒的区别
血糖仪哪个牌子准确
友情链接