0

我已经开始使用来自 angular-tools/ng-jsoneditor 的 JSON 编辑器库和 Angular 包装器。

切换到代码视图时,该错误似乎很烦人。有人有类似的吗?

情景形象

情况图 2

仅当引号出现在该行时才会发生。这几乎是 JSON 的每一行。

使用标准库,没有任何改变。我的想法不多了。

控制器

$scope.obj = { data: null, options: { mode: 'code' } };

$scope.onLoad = function (instance) {
    instance.expandAll();
};

看法

<!DOCTYPE html>
<html ng-app="jsonapp" ng-controller="jsonController">
<head>
    <meta charset="utf-8" />
    <!-- when using the mode "code", it's important to specify charset utf-8 -->
    <meta content="charset=utf-8">

    <link href="jsoneditor/dist/jsoneditor.min.css" rel="stylesheet" type="text/css">
    <script src="jsoneditor/dist/jsoneditor.min.js"></script>
</head>
<body>
    <div ng-jsoneditor="onLoad" ng-model="obj.data" options="obj.options" style="height:800px"></div>
</body>
</html>
4

1 回答 1

0

我遇到了类似的问题,经过几个小时的调查,最终我发现导致它的原因是字体系列样式(我对所有应用程序都有全局字体)。所以我用 ng-deep:: to font-family: monospace 覆盖它。在我的情况下,这是一个解决方案!

于 2021-08-08T14:54:56.297 回答