小编Jua*_*237的帖子

Angular-jsPDF 警告、意外标记和 jsPDF.fromHTML 不是函数

我想在 Angular 中打印带有 jsPDF 的 html 代码,但我不能。我需要帮助,看。

ts.config.app.json

{
  "extends": "./tsconfig.base.json",
  "compilerOptions": {
    "outDir": "./out-tsc/app",
    "types": [],
    "allowSyntheticDefaultImports": true
  },
  "files": [
    "src/main.ts",
    "src/polyfills.ts"
  ],
  "include": [
    "src/**/*.d.ts"
  ]
}
Run Code Online (Sandbox Code Playgroud)

npm jspdf 模块

在此处输入图片说明

angular.json 脚本

 "scripts": [
              "node_modules/jquery/dist/jquery.js",
              "node_modules/popper.js/dist/umd/popper.js",
              "node_modules/bootstrap/dist/js/bootstrap.js",
              "node_modules/jspdf/dist/jspdf.es.min.js"
            ]
Run Code Online (Sandbox Code Playgroud)

如果在课堂上我像这样import jsPDF from 'jspdf';或这样导入,import { jsPDF } from "jspdf";我会收到此警告和此错误。

警告:

WARNING in ./node_modules/jspdf/dist/jspdf.umd.min.js 195:141-151
Critical dependency: the request of a dependency is an expression

WARNING in ./node_modules/jspdf/dist/jspdf.umd.min.js 195:240-254
Critical dependency: the request of …
Run Code Online (Sandbox Code Playgroud)

jspdf typescript angular

4
推荐指数
1
解决办法
3635
查看次数

Angular Universal (SSR)“由于选择器错误而跳过规则”

复制步骤:

ng new testproject --style scss
cd testproject
ng add @ng-bootstrap/ng-bootstrap
npm run build
Run Code Online (Sandbox Code Playgroud)

它不一定是 ng-bootstrap,它可以是 bootstrap 或 tailwind,基本上任何 scss 框架。

错误看起来像:

1 rules skipped due to selector errors:
  legend+* -> Cannot read properties of undefined (reading 'type')
Run Code Online (Sandbox Code Playgroud)

这个错误发生在构建或服务 ssr 上;开发和生产。

angular bootstrap-5

3
推荐指数
1
解决办法
1926
查看次数

标签 统计

angular ×2

bootstrap-5 ×1

jspdf ×1

typescript ×1