我想看所有文件深深嵌套在模板中,但在构建后排除任何文件夹.
所以排除目录,如:
./templates/foo/build/**/*
./templates/bar/build/**/*
但包括目录和文件,如:
./templates/foo/template.html
./templates/foo/css/**/*
./templates/bar/template.html
./templates/bar/css/**/*
目前我成功地列出了子子文件夹名称和子子文件类型
gulp.watch(['templates/*/*.html','templates/*/*.js',
'templates/*/*.json','templates/*/css/**/*',
'templates/*/js/**/*'], ['build_templates']);
Run Code Online (Sandbox Code Playgroud)
但我真的希望每次添加特定的子子文件夹或子子文件类型时都能够停止更新表达式.怎么能包括除了?
我试图使用$regex内部$match,它不返回匹配的文件.
db.collection('MyCollection', function (err, collection) {
collection.aggregate([
{ $match: { 'Code': 'Value_01', 'Field2': { $regex: '/Value_2/g' } } },
{ $project: {
_id: 1,
CodeNumber: '$Code',
FieldName2: '$Field2'
}
}
], function (err, Result_doc) {
console.log(Result_doc);
}
});
Run Code Online (Sandbox Code Playgroud)
谁能告诉我哪里出错或语法正确?
'Field2': { $regex: /Value_2/g }
Run Code Online (Sandbox Code Playgroud) 控制台中的完整错误:
未捕获(在承诺中)错误:对象无效作为React子对象(找到:具有键{id,name,description,css,ephemeral,readonly,topPost}的对象)
如果您要渲染子集合,请使用数组相反,或使用React附加组件中的createFragment(object)包装对象.检查exports.(...)的渲染方法
我真的不知道这个错误意味着什么,它并没有指向代码中的一行,所以我不知道该怎么做.
我正在使用api.jsx从Imgur获取数据(特别是我在topic-store.jsx中调用它),然后尝试在topic-list.jsx中呈现数据
main.jsx
var React = require('react');
var Header = require('./header');
var TopicList = require('./topic-list');
module.exports = React.createClass({
render: function () {
return <div>
<Header />
{this.content()}
</div>
},
content: function () {
if (this.props.children) {
return this.props.children
} else {
return <TopicList/>
}
}
});
Run Code Online (Sandbox Code Playgroud)
header.jsx
var React = require('react');
var Router = require('react-router');
var Link = Router.Link; //Router's Link object is a renderable component, that turns into …Run Code Online (Sandbox Code Playgroud) 我在chrome扩展(内容脚本)中发出JSONP请求.当我作为网页运行 - 在我的浏览器中加载HTML文件时,一切都运行良好,但是当我将其作为chrome扩展加载时,当服务器给出响应时,jquery创建的jsonp回调函数似乎不存在.
我的控制台说:
Uncaught ReferenceError: jQuery17105683612572029233_1323808231542 is not defined
Run Code Online (Sandbox Code Playgroud)
这是我的ajax请求:
$.ajax({
url: 'http://example.com',
data:
{
imgUrl: this.href,
returnString:true
},
dataType: "jsonp",
success: function(msg){
newNode.src = msg.data;
},
error: function(msg){
console.log(msg.data);
}
})
Run Code Online (Sandbox Code Playgroud) 我有这个AngularJS代码试图在textarea中没有文本时显示标签旁边的两颗星.相同的代码适用于输入标记,但不适用于textarea.
<div class="input-left">
<label for="email">
<span ng-show="contactform.email.$error.required" class="required">*</span>Email:
</label>
<input ng-model="email" type="text" name="email" id="email" required></br></br>
<label for="budget">Budzet:</label>
<input ng-model="budget" type="text" name="budget" id="budget">
</div>
<div class="clearboth">
<label for="msg" class="left" >
<span ng-show="contactform.msg.$error.required" class="required">**</span>Pitanja ili Komentari?
</label>
<textarea ng-model="msg" rows="8" cols="50" class="input-no-width rounded shaded left clearboth" id="msg" required></textarea>
</div>
Run Code Online (Sandbox Code Playgroud)
根据AngularJS文档 - textarea的行为与输入相同.
我最近使用docker image gitlab/gitlab-runner:9.1.0与gitlab容器一起使用了一些CI.发生错误并使用不同的版本推荐类似的支持请求,所以我尝试了:latest一些:1.11也是.不幸的是它一直告诉我这个错误:
Running with gitlab-ci-multi-runner 1.11.4 (5e7ba4a)
on foo (02cdacdc)
Using Docker executor with image pretzlaw/php:7.1-apache ...
Starting service mariadb:latest ...
Pulling docker image mariadb:latest ...
Waiting for services to be up and running...
Pulling docker image pretzlaw/php:7.1-apache ...
Running on runner-02cdacdc-project-7-concurrent-0 via 9d1d33dc9212...
Fetching changes...
HEAD is now at 7580815 QA: CI Lint
From http://idgaf.example.org/foo/bar
7580815..affeede develop -> origin/develop
Checking out affeede as develop...
Skipping Git submodules setup
[: 1: [: Syntax …Run Code Online (Sandbox Code Playgroud) 我正在编写我的服务,使用PostGres的sequelize更新一行.当我使用PSequel试用我的查询时它工作正常:
UPDATE "test_table" SET "test_col"=NULL WHERE "id"= '2'
Run Code Online (Sandbox Code Playgroud)
但是使用sequelize会抛出500错误:
db.TestTable.update({ testCol: NULL }, { where: { id: id } })
.then((count) => {
if (count) {
return count;
}
});
Run Code Online (Sandbox Code Playgroud)
我的模型确实允许null,我认为是允许空值为默认值以及设置:
testCol: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: null,
field: 'test_col'
},
Run Code Online (Sandbox Code Playgroud)
除NULL之外的任何其他值都按预期工作.设置空值有不同的方法吗?
我正在学习本教程,但我不断收到此错误:
'react-router'不包含名为'browserHistory'的导出.
具有react-router的文件是这样的:
import React from 'react';
import ReactDOM from 'react-dom';
import { Router, browserHistory } from 'react-router';
import routes from './routes';
ReactDOM.render(
<Router history={browserHistory} routes={routes} />,
document.getElementById('root')
);
Run Code Online (Sandbox Code Playgroud) 我是React Native的新手,但对React非常熟悉.作为一个初学者,我正在寻找在云服务器之间建立连接并使用websockets建立反应原生,正如我在文档中看到的那样.不幸的是,没有像样的例子可以帮助我.这就是我到目前为止所做的一切:
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
Button
} from 'react-native';
export default class raspberry extends Component {
constructor(props) {
super(props);
this.state = { open: false };
this.socket = new WebSocket('ws://127.0.0.1:3000');
this.emit = this.emit.bind(this);
}
emit() {
this.setState(prevState => ({ open: !prevState.open }))
this.socket.send("It worked!")
}
render() {
const LED = {
backgroundColor: this.state.open ? 'lightgreen' : 'red',
height: 30,
position: 'absolute',
flexDirection: 'row',
bottom: 0,
width: 100,
height: 100,
top: 120, …Run Code Online (Sandbox Code Playgroud) 我正在使用React/Redux并将动画数据存储在JSON中并尝试将其显示在React页面上.
我正在使用setTimeout(暂停)和setInterval(用于动画运动).但是,我似乎无法理解如何正确实现动画,并认为我的事情完全是错误的.
JSON数据:
"objects": [
{
"title": "puppy",
"image_set": [
{
"image": "images/puppy_sitting.png",
"startx": 520,
"starty": 28,
"pause": 1000
},
{
"image": "images/puppy_walking.png",
"startx": 520,
"starty": 28,
"endx": 1,
"endy": 1,
"time": 1000
},
{
"image": "images/puppy_crouching.png",
"startx": 1,
"starty": 1,
"endx": 500,
"endy": 400,
"time": 2000
}
]
},
{
"title": "scorpion",
"image_set": [
{
"image": "images/scorping_sleeping.png",
"startx": 100,
"starty": 400,
"pause": 5000
},
{
"image": "images/scorpion_walking.png",
"startx": 100,
"starty": 400,
"endx": 500,
"endy": 400, …Run Code Online (Sandbox Code Playgroud) javascript ×7
reactjs ×4
node.js ×2
angularjs ×1
animation ×1
database ×1
docker ×1
gitlab ×1
gitlab-ci ×1
gulp ×1
jquery ×1
jsonp ×1
mongodb ×1
postgresql ×1
react-native ×1
react-router ×1
redux ×1
sequelize.js ×1
websocket ×1