我遇到的问题是我正在使用的一些浮动标签,但不是全部,这使得它更加奇怪.据我所知,我的离子项写得完全相同.以下是一些显示问题的图片.我不确定这是否是Ionic 2中的错误,或者我是否做错了.如果有任何不清楚或需要更多代码,请随时提问.
正如您所看到的,描述和照片/视频标签已经表现得像它们处于焦点时那样(它们不是),但它没有显示高光.
这是一个图像,我把它放在焦点,然后再次失焦.
一旦我这样做它就能正常工作.
我写的html:
<ion-content padding>
<form [formGroup]="complaint" (ngSubmit)="send()">
<ion-item>
<ion-label floating>Description*</ion-label>
<ion-textarea [(ngModel)]="description" type="text" formControlName="description"></ion-textarea>
</ion-item>
<ion-item>
<ion-label floating>Number of completed tests*</ion-label>
<ion-input [(ngModel)]="nrTests" type="number" formControlName="nrTests"></ion-input>
</ion-item>
<ion-item>
<ion-label floating>Photo/Video</ion-label>
<ion-input [(ngModel)]="media" formControlName="media"></ion-input>
</ion-item>
<button ion-button type="submit" [disabled]="!complaint.valid">Send</button>
</form>
</ion-content>
Run Code Online (Sandbox Code Playgroud) 我目前正在为战略设计模式编写单元测试.我正在将系统输出与assertEquals方法中的字符串进行比较.输出看起来相同但我的测试仍然失败... 我在想我忘记了与新线或标签有关的事情?
我的单元测试:
import static org.junit.Assert.*;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
public class MiniDuck1Test {
private final ByteArrayOutputStream outContent = new ByteArrayOutputStream();
private final ByteArrayOutputStream errContent = new ByteArrayOutputStream();
@Before
public void setUpStreams() {
System.setOut(new PrintStream(outContent));
System.setErr(new PrintStream(errContent));
}
@After
public void cleanUpStreams() {
System.setOut(null);
System.setErr(null);
}
@Test
public void testDuck1() {
Duck mallard = new MallardDuck();
mallard.performQuack();
mallard.performFly();
Duck model = new ModelDuck();
model.performFly();
model.setFlyBehavior(new FlyRocketPowered());
model.performFly();
assertEquals("Quack\nI'm flying!!\nI can't fly\nI'm flying with a …
Run Code Online (Sandbox Code Playgroud) 我正在尝试在Andoid Studio中运行一些单元测试.在"运行配置"选项卡中,我已将其设置为使我的JUnit在整个项目中搜索测试.我的JRE配置为1.8,我已启用代码覆盖率.但是,每次我尝试运行测试时,都会出现以下"IDE致命错误":
Unable to determine list of modules to build
java.lang.IllegalStateException: Unable to determine list of modules to build
at com.android.tools.idea.gradle.run.MakeBeforeRunTaskProvider.createBuilder(MakeBeforeRunTaskProvider.java:357)
at com.android.tools.idea.gradle.run.MakeBeforeRunTaskProvider.executeTask(MakeBeforeRunTaskProvider.java:255)
at com.android.tools.idea.gradle.run.MakeBeforeRunTaskProvider.executeTask(MakeBeforeRunTaskProvider.java:86)
at com.intellij.execution.impl.ExecutionManagerImpl$3.run(ExecutionManagerImpl.java:317)
at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:369)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Run Code Online (Sandbox Code Playgroud)
我试图谷歌一个解决方案,这个线程接近:Android Studio插件Android支持中的NullPointerExcepton,但我的SDK和插件是最新的,并没有真正解决它.
谢谢
我已经在我的Angular2 webapp中实现了HammerJS,我还测试了示例代码.此代码使用一个对象数组,似乎完美无缺.但是,我一直在尝试为@ angular2-material/tabs实现相同的系统.因此,我有一个多个的,应该从一个标签到另一个标签.问题是我甚至无法触发滑动功能.<md-tab-group>
<md-tab>
HTML文件:
<md-tab-group md-stretch-tabs [(selectedIndex)]="selectedIndex" (selectedIndexChange)="selectChange()">
<div class="swipe-box" (swipeleft)="swipe(idx, $event.type)" (swiperight)="swipe(idx, $event.type)">
<md-tab>
(...) //Content Tab 1
</md-tab>
<md-tab>
(...) //Content Tab 2
</md-tab>
</div>
</md-tab-group>
Run Code Online (Sandbox Code Playgroud)
在示例中可以看到*ngFor
用于*ngFor="let avatar of avatars; let idx=index"
滑动框的示例<div>
.但是因为我从<md-tab-group>
它得到我的索引似乎不是必要的,即使我包含它,我的事件也没有被触发但是我的内容<md-tab>
变得隐藏起来.所以我把它留了出来.我确实将idx
参数保留在函数中,因为滑动方法需要一个数字(第二个参数是可选的).文档
对于TypeScript文件,我实现了以下代码(某些代码可能无法运行但由于无法调用滑动方法而无法对其进行测试).
TS文件:
export class HomeComponent {
selectedIndex: number = 1;
selectChange(): void{
console.log("event triggered INDEX: " + this.selectedIndex);
}
SWIPE_ACTION = { LEFT: 'swipeleft', …
Run Code Online (Sandbox Code Playgroud) 在 ASP.NET Core 中工作并使用 iTextSharp,我正在构建 PDF 并将其保存到本地系统。我现在想在浏览器中打开该文件,但似乎无法使其工作,因为我在一次尝试中遇到 FileStream 错误,而在另一次尝试中却什么也没有。
我的逻辑在下面的控制器中。我已经用// region description
. 重要的代码(我尝试过的东西)在TODO: Open the file
区域内。
[HttpPost]
public (JsonResult, IActionResult) CreatePDF([FromBody] ReportViewModel model)
{
try
{
// region Logic code
using (System.IO.MemoryStream memoryStream = new System.IO.MemoryStream())
{
// Create the document
iTextSharp.text.Document document = new iTextSharp.text.Document();
// Place the document in the PDFWriter
iTextSharp.text.pdf.PdfWriter PDFWriter =
iTextSharp.text.pdf.PdfWriter.GetInstance(document, memoryStream);
// region Initialize Fonts
// Open the document
document.Open();
// region Add content to document
// Close …
Run Code Online (Sandbox Code Playgroud) 当你必须为多个标题指定相同的.css类时,<h3>
使用<br>
标记是否更好?或者在一遍又一遍地指定相同的样式类时重复标题是否更好?在这个特定的场景中,我不能把造型放在周围<div>
哪一个是最佳实践,为什么?
使用<br>
标签时的代码示例:
<div class="more_room_left | more_room_top">
<h5 class="no_margin_top_bottom">
*location?.streeth* *location?.number*
<br> *location?.postcode* *location?.city*
<br> *location?.country*
<br>
</h5>
</div>
Run Code Online (Sandbox Code Playgroud)
使用不同标头的代码示例:
<div class="more_room_left | more_room_top">
<h5 class="no_margin_top_bottom">*location?.streeth* *location?.number*</h5>
<h5 class="no_margin_top_bottom">*location?.postcode* *location?.city*</h5>
<h5 class="no_margin_top_bottom">*location?.country*</h5>
</div>
Run Code Online (Sandbox Code Playgroud)
视觉示例:
编辑:
在阅读了有关何时使用<br>
标签的更多信息之后,我得出结论,在我的情况下,<br>
标签没有价值,被认为是黑客.我重新设计了标题的样式<h3>
,现在是段落<p>
,以适应我需要的样式而不使用<br>
标记.这个解决方案是通过已经删除的答案交给我的,所以我不能给予信任.
HTML
<div class="address_container | more_room_left | more_room_top">
<p>*location?.streeth* *location?.number*</p>
<p>*location?.postcode* *location?.city*</p>
<p>*location?.country*</p>
</div>
Run Code Online (Sandbox Code Playgroud)
CSS
.address_container > p {
margin-top: 0;
margin-bottom: …
Run Code Online (Sandbox Code Playgroud) html ×2
java ×2
junit ×2
unit-testing ×2
android ×1
angular ×1
asp.net-core ×1
c# ×1
css ×1
hammer.js ×1
ionic2 ×1
itext ×1
mobile ×1
pdf ×1
typescript ×1