首先,来个笑话:

在Vue2中,我可以使用this.$route.path

在Vue3中,我可以使用useRouter()

但在 Vue2.7 组合 api 中,这两个我都不能使用。

获取this

1
getCurrentInstance().proxy.$route

$refs

1
2
3
const useShareBox = ref(null)

<shareBox ref="useShareBox"></shareBox>

$route

1
2
3
4
5
6
```



## $store

const store = new Vuex.Store({ …options })
export default store;
export const useStore = () => store

setup() {
const store = useStore();
// …
}




## 问题

#### slot 插槽不渲染

Q: 因为本地依赖项升级 [email protected],线上CDN是 2.6.X 低版本。

A: 对齐线上、本地依赖项版本。