Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vue.js/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vue-JS材料设计与TypeScript_Typescript_Vue.js_Vue Material - Fatal编程技术网

Vue-JS材料设计与TypeScript

Vue-JS材料设计与TypeScript,typescript,vue.js,vue-material,Typescript,Vue.js,Vue Material,我正在尝试将Vue JS材质设计与TypeScript结合使用,但不支持开箱即用。在GitHub问题之后,我一直在尝试添加一个自定义模块,但没有成功。 我的应用程序是使用vue create My app命令创建的 我在src中创建了一个新文件:types/vue material/index.d.ts: declare module 'vue-material' { import _Vue from "vue"; export function M

我正在尝试将Vue JS材质设计与TypeScript结合使用,但不支持开箱即用。在GitHub问题之后,我一直在尝试添加一个自定义模块,但没有成功。 我的应用程序是使用
vue create My app
命令创建的

我在src中创建了一个新文件:
types/vue material/index.d.ts

declare module 'vue-material' {
    import _Vue from "vue";
    
    export function MdButton(Vue: typeof _Vue, options?: any): void
    export function MdContent(Vue: typeof _Vue, options?: any): void
    export function MdTabs(Vue: typeof _Vue, options?: any): void
}
我添加了类型根并从
tsconfig
中排除了文件夹:

{
  "compilerOptions": {
    // ...
    "typeRoots": [
      "src/types",
      "node_modules/@types"
    ]
  },
  // ...
  "exclude": [
    "node_modules",
    "src/types"
  ]
}
但我在尝试导入
VueMaterial
时仍然遇到错误:

import { MdButton } from 'vue-material';
我做错了什么

Could not find a declaration file for module 'vue-material'. 'C:/.../my-app/node_modules/vue-material/dist/vue-material.js' implicitly has an 'any' type.
  Try `npm install @types/vue-material` if it exists or add a new declaration (.d.ts) file containing `declare module 'vue-material';`