我在main的js中將vant組件全部加載的
import 'view-design/dist/styles/iview.css';
import Vant from 'vant';
import 'vant/lib/index.css';
Vue.use(Vant);
然后在組件中調用時
Toast.時報
Error in created hook: "ReferenceError: Toast is not defined"
this.$toast出來的提示框長得我是看不出來區別,仔細研究一下,在組件內 import { Toast } from 'vant'就行了,完整示例如下
對對對
<template> <div> </div> </template> <script> import { Toast } from 'vant' export default { data() { return {} }, created() { // this.$toast({ // type:'loading', // message: '更新aa成功', // }); Toast.fail('失敗文案'); }, }; </script> <style> </style>
單獨
