我想在 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) 复制步骤:
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 上;开发和生产。