changes
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
// nuxt 3 - plugins/my-plugin.ts
|
||||
import { useRoute } from "vue-router";
|
||||
import { useStore } from "~/stores/index";
|
||||
import dayjs from "dayjs";
|
||||
import weekday from "dayjs/plugin/weekday";
|
||||
import weekOfYear from "dayjs/plugin/weekOfYear";
|
||||
@@ -17,10 +15,9 @@ dayjs.extend(isSameOrBefore);
|
||||
dayjs.extend(isSameOrAfter);
|
||||
dayjs.locale("vi");
|
||||
|
||||
export default defineNuxtPlugin(() => {
|
||||
export default defineNuxtPlugin((nuxtApp) => {
|
||||
const route = useRoute();
|
||||
const { $id, $empty } = useNuxtApp();
|
||||
const store = useStore();
|
||||
const { $id, $empty, $store } = nuxtApp;
|
||||
const dialog = function (content, title, type, duration, width, height, vbind) {
|
||||
content = typeof content === "string" ? content : JSON.stringify(content);
|
||||
let vtitle = type === "Success" ? `<span class="has-text-primary">${title}</span>` : title;
|
||||
@@ -33,7 +30,7 @@ export default defineNuxtPlugin(() => {
|
||||
width: width || "600px",
|
||||
height: height || "100px",
|
||||
};
|
||||
store.commit("showmodal", data);
|
||||
$store.commit("showmodal", data);
|
||||
};
|
||||
|
||||
const snackbar = function (content, title, type, width, height) {
|
||||
@@ -48,7 +45,7 @@ export default defineNuxtPlugin(() => {
|
||||
width: width || "600px",
|
||||
height: height || "100px",
|
||||
};
|
||||
store.commit("snackbar", data);
|
||||
$store.commit("snackbar", data);
|
||||
};
|
||||
|
||||
const getLink = function (val) {
|
||||
@@ -379,8 +376,8 @@ export default defineNuxtPlugin(() => {
|
||||
};
|
||||
|
||||
const lang = function (code) {
|
||||
let field = store.common.find((v) => v.code === code);
|
||||
return field ? field[store.lang] : "";
|
||||
let field = $store.common.find((v) => v.code === code);
|
||||
return field ? field[$store.lang] : "";
|
||||
};
|
||||
|
||||
const createMeta = function (metainfo) {
|
||||
|
||||
Reference in New Issue
Block a user