nankai-cms-website-gov/.kit/translated/plugins/global.js
2025-03-13 09:52:18 +08:00

29 lines
823 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// imports
import request from '@/utils/request'
import {getImageURL, getDictLabel, getAttachURL} from '@/utils/util'
/**
* 扩展全局属性,此处封装为方法,方便做框架级调整
*
* @param app 挂载对象
* @param key 属性
* @param value 值
*/
const extendsProperty = (app, key, value) => {
app[key] = value
}
export default defineNuxtPlugin(nuxtApp => {
const app = nuxtApp.vueApp.config.globalProperties
nuxtApp.provide('request', request)
// 去掉警告信息
nuxtApp.vueApp.config.warnHandler = (msg, instance, trace) => {
console.warn('此处忽略WARN内容避免展示大量不必要的WARN信息');
}
// 获取图片地址
app.$getImageURL = getImageURL
// 获取附件地址
app.$getAttachURL = getAttachURL
// 获取字典数据
app.$d = getDictLabel
})