-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Closed
Labels
Description
- I have searched the issues of this repository and believe that this is not a duplicate.
Version
4.2.6
Environment
vue 3.5.12
Reproduction link
Steps to reproduce
app.vue
<template>
app
<br />
<a-config-provider :locale="zhCN">
<a-app>
<router-view />
</a-app>
</a-config-provider>
</template>
<script setup>
import zhCN from "ant-design-vue/es/locale/zh_CN";
</script>
index.vue
<template>
index
<br />
<a-button @click="addd">点我看提示</a-button>
</template>
<script setup>
import { useGlobalStore } from "./pinia";
const global = useGlobalStore();
console.log(global);
const addd = () => {
console.log(global.message);
console.log(global.message.info("infoa"));
};
</script>
pinia
import { App } from "ant-design-vue";
import { defineStore } from "pinia";
import { ref } from "vue";
export const useGlobalStore = defineStore("global", () => {
const message = ref();
const notification = ref();
const modal = ref();
(() => {
const staticFunction = App.useApp();
message.value = staticFunction.message;
modal.value = staticFunction.modal;
notification.value = staticFunction.notification;
})();
return { message, notification, modal };
});
What is expected?
可以弹出 message 提示
What is actually happening?
global.message.info is not a function
index.vue
14 |
15 | const addd = () => {
16 | console.log(global.message);
> 17 | console.log(global.message.info("infoa"));
| ^
18 | };
19 | </script>
20 |