小编Bro*_*Eye的帖子

Angular 6-“服务工作者被禁用或不支持”错误

我要推通知订阅与web-push模块angular service worker。我已经按照以下链接中的说明进行操作:Angular Push Notifications:完整的分步指南Angular&Express的Push Notifications,但通知提示并未如期显示。我检查了该swPush对象,发现它没有启用,而且我什至不知道为什么我angular/pwa完全按照这些链接所说的那样遵循安装说明。希望这里有人能帮忙。非常感谢!

我使用自己的Nodejs服务器而不是http-server模块来运行应用程序。

这是我的推送订阅代码:

readonly VAPID_PUBLIC_KEY =
'BIfDkegCvhzctX06rYvwQImhbfAymWYE3wtcog9E4Zj7LOgX6TQFS6fZSqLCt01zBZtc1-jSwpZrZEmTQ2i95V8'; // key generated with web-push

 constructor(
   private user: UserService,
   private httpClient: HttpClient,
   private router: Router,
   private auth: AuthService,
   private swPush: SwPush
 ) {
     this.swPush.requestSubscription({
       serverPublicKey: this.VAPID_PUBLIC_KEY
     })
     .then(subcription => {
       console.log('Send ' + subcription + ' to server');
     })
     .catch(console.error);
}
Run Code Online (Sandbox Code Playgroud)

返回错误:

错误:服务工作者已禁用或不受此浏览器支持,位于新的SwPush.push ../ node_modules/@angular/service-worker/fesm5/service-worker.js.SwPush.requestSubscription(service-worker.js:146)的createClass(core.js:9311)的createClass(core.js:9186)的createClass(core.js:9186)的createClass Nodes(core.js:10406)的createRootView(core.js:10320)的createClass(core.js:1031)的DashboardComponent(dashboard.component.ts:40) .js:11351),位于Object.debugCreateRootView [作为createRootView](core.js:10838),位于ComponentFactory_.push ../ node_modules/@angular/core/fesm5/core.js.ComponentFactory_.create(core.js:8666)在ComponentFactoryBoundToModule.push ../ node_modules/@angular/core/fesm5/core.js.ComponentFactoryBoundToModule.create(core.js:3315) …

push-notification angular

8
推荐指数
2
解决办法
3329
查看次数

Three.js - 尽管加载了材料,模型仍显示为空白(黑色)纹理

我有一个 3D 模型文件3dbaotang.obj和一个材质文件3dbaotang.mtl。我已经使用 OBJLoader 和 MTLLoader 加载了它们three.js。模型已显示,但材质未显示,因为它仅被黑色覆盖。有人可以帮忙吗?

这是我的代码:

var scene = new THREE.Scene();
var camera = new THREE.PerspectiveCamera(75, window.innerWidth / 
window.innerHeight, 0.1, 10000);
var renderer = new THREE.WebGLRenderer({
    antialias: true
});
var controls = new THREE.OrbitControls(camera, renderer.domElement);
var keyLight = new THREE.DirectionalLight('hsl(30, 100%, 75%)', 1.0);
var fillLight = new THREE.DirectionalLight('hsl(240, 100%, 75%)', 0.75);
var backLight = new THREE.DirectionalLight(0xffffff, 1.0);
backLight.position.set(100, 0, -100).normalize();
keyLight.position.set(-100, 0, 100);
fillLight.position.set(100, 0, 100);

controls.enableDamping = true;
controls.dampingFactor = 0.25; …
Run Code Online (Sandbox Code Playgroud)

3d three.js

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

标签 统计

3d ×1

angular ×1

push-notification ×1

three.js ×1