cx690 / element-ui-cover

A libaray for element-ui types,use it can transfer element-ui class properties to vue2.7 defineComponent's propsType.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

  • 中文说明
  • Use this types library,Youe can get correct type derivation when use element-ui,it can cover element-ui's types export.

install

yarn add element-ui-cover --dev

tsconfig

Add below config in your tsconfig.json.

{ 
 "compilerOptions": {
    "types": [
      "element-ui-cover"
    ], 
  },
  ...others,
}

result view

for template (with vscode plugin Volar)

tsconfig.json add config as below:

{ 
 "vueCompilerOptions": {
    "target": 2.7
  },
  "compilerOptions": {
      "types": [
      "element-ui-cover"
      ]
  },
  ...others,
}

template view

for global components (with vscode plugin Volar)

If element-ui components is registered as global components, set config as below:

  • Add types in tsconfig.json
{ 
  "vueCompilerOptions": {
    "target": 2.7
  },
 "compilerOptions": {
    "types": [
      "element-ui-cover",
      "element-ui-cover/component.g.d.ts"
    ], 
  },
  ...others,
}

Then it will work: global components view global components option view

Some events is also supported. events view

for tsx

  • The @vue/babel-preset-jsx transition property scopedSlots to slots,so the slots use scopedSlots (but the Volar use $scopedSlots,this is a problem); tsx view slots view

type error

type error view

ref get instance type

instance type view

peerDependencies

vue and element-ui is required.

  • vue version ^2.7.0
  • element-ui version ^2.0.0 (^2.15.0 is better)

About

A libaray for element-ui types,use it can transfer element-ui class properties to vue2.7 defineComponent's propsType.


Languages

Language:Vue 67.9%Language:TypeScript 32.1%