admin管理员组文章数量:1398806
I'm trying to register global filter in Vue3
but it raises this error:
main.js?56d7:13 Uncaught TypeError: Cannot read property 'globalProperties' of undefined
According to the Use filter in Vue3 but can't read globalProperties it should work.
import { createApp } from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";
import "./assets/tailwind.css";
import axiosSetUp from "@/auth/axiosSetUp";
import {formatIsoDateTime as utils_formatIsoDateTime} from "@/utils";
axiosSetUp()
const app = createApp(App).use(store).use(router).mount("#app");
app.config.globalProperties.$filters = {
formatIsoDateTime(isoString) {
return utils_formatIsoDateTime(isoString)
}
}
Do you know where the problem is?
I'm trying to register global filter in Vue3
but it raises this error:
main.js?56d7:13 Uncaught TypeError: Cannot read property 'globalProperties' of undefined
According to the Use filter in Vue3 but can't read globalProperties it should work.
import { createApp } from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";
import "./assets/tailwind.css";
import axiosSetUp from "@/auth/axiosSetUp";
import {formatIsoDateTime as utils_formatIsoDateTime} from "@/utils";
axiosSetUp()
const app = createApp(App).use(store).use(router).mount("#app");
app.config.globalProperties.$filters = {
formatIsoDateTime(isoString) {
return utils_formatIsoDateTime(isoString)
}
}
Do you know where the problem is?
Share Improve this question asked Jun 25, 2021 at 14:50 MilanoMilano 18.8k47 gold badges172 silver badges386 bronze badges 2-
1
I was just answering the Docker question! Essentially, you have a SQL injection situation because
(
,!
and)
have special meaning in an ODBC connection string. – Panagiotis Kanavos Commented Jul 8, 2021 at 12:40 - @PanagiotisKanavos Oh, thank you. I used the SQLAlchemy and it worked so I've deleted it and I can't find the URL so I can't undelete it. – Milano Commented Jul 8, 2021 at 13:40
1 Answer
Reset to default 7You should separate the root instance from the root ponent :
const app = createApp(App).use(store).use(router);
//use the root instance to add your config
app.config.globalProperties.$filters = {
formatIsoDateTime(isoString) {
return utils_formatIsoDateTime(isoString)
}
}
// then you could mount it
app.mount("#app")
版权声明:本文标题:javascript - app.config.globalProperties - Cannot read property 'globalProperties' of undefined - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744088521a2588987.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论