对大家有帮助的问答会被标记为“推荐”,看完课程过来浏览一下别人提的问题,会帮你学得更全面
关于路由对象,什么时候用router,什么时候用route这个有特别说明吗
为什么我这个include没有效果,反而使keepalive标签也失效了
<keep-alive include="ComponentA">
<component :is="activeComponent"></component>
</keep-alive>
------------------------------------------------------------------
setup () {
const activeComponent = ref('ComponentA')
function changeHandle () {
activeComponent.value = activeComponent.value === 'ComponentA'?'ComponentB':'ComponentA'
}
return {
activeComponent,
changeHandle
}
}
生命周期中的创建期,相应的元素都读取不到,这个时期的钩子函数有什么用?
import { useRouter } from 'vue-router' const router = useRouter() function clickhander() { // 命名路由的使用 router.push({ name: 'home' }) } // 在导航结束之后触发 router.afterEach((to, from) => { console.log(to, from); })
在组件中这样引用行吗