build: switch from yarn to npm to manage js dependencies and move js contents to root
yarn v1 is being deprecated and starts to have some issues Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
53
src/plugins/snackbar.ts
Normal file
53
src/plugins/snackbar.ts
Normal file
@@ -0,0 +1,53 @@
|
||||
import SnackbarComponent from "@/components/core/CustomSnackbar.vue";
|
||||
import { App } from "vue";
|
||||
|
||||
export class Snackbar {
|
||||
private app: App;
|
||||
|
||||
constructor(app: App) {
|
||||
this.app = app;
|
||||
}
|
||||
|
||||
open({
|
||||
message,
|
||||
variant,
|
||||
position,
|
||||
actionText,
|
||||
cancelText,
|
||||
onAction,
|
||||
}: {
|
||||
message?: string;
|
||||
queue?: boolean;
|
||||
indefinite?: boolean;
|
||||
variant?: string;
|
||||
position?: string;
|
||||
actionText?: string;
|
||||
cancelText?: string;
|
||||
onAction?: () => any;
|
||||
}) {
|
||||
this.app.config.globalProperties.$oruga.notification.open({
|
||||
component: SnackbarComponent,
|
||||
props: {
|
||||
message,
|
||||
// queue,
|
||||
// indefinite,
|
||||
actionText,
|
||||
cancelText,
|
||||
onAction,
|
||||
position: position ?? "bottom-right",
|
||||
variant: variant ?? "dark",
|
||||
},
|
||||
position: position ?? "bottom-right",
|
||||
variant: variant ?? "dark",
|
||||
duration: 5000000,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export const snackbarPlugin = {
|
||||
install(app: App) {
|
||||
const snackbar = new Snackbar(app);
|
||||
app.config.globalProperties.$snackbar = snackbar;
|
||||
app.provide("snackbar", snackbar);
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user