2017-11-18 18 views
0

jsfiddle : catch되지 않은 구문 에러 : 이것은 내 코드 https://jsfiddle.net/50wL7mdz/77255/예기치 않은 토큰 수입 - 나는 jsfiddle에서 toastr 라이브러리 작업을하려고하지만이 오류가 계속

입니다 : 예기치 않은 토큰 수입

이 내 jsfiddle입니다 :

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

가져 오기 키워드 난을 작동하지 않습니다 njsfiddle?

답변

1

JSFIDDLE에서 가져 오기가 작동하지 않습니다. 패키지를 설치하고 지원되지 않는 가져 오기를 사용하여 참조해야합니다. 대신 당신은

당신은 외부 URL을 사용하여 라이브러리를 참조 할 수 있습니다, 그것은 일

https://unpkg.com/[email protected]/dist/vue-toastr-2.js 
https://unpkg.com/vue-toastr-2/dist/vue-toastr-2.min.css 

DEMO

+0

덕분에이 작업을 수행 할 수 있습니다. 왜 당신이 내 라인'을 변경했는지 설명해 주시겠습니까? $ toastr ('성공', '작동!', '예'),'성공 방법? 'toastr.success ('Message', 'Title'); 그리고 왜 내 코드가'this '에 대해 작동하지 않는지 $ toastr ('성공 ','작동한다! ','예 '),' –

+0

읽기 설명서는 https://www.npmjs.com/package/vue-toastr-2에 있습니다. 그리고 aprameters – Sajeetharan

+0

하지만 여기 https://github.com/Deveodk/vue-toastr이 코드는'this. $ toastr ('success', 'it works!', 'Yeahh')'이 주어 졌을 때, 사용 가능? –