小编Fir*_*ard的帖子

Mikro-orm 中的可选道具

我正在尝试弄清楚如何定义其他可选属性。

import { Entity, PrimaryKey, Property, OptionalProps } from '@mikro-orm/core';

@Entity()
export abstract class BaseEntity {
  [OptionalProps]?: 'createdAt';

  @PrimaryKey()
  id: number;

  @Property()
  createdAt: Date = new Date();

}

@Entity()
export class EntityA extends BaseEntity {
  [OptionalProps]?: 'isAnotherProperty'; // This is the bit I cannot figure out

  @Property()
  isAnotherProperty: boolean = false;

}
Run Code Online (Sandbox Code Playgroud)

使用上面的 TypeScript 会抛出错误:

Property '[OptionalProps]' in type 'EntityA' is not assignable to the same property in base type 'BaseEntity'.
Run Code Online (Sandbox Code Playgroud)

基本上 myBaseEntity有可选属性,就像EntityA. 我可以删除[OptionalProps]?:from …

node.js typescript mikro-orm

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

收据打印机 - 从网页打印

我有一张收据打印机,它连接到我的计算机上的串行COM1.

我正在尝试从网页打印收据,当它打印时...它只是一个没有任何文字的空白.(空白收据!).它在IE8上工作正常,但不适用于Firefox 3.6

我有一台Epson TM-T88II打印机,并在Windows 7上使用"Generic/Text"驱动程序.

这是什么解决方案?

HTML收据代码:

<html>
<head>
    <title></title>
</head>
<body>
    <div>
        <div>Company Name</div>
        <div>Customer Name</div>
        <div>Order No</div>
        <div>1 x Item</div>
        <div>1 x Item</div>
        <div>1 x Item</div>
        <div>12.00</div>
    </div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

http://jsfiddle.net/bu49K/

html printing firefox network-printers

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