An error is reported when using the iview framework toast component in mpvue

error when using iview framework toast components in mpvue
Module parse failed: Unexpected token (17:8)
You may need an appropriate loader to handle this file type.

page introduces
const {$Toast} = require (".. / static/iview/toast/index");

 handleWarning() {
      $Toast({
        content: "",
        type: "warning"
      });
    },

error details
clipboard.png

Have you solved

? I also encountered


.

you have the wrong path, and this is how I introduced it. Pay attention to base

improt {$Toast} from '../../../../static/iview/base/index'

can you see how you introduce iview components with mpvue? Directly put wxml,wxss, etc., into a folder, and then require


how to solve


here the ES6 syntax is used. You can turn on ES6 to ES5

in the details of Wechat's development tool.
Menu