webstorm 提示找不到 element-plus 但可正常使用?

新手上路,请多包涵

这是我的使用场景, 使用效果无影响

<template>
  <div class="about">
    <h1>This is an about page</h1>
    <el-button>默认按钮</el-button>
    <el-button type="primary">主要按钮</el-button>
    <el-button type="success">成功按钮</el-button>
    <el-button type="info">信息按钮</el-button>
    <el-button type="warning">警告按钮</el-button>
    <el-button type="danger">危险按钮</el-button>
  </div>
</template>

<script lang="ts">
import { defineComponent } from "vue";
import { ElButton } from "element-plus";

export default defineComponent({
  name: "app",
  components: {
    ElButton
  }
});
</script>

引用报错

package.json

  "name": "vue3-ts-cms",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint",
    "prettier": "prettier --write .",
    "prepare": "husky install",
    "commit": "cz"
  },
  "dependencies": {
    "axios": "^0.21.1",
    "core-js": "^3.6.5",
    "element-plus": "^1.1.0-beta.11",
    "normalize.css": "^8.0.1",
    "vue": "^3.0.0",
    "vue-router": "^4.0.10",
    "vuex": "^4.0.2"
  },
阅读 5.5k
1 个回答

仓库没有正确定义的 index.d.ts 吧,WebStorm 不知道里面是什么内容,但是执行时没问题。

可以试试在 WebStorm > JS library 里下载一个。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题