How to call methods such as iview's message or spin in a separate js file

vue project, using iview"s UI
request.js is a simple encapsulation of axios
now you want to display a Loading mask before each network request
before using elementUI, you can write this directly in the js file

import { Loading } from "element-ui";
Loading.service(options);

so you don"t have to rely on vue files
but there seems to be no such method in iview
I don"t know if I didn"t find

.

does anyone have the same need to share the solution

Mar.03,2021

just add the loading component to the vue and control whether it is displayed or not in the js. Using vuex


since it is a vue project, it doesn't matter if you introduce loading and vue into requestjs on demand, just use it. Or you can trigger loading through vuex

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eb1641-4f821.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eb1641-4f821.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?