Uncaught TypeError: Vue.use is not a function

Uncaught TypeError: Vue.use is not a function

我对 VueJS 比较陌生,现在我正在尝试替换

 <script src="https://cdn.jsdelivr.net/npm/vue@2.6/dist/vue.min.js"></script>

来自

<script src="https://unpkg.com/vue@next"></script>

问题是之前的工作代码在这次更改后被破坏了:

<script>
    window.addEventListener('load', () => {
        const defaultOptions = {
            position: 'bottom-center'
        }
        Vue.use(Toasted, defaultOptions) # The error arises here
    });

</script>

我运行喜欢

Uncaught TypeError: Vue.use is not a function

我做错了什么?

更新: 我暂时没有使用 webpack。没有 webpack 可以做到吗?

@next 指的是具有不同语法的 vue 3,假设 Toasted 插件与 vue 3 兼容,你应该这样做:

<script>
    window.addEventListener('load', () => {
        const defaultOptions = {
            position: 'bottom-center'
        }
        Vue.createApp({}).use(Toasted, defaultOptions) 
    });

</script>