我将 Google 的Workbox用于一些离线功能并在我的 angular 9 应用程序中进行缓存。对于推送消息,我们使用 Google 的Firebase。
自从将 Web 应用程序更新为 Vue.js 后,我在访问网站时收到错误消息:
未捕获的 FirebaseError: Messaging: 我们无法注册默认的 Service Worker。未能注册为范围ServiceWorker(” https://my-domain.com/firebase-cloud-messaging-push-scope与脚本‘)(’ https://my-domain.com/firebase-messaging-sw。 js '):脚本具有不受支持的 MIME 类型 ('text/html')。(消息/失败的服务工作人员注册)。
是的,根目录下没有firebase-messaging-sw.js。
一切都应该由 Workbox 处理。
我按照文档使用现有的服务工作者进行注册useServiceWorker(),但这会导致上述错误。
import * as firebase from 'firebase/app';
import 'firebase/messaging';
import { Workbox } from 'workbox-window';
import { environment } from './environments/environment';
...
if ('serviceWorker' in navigator && environment.production) {
const scope = window.location.origin + window.location.pathname.split('/').slice(0, 3).join('/');
const wb = new Workbox('/my-worker.js', …Run Code Online (Sandbox Code Playgroud) 我创建了一个带有图标的切换侧边栏。我想通过 boostrap popover 来描述该图标,但是如果将其悬停在左侧,则弹出窗口会出现错误。弹出窗口开始闪烁。
当我将鼠标悬停在底部的图标时,将显示弹出窗口。(反正没有内容……)
我添加了代码的缩小片段。填充有问题吗?
$(document).ready(function() {
$('[data-toggle="popover"]').popover();
});Run Code Online (Sandbox Code Playgroud)
.left-side {
width: 100%;
background: #CCC;
margin-right: 100px;
}
.right-side {
position: absolute;
right: 0;
top: 10px;
width: 80px;
height: 200px;
background: #000;
color: #FFF;
text-align: center;
font-size: 28px;
padding: 10px;
}
.pmo-icon {
display: block;
padding: 20px
}Run Code Online (Sandbox Code Playgroud)
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet" />
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<div class="left-side">
<h1>title</h1>
<p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore …Run Code Online (Sandbox Code Playgroud)我试图让页脚粘在页面底部.如果内容很小,则页脚应位于浏览器的底部.内容和页脚之间的空格应为空.
我尝试了各种方法,但页脚直接保留在内容下,而不是在浏览器的底部.
这是我的代码
<div id="content">
<a href="item.html">
<div class="col-xs-12 col-md-6 col-lg-3 item">
<div class="opacity"></div>
<div class="box_bg">
<h4 class="color1">Headline</h4>
<p>Description</p>
</div>
</div>
</a>
<a href="item.html">
<div class="col-xs-12 col-md-6 col-lg-3 item">
<div class="opacity"></div>
<div class="box_bg">
<h4 class="color1">Headline</h4>
<p>Description</p>
</div>
</div>
</a>
</div>
<footer class="bar bar-tab">
<a class="tab-item" href="#">
Home
</a>
</footer>
Run Code Online (Sandbox Code Playgroud)
CSS:
#content{
min-height: 100%;
}
footer{
height: 50px;
position: relative;
bottom: 0;
}
Run Code Online (Sandbox Code Playgroud) 通过选择,我得到以下回应:
=> [{:month=>[3, 3, 9, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
:dates=>["30.10:", "29.10:", "28.10:", "27.10:", "26.10:", "25.10:", "24.10:", "23.10:", "22.10:", "21.10:", "20.10:", "19.10:", "18.10:", "17.10:", "16.10:", "15.10:", "14.10:", "13.10:", "12.10:", "11.10:", "10.10:", "09.10:", "08.10:", "07.10:", "06.10:", "05.10:", "04.10:", "03.10:", "02.10:", "01.10:"]},
{:month=>[1, 3, 5, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …Run Code Online (Sandbox Code Playgroud) 我合并了2个列表.
list1 = customer.links.where(ext: true).group(:link_id, :external).limit(100).order('count_id desc').count('id')
list2 = customer.links.where(ext: false).where.not(url: '/specific_link').group(:url, :ext).limit(100).order('count_id desc').count('id')
list = list1.merge(list2).sort_by{|k, v| -v}
Run Code Online (Sandbox Code Playgroud)
结果是:
[[["/path/element1", false], 7], [[4, true], 5], [["/path/element6", false], 1]]
Run Code Online (Sandbox Code Playgroud)
我想将它转换为on维哈希,如下所示:
[["/path/element1", false, 7], [4, true, 5], ["/path/element6", false, 1]]
Run Code Online (Sandbox Code Playgroud)
当我使用时flatten,阵列之间没有分离.