一般来说,mongodb和数据库都是新手.每当我运行时,mongo
我收到此错误消息:
MongoDB shell version: 2.4.9
connecting to: test
Thu Jan 30 13:03:33.170 Error: couldn't connect to server 127.0.0.1:27017
at src/mongo/shell/mongo.js:145
exception: connect failed
Run Code Online (Sandbox Code Playgroud)
运行mongod
我看到这一点:
Thu Jan 30 13:13:36.588 [initandlisten] MongoDB starting : pid=29408 port=27017 dbpath=/usr/local/var/mongodb 64-bit host=Kimis-MacBook-Air-2.local
Thu Jan 30 13:13:36.588 [initandlisten]
Thu Jan 30 13:13:36.588 [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
Thu Jan 30 13:13:36.588 [initandlisten] db version v2.4.9
Thu Jan 30 13:13:36.588 [initandlisten] …
Run Code Online (Sandbox Code Playgroud) 非常新的Node和部署到Heroku.我有一个基本的React应用程序设置,我正在尝试部署到Heroku.我推了它,但应用程序失败了.当我查看日志时,我看到了一些内容sh: 1: webpack: not found
(完整记录在这里)
我不确定发生了什么,但是相信它与我的package.json有关?从我使用它的启动器模板是这样的:
{
"name": "express-react-redux-starter",
"version": "1.0.0",
"description": "Starter for Express, React, Redux, SCSS applications",
"scripts": {
"dev": "webpack-dev-server --config ./webpack/webpack-dev.config.js --watch --colors",
"build": "rm -rf dist && webpack --config ./webpack/webpack-prod.config.js --colors",
"start": "PORT=8080 node start ./server.js",
"test": "mocha --compilers js:babel-core/register --require ./test/test_helper.js --recursive ./test",
"test:watch": "npm run test -- --watch",
"lint": "eslint src test webpack"
},
"keywords": [
"ExpressJS",
"ReactJS",
"Redux",
"React hot loader",
"React Router",
"SCSS",
"Webpack Devevelopment configuration",
"Webpack …
Run Code Online (Sandbox Code Playgroud) 我一直在使用类控制打开/关闭行为与CSS转换效果.我已经在其他组件上使用了这个,没有问题,但由于某种原因,在这种情况下同样的方法让我失望了......
打开/关闭行为附加(我看到与背景颜色和translateY的结束差异),但CSS过渡本身丢失了...任何想法为什么我失去了我的CSS过渡但其他一切都按预期工作?
注意,当我使用开发人员工具手动切换打开/关闭类时,它工作得很好!CSS过渡开始了!
那么React上点击切换一个类应用,但是失去CSS转换是什么?
class Projects extends React.Component {
/* constructor, etc... */
render() {
return (
<div className="projects-nav-container">
<div className="center title monospace" onClick={this.props._toggleProjectNav} id="Menu">Menu</div>
<ul className={`projects-nav ${this.props._isProjectNavOpen ? 'open' : 'closed'}`}>
{ PROJECTS.map((project, index) =>
<li key={index} >
<p>project here</p>
</li>
) }
</ul>
</div>
);
}
}
Run Code Online (Sandbox Code Playgroud)
App.js看起来像这样:
class App extends React.Component {
constructor() {
super();
this.state = {
_isProjectNavOpen: true
}
this._toggleProjectNav = this._toggleProjectNav.bind(this);
}
_toggleProjectNav() {
this.setState(prevState => ({
_isProjectNavOpen: !prevState._isProjectNavOpen,
}));
}
render() {
<div> …
Run Code Online (Sandbox Code Playgroud) 从指令更新rootScope变量的角度方式是什么?我无法理解范围在指令中的工作方式......
到目前为止,我只能更改范围级别的变量.
app.run(['$rootScope', function($rootScope) {
$rootScope.foo = false;
}
app.directive('myDirective', [function(){
return {
restrict: 'A',
link: function(scope, elem, attrs) {
elem.bind('click', function() {
scope.$parent.foo = true;
scope.$parent.apply();
});
}
}
}]);
<!-- does not update foo -->
<p>{{ foo }}</p>
<!-- updates foo -->
<div my-directive><p>{{ foo }}</p></div>
Run Code Online (Sandbox Code Playgroud) 尽管之前在这里问过这个问题,但我无法弄清楚这一点,我感到非常愚蠢。但是谁能解释为什么我不能让滑块 div 直接位于图像 + 地图和文本内容 div 的下方(这两个应该在顶部,一个在左边,一个在右边)?显然我如何使用绝对定位是不正确的。任何建议都会很棒。谢谢。
<style>
#container .container_body .images {
float: left;
}
#container .container_body .content {
float: right;
width: 355px;
}
#container .container_body {
margin-bottom: 35px;
background-color: pink;
font-size: 22px;
}
.slider-container {
background-color: red;
/*position: absolute;*/
}
.content {
background-color: blue;
}
.images {
background-color: green;
/*position: absolute;*/
}
</style> <!-- /.style -->
<!-- container ALL -->
<div id="container">
<!-- container BODY -->
<div class="container_body">
<p>container body here.</p>
<!-- IMAGES -->
<div class="images">
<p>images here.</p>
</div> …
Run Code Online (Sandbox Code Playgroud) 将道具重新传递给孩子时(尤其是在 a 中时Route
),我感到很困惑。例如:
class App extends Component {
constructor(props) {
this.sayHi = this.sayHi.bind(this);
}
sayHi() {
console.log('hi')
}
render() {
return (
<Router>
<Route path="/projects" component={(props, state, params) =>
<ProjectList
sayHi={this.sayHi}
{...props} />}
/>
</Router>
)
}
}
const ProjectList = (props) => {
return (
<Route path={`${props.match.url}/:id`} component={(props, state, params) =>
<ProjectDetail
sayHi={props.sayHi}
{...props} />}
/>
)
}
const ProjectDetail = (props) => {
console.log(props)
}
Run Code Online (Sandbox Code Playgroud)
在ProjectList
组件中,我访问该sayHi
方法没有问题(我可以将它附加到onClick
该组件中的事件),但在ProjectDetail
组件中,我得到了一个 undefined for …