简体   繁体   English

FancyTree 引导主题不适用

[英]FancyTree bootstrap theme doesn't apply

I have my FancyTree initialised in a class.我在 class 中初始化了我的 FancyTree。 Here's what the class imports: Tree.js这是 class 导入的内容: Tree.js

import fancytree from 'jquery.fancytree';
import 'jquery.fancytree/dist/modules/jquery.fancytree.edit';
import 'jquery.fancytree/dist/modules/jquery.fancytree.filter';
import 'jquery.fancytree/dist/modules/jquery.fancytree.dnd5';
import 'jquery.fancytree/dist/modules/jquery.fancytree.glyph';
import 'jquery.fancytree/dist/modules/jquery.fancytree.table';
import 'jquery.fancytree/dist/modules/jquery.fancytree.wide';

I'm using RollUp, so the imports work as intended.我正在使用 RollUp,因此导入按预期工作。 However, I just can't find any solution to applying certain theme, ie bootstrap3 into my tree.但是,我只是找不到将某些主题(即 bootstrap3)应用到我的树中的任何解决方案。 index.html imports index.html进口

<script src="https://code.jquery.com/jquery-3.4.1.min.js" type="text/javascript"></script>
    <link href="//cdn.jsdelivr.net/npm/jquery.fancytree@2.27/dist/skin-win8/ui.fancytree.min.css" rel="stylesheet">
    <script src="//cdn.jsdelivr.net/npm/jquery.fancytree@2.27/dist/jquery.fancytree-all-deps.min.js"></script>
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="assets/css/icons.css" />
    <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
    <link rel="stylesheet" href="./node_modules/jquery.fancytree/dist/skin-bootstrap/ui.fancytree.css">
    <link href="./node_modules/jquery.fancytree/dist/skin-bootstrap/ui.fancytree.css" rel="stylesheet" class="skinswitcher">

And finally, the initialising of the FancyTree.最后,FancyTree 的初始化。 Tree.js树.js

$('#explorer-tree').fancytree({
      extensions: ['dnd5', 'edit', 'glyph', 'wide'],
      glyph: {
        preset: 'bootstrap3',
        map: {
          doc: 'fa fa-file-o',
          docOpen: 'fa fa-file-o',
          checkbox: 'fa fa-square-o',
          checkboxSelected: 'fa fa-check-square-o',
          checkboxUnknown: 'fa fa-square',
          dragHelper: 'fa arrow-right',
          dropMarker: 'fa long-arrow-right',
          error: 'fa fa-warning',
          expanderClosed: 'fa fa-caret-right',
          expanderLazy: 'fa fa-angle-right',
          expanderOpen: 'fa fa-caret-down',
          folder: 'fa fa-folder-o',
          folderOpen: 'fa fa-folder-open-o',
          loading: 'fa fa-spinner fa-pulse',
        },
      },
      icon: function(event, data) {
        // if( data.node.isFolder() ) {
        //   return "glyphicon glyphicon-book";
        // }
      },
      source: [
        {title: 'project-name', key: '1',
          expanded: true},
      ],
    });

The tree just looks the same - default.树看起来一样 - 默认。 No styling applied, no nothing.没有应用样式,什么都没有。 Even documentation doesn't really explain how it works.甚至文档也没有真正解释它是如何工作的。

Since FancyTree is made in a very isolated way, the only way to apply custom styles is to not include default ones in the first place.由于 FancyTree 是以非常孤立的方式制作的,因此应用自定义 styles 的唯一方法是首先不包括默认值。 I had to rewrite css files to adjust them, otherwise it just wouldn't do anything.我不得不重写 css 文件来调整它们,否则它不会做任何事情。 It would also overlap default icons with awesome4 ones if multiple css files are imported.如果导入了多个 css 文件,它也会将默认图标与 awesome4 重叠。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM