我正在使用官方的Semantic UI React组件来创建Web应用程序.我的注册页面上有一个表单,其中包含电子邮件字段,密码字段和确认密码字段.
import {Component} from 'react';
import {Button, Form, Message} from 'semantic-ui-react';
import {signUp} from '../../actions/auth';
class SignUp extends Component {
constructor(props) {
super(props);
this.handleSubmit = this.handleSubmit.bind(this);
}
handleSubmit(e, {formData}) {
e.preventDefault();
//
// Potentially need to manually validate fields here?
//
// Send a POST request to the server with the formData
this.props.dispatch(signUp(formData)).then(({isAuthenticated}) => {
if (isAuthenticated) {
// Redirect to the home page if the user is authenticated
this.props.router.push('/');
}
}
}
render() {
const …Run Code Online (Sandbox Code Playgroud) 我正在尝试克隆一个Git存储库,其中包含一个Ember-CLI项目(https://github.com/tgfischer/StockMarketApp).当我这样做时,我收到以下错误:
tom@tom-fischer:~/Desktop/StockMarketApp$ ember server
version: 0.2.0-beta.1
Could not find watchman, falling back to NodeWatcher for file system events
Livereload server on port 35729
Serving on http://0.0.0.0:4200/
Object function glob(pattern, options, cb) {
if (typeof options === "function") cb = options, options = {}
if (!options) options = {}
if (typeof options === "number") {
deprecated()
return
}
var g = new Glob(pattern, options, cb)
return g.sync ? g.found : g
} has no method 'hasMagic'
TypeError: Object function …Run Code Online (Sandbox Code Playgroud) Jest 允许您在 package.json 中指定覆盖率报告器,如下所示
{
...
"jest": {
"coverageDirectory": "./coverage",
"coverageReporters": ["json", "text", ...]
}
...
}
Run Code Online (Sandbox Code Playgroud)
但是,这仅将.json摘要输出到覆盖目录。它仅将文本版本打印到控制台。有没有办法将文本版本.txt也输出到覆盖文件夹中的文件中?
我一直在参考这里的文档,它说它与任何伊斯坦布尔记者兼容。文本“伊斯坦布尔记者”似乎支持写入文件。有什么办法可以利用它吗?
我有两种类型的图表要导出。我正在使用 SVG Crowbar,它在 Chrome 中运行良好,但在 Firefox 中它不会用它导出 CSS(而且我不会打扰 IE)。我决定将所有 CSS 转换为内联样式。但是,我遇到了 2 个问题(每个图 1 个)。
在条形图中,我似乎无法应用“笔画:黑色;” 只有轴,而不是轴标签。“笔画:黑色”使标签变得模糊且没有吸引力。这是问题的 JSFiddle:http : //jsfiddle.net/UK8bw/10/。这是轴/标签的代码。我试图将它们分开,但没有成功。我在 CSS 部分注释掉了相关的 CSS。
svg.append("g")
.attr("class", "xAxis")
.attr("fill", "none")
.attr("stroke", "black")
.style("shape-rendering", "crispEdges")
.attr("transform", "translate(0," + height + ")")
.call(xAxis)
.selectAll("text")
.style("text-anchor", "end")
.attr("dx", "-.6em")
.attr("dy", "-0.195em")
.attr("transform", function (d) {
return "rotate(-90)"
});
svg.append("g")
.attr("class", "yAxis")
.attr("fill", "none")
.attr("stroke", "black")
.attr("shape-rendering", "crispEdges")
.call(yAxis)
.append("text")
.attr("transform", "rotate(-90)")
.attr("y", 6)
.attr("dy", ".71em")
.style("text-anchor", "end")
.text("Y-Axis Label");
Run Code Online (Sandbox Code Playgroud)
我也有一个饼图。我设法将所有 CSS 样式转换为内联样式,但是我遇到了一个新问题。图例和图形本身显示在两个不同的 SVG …
我有一个饼图,带有一个传说,是我在D3.js制作的.PHP文件解析JSON,然后该数据用于填充图表.一切都按照我想要的方式工作,除了我不能让传奇标签与正确的颜色相匹配.这是我的代码
var w = 490,
h = 400,
r = 180,
inner = 70,
color = d3.scale.category20c();
d3.json("script.php", function (data) {
var max = d3.max(data, function(d) { return d.value; });
var sum = d3.sum(data, function(d) { return d.value; });
var vis = d3.select("#chart")
.append("svg:svg")
.data([data])
.attr("width", w)
.attr("height", h)
.append("svg:g")
.attr("transform", "translate(" + r * 1.5 + "," + (r + 10) + ")")
var arc = d3.svg.arc()
.innerRadius(inner)
.outerRadius(r);
var arcOver = d3.svg.arc()
.innerRadius(inner + 5)
.outerRadius(r + 5); …Run Code Online (Sandbox Code Playgroud) 我的应用程序中有 2 个数据表。第一个 DataTable 被调用Table1,看起来像这样
-------------------------------------
| Key | Column1 | Column2 | Foreign |
|-----------------------------------|
| 0 | dsfsfsd | sdfsrer | 1 |
|-----------------------------------|
| 1 | dertert | qweqweq | NULL |
|-----------------------------------|
| 2 | prwersd | xzcsdfw | 3 |
-------------------------------------
Run Code Online (Sandbox Code Playgroud)
第二个被调用Table2,看起来像这样
----------------------------------------
| Key | Column3 | Column4 | Column5 |
|--------------------------------------|
| 1 | dsfsfsd | sdfsrer | fghfghg |
|--------------------------------------|
| 3 | prwersd | xzcsdfw | nbmkuyy …Run Code Online (Sandbox Code Playgroud) d3.js ×2
javascript ×2
jquery ×2
c# ×1
css ×1
ember-cli ×1
istanbul ×1
jestjs ×1
legend ×1
linq ×1
reactjs ×1
semantic-ui ×1
svg ×1
unit-testing ×1
validation ×1