0
我试图在的jsfiddle的toastr图书馆工作,但我不断收到此错误:未捕获的SyntaxError:意外的令牌进口意外令牌进口 - 的jsfiddle
这是我的jsfiddle:https://jsfiddle.net/50wL7mdz/77255/
这是我的代码:
import VueToastr from '@deveodk/vue-toastr';
Vue.use(VueToastr, {
defaultPosition: 'toast-bottom-left',
defaultType: 'info',
defaultTimeout: 1000
});
new Vue({
el: '#app',
data: {
},
created(){
this.$toastr('success', 'it works!', 'Yeahh');
},
methods: {
}
})
,这是图书馆参考:https://github.com/Deveodk/vue-toastr
是否进口关键字不行我n jsfiddle?
由于它的工作。你能解释为什么你改变我的行'this。$ toastr('success','it works!','Yeahh');'成功的方法吗? 'toastr.success('Message','Title');'为什么我的代码不能运行'this。$ toastr('success','It works!','Yeahh');' –
Read这里的文档https://www.npmjs.com/package/vue-toastr-2。和参数 – Sajeetharan
但是这里https://github.com/Deveodk/vue-toastr这个代码给出了'this。$ toastr('success','它工作!','Yeahh')'它只会在导入时才起作用已启用? –