创建一个全局方法 app.config.globalProperties.$dateFormat=(date:string)=>{ if(!date)return'' returnnewDate(date).toLocaleString('zh-CN') } 创建一个文件,用于调用公共方法 import{ComponentInternalInstance,getCurrentInstance}from'vue' exportconstuseCurrentInstance=()=>{ const{appContext}=getCurrentInstance()asCompon...