\src\api\system\dict目录下
import request from '@/utils/request'
// 根据字典类型查询字典数据信息
export function getDicts(dictType) {
return request({
url: '/system/dict/data/type/' + dictType,
method: 'get'
})
}
main.js全局注册
import { getDicts } from "@/api/system/dict/data";
Vue.prototype.getDicts = getDicts
在要使用的组件去写入方法以及 字典值
this.getDicts("apk_package_type").then((response) => {
console.log(response.data);
});