是否可以少花钱?
a {
&:after {
background: red;
}
&:hover {
&:after {
background: blue;
}
}
}
Run Code Online (Sandbox Code Playgroud)
当我盘旋时,我无法改变颜色?
我正在使用这个rxjs-websocket库来处理我的应用程序中的websockets.当我使用angular-cli构建站点并在浏览器中打开时,从服务器接收消息时出现错误:
WebSocket.socket.onclose的错误错误[as __zone_symbol__ON_PROPERTYclose]
但是当我刷新浏览器时,我没有收到错误,消息传递到UI.奇怪的.似乎浏览器正在关闭连接,刷新会触发重新连接(使用chrome).它可能是我的代码问题:
活message.service.ts
import { Injectable } from '@angular/core'
import { QueueingSubject } from 'queueing-subject'
import { Observable } from 'rxjs/Observable'
import websocketConnect from 'rxjs-websockets'
import 'rxjs/add/operator/share'
@Injectable()
export class LiveMessageService {
private inputStream: QueueingSubject<any>
public messages: Observable<any>
public connect() {
this.messages = websocketConnect(
'ws://www.dev.com:8080',
this.inputStream = new QueueingSubject<string>()
).messages.share()
}
public send(message: string):void {
this.inputStream.next(message)
}
}
Run Code Online (Sandbox Code Playgroud)
MessageComponent.ts
import { Component, OnInit } from '@angular/core';
import { Subscription } from 'rxjs/Subscription'
import { JwtService, LiveMessageService …
Run Code Online (Sandbox Code Playgroud) 我们正在尝试在节点7中使用--harmony_async_await,并且与使用babel进行async/await的转换相比,缺少具有长堆栈跟踪的能力(http://bluebirdjs.com/docs/api/promise.longstacktraces.html).
显然,如果选择"只看到这个"会很棒 - 在chrome(ium)方面他们似乎在检查员中支持它,尽管最新的工作是在v8 5.4之后(即不在Node 7中) ):
https://bugs.chromium.org/p/v8/issues/detail?id=4483
https://codereview.chromium.org/2357423002/
另一种方法是让v8使用bluebird的promise实现 - 但我该怎么做呢?覆盖global.Promise不会改变async/await的行为方式(它们仍然使用默认的promises).
我正在使用Selenium webdriver与某些网站进行交互.
如果网站使用jQuery,我们可以通过使用获取待处理的AJAX请求jQuery.active
.
JavascriptExecutor jsx = (JavascriptExecutor) driver;
Run Code Online (Sandbox Code Playgroud)
Int totAjaxRequest =(Int)jsx.executeScript("jQuery.active");
Int totAjaxRequest = (Int)jsx.executeScript("return jQuery.active");
Run Code Online (Sandbox Code Playgroud)
如果网站没有使用jQuery,我们如何计算XMLHttpRequest
请求的数量.
javascript jquery selenium selenium-firefoxdriver selenium-webdriver
我在React Table中创建了一个表.我想在列和行上添加拖放功能?我怎样才能做到这一点 ?
这是我的CodeSandbox示例 - https://codesandbox.io/s/2wp7jk23kr
在这里,我有一个用于拖放行的Code Sandbox - https://codesandbox.io/s/1844xzjvp7
在这里,我有一个用于拖放列的Code Sandbox - https://codesandbox.io/s/5vxlnjrw1n
作为初学者在React中,我无法集成这三个沙盒.有人可以在CodeSandbox上找到一个关于如何在列和行上添加拖放功能的好例子.
请使用我的React Table数据列 - https://codesandbox.io/s/2wp7jk23kr
最近我尝试使用IdentityServer4和React客户端设置身份验证.我按照Adding a JavaScript client
IdentityServer文档的教程(部分)进行了操作:https://media.readthedocs.org/pdf/identityserver4/release/identityserver4.pdf也使用了该Quickstart7_JavaScriptClient
文件.
缺点是我使用React作为我的前端,而我对React的了解并不足以实现使用React的教程中使用的相同功能.
尽管如此,我开始阅读并试图开始使用它.我的IdentityServer项目和API已设置好,并且似乎正常工作(也与其他客户端一起测试).
我首先将oidc-client.js添加到我的Visual Code项目中.接下来,我创建了一个在开始时呈现的页面(将其命名为Authentication.js),这是包含Login,Call API和Logout按钮的位置.此页面(Authentication.js)如下所示:
import React, { Component } from 'react';
import {login, logout, api, log} from '../../testoidc'
import {Route, Link} from 'react-router';
export default class Authentication extends Component {
constructor(props) {
super(props);
}
render() {
return (
<div>
<div>
<button id="login" onClick={() => {login()}}>Login</button>
<button id="api" onClick={() => {api()}}>Call API</button>
<button id="logout" onClick={() => {logout()}}>Logout</button>
<pre id="results"></pre>
</div>
<div>
<Route exact path="/callback" render={() => {window.location.href="callback.html"}} /> …
Run Code Online (Sandbox Code Playgroud) 在我的 React 应用程序中,我有一个可以从下拉列表中获取值的输入。为此,我使用 material-ui Autocomplete 和 TextField 组件。
问题:如何通过单击按钮而不从下拉列表中选择以编程方式设置输入值?例如,我想从示例中设置“教父”,并且应该在输入中直观地看到该值。
import React from "react";
import Autocomplete from "@material-ui/lab/Autocomplete";
import { TextField, Button } from "@material-ui/core";
export default function ComboBox() {
const handleClick = () => {
// set value in TextField from dropdown list
};
return (
<React.Fragment>
<Autocomplete
options={top100Films}
getOptionLabel={option => option.title}
style={{ width: 300 }}
renderInput={params => (
<TextField
{...params}
label="Combo box"
variant="outlined"
fullWidth
/>
)}
/>
<Button onClick={handleClick}>Set value</Button>
</React.Fragment>
);
}
// Top 100 …
Run Code Online (Sandbox Code Playgroud) 我不确定这是否是正确的问题,但我的devicemotion
脚本有问题.
我有一些代码在加载页面时运行,以检查是否有陀螺仪可用.我通过以下方式执行此操作:
function check_user_hardware(){
if (mobile_size <= 600) {
hidden = true;
}
console.log("checking hardware");
giro_timer = setTimeout(update_gyro_value, 30);
window.addEventListener("devicemotion", function(event){
console.log("device motion?");
if(event.rotationRate.alpha || event.rotationRate.beta || event.rotationRate.gamma){
calculate_rotation_mesh_pos(event.rotationRate.beta, event.rotationRate.gamma);
if (!gyroscope) {
gyroscope = true;
console.log("gyroscope here");
current_interaction_mode = 'gyroscope_option';
set_user_ui_elements();
}
}else{
followMouse = true;
console.log("no gyroscope here");
current_interaction_mode = 'followMouse_option';
set_user_ui_elements();
window.addEventListener('mousemove', get_user_mouse_pos);
}
});
}
Run Code Online (Sandbox Code Playgroud)
这几周前工作得很好......但现在它不再工作了......当我检查控制台时,我看到以下打印件:
checking hardware
Run Code Online (Sandbox Code Playgroud)
那就是..为什么我的devicemotion事件没有被解雇?即使在我的网站上使用基本的SSL加密,它也无法正常工作?我需要某种特殊的SSL加密吗?
怎么了??
欢迎所有建议!
如果需要更多信息,我很乐意提供.
你可以在这里看到有问题的网站:gravient.thomashoek.com
有没有人在实例之间共享webpack的缓存选项的例子?在文档中它说:
"你可以传递一个对象来启用它,让webpack使用传递的对象作为缓存.这样你就可以在多个编译器调用之间共享缓存对象.注意:不要在具有不同选项的调用之间共享缓存."
http://webpack.github.io/docs/configuration.html#cache
但目前尚不清楚实施情况.有帮助吗?谢谢
我试图创建一个弹出的简单模态,并提供不同的菜单选项.它应该很简单,我在ui bootstrap网站上跟随Plunker进行模态但是我收到一条错误,说$ uibModal是一个未知的提供者.这是角度代码:
angular.module('billingModule', ['ngAnimate', 'ui.bootstrap']);
angular.module('billingModule').controller('StoreBillingCtrl', function ($scope, $uibModal) {
$scope.openStoreBilling = function () {
var modalInstance = $uibModal.open({
animation: true,
templateUrl: 'storeBillingContent.html',
controller: 'ModalInstanceCtrl',
});
};
});
angular.module('billingModule').controller('OfficeBillingCtrl', function ($scope, $uibModal) {
$scope.openOfficeBilling = function () {
var modalInstance = $uibModal.open({
animation: true,
templateUrl: 'officeBillingContent.html',
controller: 'ModalInstanceCtrl',
});
};
});
angular.module('billingModule').controller('ModalInstanceCtrl', function ($scope, $uibModalInstance) {
$scope.close = function () {
$uibModalInstance.dismiss();
}
});
Run Code Online (Sandbox Code Playgroud)
我阅读了错误文档并意识到这是一个依赖性错误.但我只是不知道我哪里出错了.我有角度1.4.8和ui-bootstrap 0.14.3.
以下是我添加的脚本:
<head runat="server">
<title>DP Billing</title>
<link href="../CSS/bootstrap.css" rel="stylesheet" />
<link href="../CSS/base.css" rel="stylesheet" /> …
Run Code Online (Sandbox Code Playgroud) javascript ×8
reactjs ×3
angular ×1
angularjs ×1
async-await ×1
autocomplete ×1
bluebird ×1
browser ×1
build ×1
caching ×1
css ×1
devicemotion ×1
instance ×1
jquery ×1
less ×1
material-ui ×1
nested ×1
node.js ×1
react-table ×1
selenium ×1
ssl ×1
textfield ×1
v8 ×1
webpack ×1
websocket ×1