Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Comment on lines +11 to +12

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where is app coming from? I doubt that it is a global variable.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

L5: fix argument Vue -> app

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@morr You need to rename Vue to app on the install function or revert to the previous name.

Suggested change
app.component('toasted', ToastComponent);
app.config.globalProperties.$toasted = Toast;
Vue.component('toasted', ToastComponent);
Vue.config.globalProperties.$toasted = Toast;

}
};

Expand Down
11 changes: 3 additions & 8 deletions types/index.d.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -158,12 +157,8 @@ declare class ToastedPlugin {
static install: PluginFunction<ToastOptions>
}

declare module 'vue/types/vue' {
interface VueConstructor {
toasted: Toasted
}

interface Vue {
declare module '@vue/runtime-core' {
interface ComponentCustomProperties {
$toasted: Toasted
}
}
Expand Down