gpt4 book ai didi

javascript - Angular4-JsonEditor CSS 丢失

转载 作者:太空宇宙 更新时间:2023-11-04 07:32:27 24 4
gpt4 key购买 nike

我正在使用来自 https://www.npmjs.com/package/angular4-jsoneditor 的 Angular4-JsonEditor .

我能够看到树格式的 JSON。如前所述,我还导入了 css,但有些样式没有得到应用。它显示如下所示。即使我尝试将自己的样式添加到现有类中,也不会应用任何更改。我是 Angular 的新手,请有人指导我。

enter image description here

app.component.ts

 import { Component,ViewChild } from '@angular/core';
import { NgJsonEditorModule } from 'ang-jsoneditor' ;

@Component({
selector: 'app-root',
template: `<json-editor [options]="editorOptions" [data]="data"></json-
editor>`,
styleUrls: ['./app.component.css']
})
export class AppComponent {
public editorOptions: JsonEditorOptions;
public data: any;
@ViewChild(JsonEditorComponent) editor: JsonEditorComponent;

constructor() {

var options = {
"mode": "tree",
"search": true
};
this.editorOptions = new JsonEditorOptions();
this.editorOptions.mode="view";
this.editorOptions.search=false;


this.data={"products":[{"name":"car","product":[{"name":"honda","model":
[{"id":"civic","name":"civic"},{"id":"accord","name":"accord"},
{"id":"crv","name":"crv"},{"id":"pilot","name":"pilot"},
{"id":"odyssey","name":"odyssey"}]}]}]}
}
}

app.component.css

 @import "~jsoneditor/dist/jsoneditor.min.css";

最佳答案

您需要将导入添加到src/style.css

@import "~jsoneditor/dist/jsoneditor.min.css";

关于javascript - Angular4-JsonEditor CSS 丢失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49256834/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com