From afe6cc56eb9cf12636a3bef48392de6ebcfca3c3 Mon Sep 17 00:00:00 2001 From: Andrey Sidorov Date: Tue, 13 Jul 2021 08:03:52 +0300 Subject: [PATCH] vue 3 support --- src/index.js | 4 ++-- types/index.d.ts | 11 +++-------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/index.js b/src/index.js index 480d21c..7ac556a 100644 --- a/src/index.js +++ b/src/index.js @@ -8,8 +8,8 @@ const Toasted = { } const Toast = new T(options); - Vue.component('toasted', ToastComponent); - Vue.toasted = Vue.prototype.$toasted = Toast; + app.component('toasted', ToastComponent); + app.config.globalProperties.$toasted = Toast; } }; diff --git a/types/index.d.ts b/types/index.d.ts index 14d43cb..add5424 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -1,5 +1,4 @@ -import { Vue, VueConstructor } from 'vue/types/vue' -import { PluginFunction } from "vue" +import { App, PluginFunction } from 'vue'; export interface ToastObject { // html element of the toast @@ -158,12 +157,8 @@ declare class ToastedPlugin { static install: PluginFunction } -declare module 'vue/types/vue' { - interface VueConstructor { - toasted: Toasted - } - - interface Vue { +declare module '@vue/runtime-core' { + interface ComponentCustomProperties { $toasted: Toasted } }