我试图创建一个弹出的简单模态,并提供不同的菜单选项.它应该很简单,我在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) 我正在使用firebase为我的应用程序(使用create-react-app构建)编写一些测试,我正试图匿名登录我的测试数据库.但身份验证失败.然而,所有其他firebase操作(CRUD)工作得很好.
我也可以从浏览器中运行的应用程序匿名登录.
代码很简单:
import firebase from 'firebase';
firebase
.auth()
.signInAnonymously()
.catch((err) => {
console.log(err);
});
Run Code Online (Sandbox Code Playgroud)
给我这个:
O {
code: 'auth/network-request-failed',
message: 'A network error (such as timeout, interrupted connection or unreachable host) has occurred.'
}
Run Code Online (Sandbox Code Playgroud)
这是我的访问规则.但由于我无法登录,因此从未达到处理规则的程度.
{
"rules": {
"users": {
"$user_id": {
".read": "$user_id === auth.uid",
".write": "$user_id === auth.uid"
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
那么发生了什么?我需要做些什么特别的事情才能让它在命令行中运行吗?或者我应该在firebase控制台中切换任何内容?
也许任何提示我如何更深入地调试它?
谢谢!
我使用LESS,这是我的例子:
.arrow{
color: red;
}
.arrow:before{
content: ">";
}
.button{
background: blue;
.arrow;
&:before{
border: 1px solid;
}
}
Run Code Online (Sandbox Code Playgroud)
这是解析后的CSS:
.button{
background: blue;
color: red;
}
.button:before{
border: 1px solid; // HERE IS NO content: ">" !!!
}
Run Code Online (Sandbox Code Playgroud)
如何添加:从.arrow类到我的按钮之前的样式?
我正在尝试使用React在Material-ui中自定义文本字段组件。
根据此页面上的信息:
要自定义文本字段任何部分的颜色,请使用以下混合。我们建议您在CSS选择器(例如.foo-text-field:not(.mdc-text-field--focused))中应用这些mixin来选择未聚焦的文本字段,以及.foo-text-field.mdc-text-field- -focused以选择您要关注的文本字段。要更改文本字段的无效状态,请使用CSS选择器(如.foo-text-field.mdc-text-field--invalid)应用这些混合。
我尝试使用此mixin更改边框的颜色:
mdc-text-field-outline-color($color): Customizes the border color of the outlined text field.
但是,我不知道如何使用它。我安装了scss,但是没有得到使用scss将颜色设置为红色的语法。
@mixin mdc-text-field-outline-color($color) {
}
Run Code Online (Sandbox Code Playgroud)
似乎我从这样的事情开始,但是不确定没有具体的例子如何继续。
我正在尝试使用 React 和 SheetJs 库实现导出到 excel。看起来我可以下载它,但实际输出看起来不像预期的那样。我接收对象数组并使用XLSX.utils.json_to_sheet([data])
API 将 JS 对象数组转换为工作表。问题是:
我在这里复制了它
如何将完整的日历周视图垂直模式转换为水平模式?当前 fullcalendar 1.5.4 在周视图中以列方式提供天数。但是我需要一个按行排列的周历。(一周历,两周历等)你能帮我吗?提前致谢
我经常被天气撕裂我应该在表示唯一可识别对象的集合时在React中使用键值对数据结构或数组.
例如,假设我们想要一个组件来接收消息集合,那么像这样建模它们有什么问题,
{
message1: {from:"bill" , to:"frank"},
message2: {from:"Jill" , to:"sammy"}
}
Run Code Online (Sandbox Code Playgroud)
或类似于ES6地图,或者我们应该使用像这样的对象数组
[
{name:"message1" , from:"bill" , to:"frank"},
{name:"message2" , from:"Jill" , to:"sammy"}
]
Run Code Online (Sandbox Code Playgroud)
我想知道在React中是否存在关于使用键值数据结构的某种最佳实践.
根据这里:https://facebook.github.io/create-react-app/docs/running-tests#writing-tests
__PRE__
我不知道为什么不建议将块放在describe块中.
尝试将svg加载为ReactComponent时出现以下错误。
元素类型无效:需要一个字符串(对于内置组件)或一个类/函数(对于复合组件),但得到:未定义。您可能忘记了从定义文件中导出组件,或者可能混淆了默认导入和命名导入。
检查的渲染方法
Icon
。
我正在使用带有typescript选项的create-react-app创建项目。如果我正确地理解了文档,那么我应该可以立即将svgs作为ReactComponent导入(自CRA2.0起)。但是奇怪的是,我对导入的组件没有定义。
添加图像,字体和文件·创建React App https://facebook.github.io/create-react-app/docs/adding-images-fonts-and-files#adding-svgs
当前正在使用以下软件包。
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-redux": "^6.0.1",
"react-router-dom": "^5.0.1",
"react-scripts": "^3.0.1",
"@types/node": "^12.0.0",
"@types/react": "^16.8.17",
"@types/react-dom": "^16.8.4",
"@types/react-redux": "^7.0.8",
"@types/react-router-dom": "^4.3.3",
Run Code Online (Sandbox Code Playgroud)
我的代码如下。
Icon.tsx
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-redux": "^6.0.1",
"react-router-dom": "^5.0.1",
"react-scripts": "^3.0.1",
"@types/node": "^12.0.0",
"@types/react": "^16.8.17",
"@types/react-dom": "^16.8.4",
"@types/react-redux": "^7.0.8",
"@types/react-router-dom": "^4.3.3",
Run Code Online (Sandbox Code Playgroud)
定制文件
import * as React from 'react';
import { ReactComponent as IconSvg } from './IconSvg.svg';
const Icon: React.FC<IconProps> = props => {
console.log(IconSvg); // undefined
return (<IconSvg />); …
Run Code Online (Sandbox Code Playgroud) 我正在使用 Mocha + Chai 和axios-mock-adapter来测试我的 axios 请求。它运行良好,但我不知道如何test headers
通过 axios-mock-adapter来使用 axios 并确保Authorization
它Content-type
是正确的!
export const uploadFile = (token: string, fileName: string, file: Buffer): Promise<string> => {
return new Promise((resolve, reject): void => {
const uploadFileURL = `xxxxx.com`;
axios
.put(uploadFileURL, file, {
headers: {
Authorization: `Bearer ${token}`,
"Content-type": "application/x-www-form-urlencoded",
},
})
.then((response): void => {
resolve(response.data.id);
})
.catch((error: Error): void => {
reject(error.message);
});
});
};
Run Code Online (Sandbox Code Playgroud)
这是我的测试功能
describe("uploadFile", (): void => {
let mockAxios: MockAdapter; …
Run Code Online (Sandbox Code Playgroud) javascript ×5
reactjs ×5
css ×2
angularjs ×1
axios ×1
dictionary ×1
ecmascript-6 ×1
firebase ×1
html ×1
jestjs ×1
jquery ×1
less ×1
material-ui ×1
node.js ×1
sass ×1
sheetjs ×1
spreadsheet ×1
svg ×1