我在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>

 

 

单独

相关文章:

  • 2021-12-17
  • 2021-11-24
  • 2021-09-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-08
猜你喜欢
  • 2022-01-01
  • 2022-12-23
  • 2022-12-23
  • 2022-01-08
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案