小编Jas*_*son的帖子

电子保存对话框指定文件类型

我在电子应用程序中有一个保存对话框.目前,当用户点击"保存"时,它将使用默认名称和文件扩展名foo.pdf进行保存.

更改名称时,不会添加文件扩展名.

有没有办法确保将.pdf文件扩展名添加到所有文件名?

document.getElementById("pdf-btn").onclick = function() {
  var webv = document.getElementById('appview');
  dialog.showSaveDialog({
    defaultPath: '~/foo.pdf'
  }, function(file_path) {
    if (file_path) {
      webv.printToPDF({}, function(err, data) {
        if (err) {
          dialog.showErrorBox('Error', err);
          return;
        }
        fs.writeFile(file_path, data, function(err) {
          if (err) {
            dialog.showErrorBox('Error', err);
            return;
          }

          // addext = file_path + ".pdf";
          //
          // save_pdf_path = addext;

          save_pdf_path = file_path;

          var message = "<p> Write PDF file: " + save_pdf_path + " successfully!</p>";

          console.log(message);

        });
      });
    }
  });
}
Run Code Online (Sandbox Code Playgroud)

javascript savefiledialog atom-editor electron

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

全宽 li 元素

我正在尝试使此列表的列表元素全宽。他们有填充,当你悬停在它们上面时,填充是黄色的。

填充没有填满整个 ul 块,这正是我想要它做的。

我曾尝试使用不同的显示器并使列表元素的宽度为 100%,但这不起作用。

.footer-navigation {
  list-style: none;
  padding-left: 0px;
  display: inline-block;
  width: 100%;
}
.footer-navigation li {
  padding: 10px;
  width: 100%;
}
.footer-navigation a {
  padding: 10px;
  color: #000000;
}
.footer-navigation a:hover {
  padding: 10px;
  color: #ffffff;
  background-color: #fac900;
}
Run Code Online (Sandbox Code Playgroud)
<ul class="footer-navigation">
  <li><a href="#">Terms &amp; Conditions</a>
  </li>
  <li><a href="#">Cookie Policy</a>
  </li>
  <li><a href="#">Sitemap</a>
  </li>
</ul>
Run Code Online (Sandbox Code Playgroud)

html css

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

如何在单张杂食店图层上使用自定义图标?

我正在尝试更改我的KML图层之一的默认标记。我为此使用小叶杂食动物。

这是我已经拥有的代码。即使img位在代码中,标记也不会更改为图像,并且图层控件仅显示文本。

标记代码:

var redIcon = L.icon({
    iconUrl: 'icon.png',
    iconSize:     [20, 24],
    iconAnchor:   [12, 55], 
    popupAnchor:  [-3, -76] 
});

var nissanLayer = omnivore.kml('icons.kml')
    .on('ready', function() {
        map.fitBounds(customLayer.getBounds());
         //change the icons for each point on the map
         // After the 'ready' event fires, the GeoJSON contents are accessible
        // and you can iterate through layers to bind custom popups.
        customLayer.eachLayer(function(layer) {
            // See the `.bindPopup` documentation for full details. This
            // dataset has a property called `name`: your dataset might not, …
Run Code Online (Sandbox Code Playgroud)

javascript leaflet

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

标签 统计

javascript ×2

atom-editor ×1

css ×1

electron ×1

html ×1

leaflet ×1

savefiledialog ×1