使用可选链接的文件出现此错误:
您只能在启用 'optionalChaining' 插件时使用可选链
我如何启用这个插件?
我也尝试忽略使用的行,//prettier-ignore但这不起作用。
Angular 版本:6.0.4 ~ 节点版本:10.4.1 ~ NPM 版本:6.1.0
我看到这个问题问了很多次,但没有回答。
按照这些说明安装 angular-datables并尝试在表上使用该指令后,如在他们的零配置示例中,我不断收到此错误:
TypeError: $(...).DataTable 不是
angular-datatables.directive.js:42的函数
包含的样式和脚本
"styles": [
"node_modules/bootstrap/dist/css/bootstrap.min.css",
"node_modules/datatables.net-dt/css/jquery.dataTables.css",
"src/styles.css"
],
"scripts": [
"node_modules/jquery/dist/jquery.min.js",
"node_modules/bootstrap/dist/js/bootstrap.min.js",
"node_modules/datatables.net/js/jquery.dataTables.js"
]
Run Code Online (Sandbox Code Playgroud)
在 app.module.ts 中导入
import { DataTablesModule } from 'angular-datatables';
Run Code Online (Sandbox Code Playgroud)
DataTablesModule 被添加到导入数组中。
* .component.html
<h1>View Accounts</h1>
<table class='table table-dark text-center table-striped table-hover rounded' datatable>
<thead class='thead-dark'>
<tr>
<td>#</td>
<td>Account Name</td>
</tr>
</thead>
<tbody>
<tr *ngFor='let account of db.accounts; let i = index' routerLink='/account/{{account.id}}'>
<td>{{i+1}}</td>
<td>{{account.accountHolder}}</td>
</tr>
</tbody>
</table>
Run Code Online (Sandbox Code Playgroud) 例如,如果我想匹配ips,可以将其分解为:
const octet = /\d{1,3}/;
const ip = /{octet}\.{octet}\.{octet}\.{octet}/;
Run Code Online (Sandbox Code Playgroud) 我有一个渲染 LineStrings 的图层,并尝试对线条应用发光效果。我创建的样式使用自定义渲染器来创建具有垂直于每个线段的渐变的笔划:
const glow_style = new Style({
renderer: (_coords, state) => {
const ctx = state.context;
const coords = _coords as Coordinate[];
ctx.lineWidth = 25;
for (let i = 1; i < coords.length; i++) {
const start = coords[i - 1];
const end = coords[i];
const [grd_start, grd_end] = getPerpendicularPoints(start, end, ctx.lineWidth);
const grd = ctx.createLinearGradient(grd_start[0], grd_start[1], grd_end[0], grd_end[1]);
grd.addColorStop(0, '#ffffff00');
grd.addColorStop(0.5, 'white');
grd.addColorStop(1, '#ffffff00');
ctx.strokeStyle = grd;
ctx.beginPath();
ctx.moveTo(start[0], start[1]);
ctx.lineTo(end[0], end[1]);
ctx.stroke();
}
}
});
Run Code Online (Sandbox Code Playgroud)
这种样式适用于完全直线,但在拐角处会失效,因为线段之间的渐变不能很好地连接。如果ctx.lineCap …
javascript ×2
angular ×1
datatables ×1
openlayers ×1
prettier ×1
regex ×1
transparency ×1
typescript ×1