wuyoushe / wwkblog

吴伟康的个人博客

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

work record;

Ts

1.全局挂载 方法

--- vue2 : 在Vue.prototype中挂载 然后在组件的this 中调用
--- vue3 : 1. 挂载 app = create(); 2: app.config.globalProperties  在这里面挂载
            2. 使用 方式一 全局挂载的变量 使用 import { getCurrentInstance , ComponentInternalInstance} from "vue"
                    const { proxy }: any = getCurrentInstance()
                    console.log("proxy", proxy.$DateFormat());
                    const { appContext: { config: { globalProperties } } } = getCurrentInstance() as ComponentInternalInstance;

2. * 未知属性 判断类型方式

    * @type:1
    * let obj: { [key:string]:any }= {}
    * @type: 2
    * let obj: Record<string,any>= {}

About

吴伟康的个人博客


Languages

Language:Vue 69.0%Language:Less 17.8%Language:TypeScript 11.1%Language:CSS 1.8%Language:HTML 0.4%