我有一个元素class='myTestClass'
.如何将css样式应用于此元素的所有子元素?我只想将样式应用于元素子元素.不是它的大孩子.
我可以用
.myTestClass > div {
margin: 0 20px;
}
Run Code Online (Sandbox Code Playgroud)
哪个适合所有div
孩子,但我想找一个适合所有孩子的解决方案.我以为我可以用*
,但是
.myTestClass > * {
margin: 0 20px;
}
Run Code Online (Sandbox Code Playgroud)
不起作用.
编辑
该.myTestClass > *
选择不使用Firefox 26应用规则,并有根据萤火没有其他规则的保证金.和它的作品,如果我取代*
用div
.
如何关闭Google文档中的分页符,以便我只有一个连续滚动文档?
我从不想打印出我的Google文档.分页符分散了注意力并弄乱了我的格式.(例如,当我有一个带有脚注的表格跨越页面边界时,脚注就会破坏表格!)
我正在尝试Firestore,而且我遇到了一些非常简单的事情:"更新一个数组(也就是一个子文档)".
我的DB结构非常简单.例如:
proprietary: "John Doe",
sharedWith:
[
{who: "first@test.com", when:timestamp},
{who: "another@test.com", when:timestamp},
],
Run Code Online (Sandbox Code Playgroud)
我正在尝试(没有成功)将新记录推送到shareWith
对象数组中.
我试过了:
// With SET
firebase.firestore()
.collection('proprietary')
.doc(docID)
.set(
{ sharedWith: [{ who: "third@test.com", when: new Date() }] },
{ merge: true }
)
// With UPDATE
firebase.firestore()
.collection('proprietary')
.doc(docID)
.update({ sharedWith: [{ who: "third@test.com", when: new Date() }] })
Run Code Online (Sandbox Code Playgroud)
没有用.这些查询会覆盖我的数组.
答案可能很简单,但我找不到......
谢谢
我是React的新手,我正在尝试DATA
从外部文件导入JSON 变量.我收到以下错误:
找不到模块"./customData.json"
有人可以帮助我吗?如果我有DATA
变量index.js
但它不在外部JSON文件中时,它可以工作.
import React, {Component} from 'react';
import ReactDOM from 'react-dom';
import customData from './customData.json';
import Profile from './components/profile';
import Hobbies from './components/hobbies';
class App extends Component {
render() {
return (
<div>
<Profile name={this.props.profileData.name}imgUrl={this.props.profileData.imgURL} />
<Hobbies hobbyList={this.props.profileData.hobbyList}/>
</div>
);
}
}
ReactDOM.render(<App profileData={DATA}/>, document.querySelector('.container'));
Run Code Online (Sandbox Code Playgroud)
hobbies.js
import React, {Component} from 'react';
var Hobbies = React.createClass({
render: function(){
var hobbies = this.props.hobbyList.map(function(hobby, index){
return (<li key={index}>{hobby}</li>);
});
return (
<div>
<h5>My hobbies:</h5> …
Run Code Online (Sandbox Code Playgroud) 看看这个React Router Dom v4示例https://reacttraining.com/react-router/web/example/auth-workflow我看到PrivateRoute组件破坏了这样的休息道具
const PrivateRoute = ({ component: Component, ...rest }) => (
<Route {...rest} render={props => (
fakeAuth.isAuthenticated ? (
<Component {...props}/>
) : (
<Redirect to={{
pathname: '/login',
state: { from: props.location }
}}/>
)
)}/>
)
Run Code Online (Sandbox Code Playgroud)
我想确定这{ component: Component, ...rest }
意味着:
从
props
,获取Component prop,然后获取给你的所有其他道具,并重命名props
为,rest
这样你就可以避免使用传递给Routerender
函数的props的命名问题
我对吗?
当我尝试初始化Firebase Cloud Firestore时,遇到以下错误:
未捕获的TypeError:WEBPACK_IMPORTED_MODULE_0_firebase .firestore不是函数
我npm install firebase --save
以前安装了firebase .
import * as firebase from 'firebase';
import router from '../router';
const config = {
apiKey: "a",
authDomain: "a",
databaseURL: "a",
projectId: "a",
storageBucket: "a",
messagingSenderId: "a"
};
if(!firebase.apps.length){
firebase.initializeApp(config);
let firestore = firebase.firestore();
}
Run Code Online (Sandbox Code Playgroud) 有没有办法从其内部的元素属性传递参数到Polymer函数<template>
?
<script src="http://www.polymer-project.org/1.0/samples/components/webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="http://www.polymer-project.org/1.0/samples/components/polymer/polymer.html" />
<dom-module id="example-element">
<template>
...
<paper-button id="foo" on-tap="bar">Click</paper-button>
...
</template>
</dom-module>
<script>
(function() {
Polymer({
is: 'example-element',
properties: {...},
bar: function(arg){
// Do stuff using argument arg
}
});
})();
</script>
Run Code Online (Sandbox Code Playgroud)
我已经梳理了关于此事的沉默文件.它没有说你是否可以.但是当我尝试它时,它失败了.但也许我没有正确地做到这一点.所以我需要一些帮助.
我唯一遇到的是事件监听器,它似乎无法接受我想传递的参数.说,一个id
或一个name
.
我尝试过(不成功)做的事情:
<paper-button id="foo" on-tap="bar('foo')"> Click </paper-button>
Run Code Online (Sandbox Code Playgroud)
但似乎没什么用.
事件监听器的想法不起作用,因为它们限制了参数,我无法得到,比方说,id
我需要.
未处理的拒绝(错误):操作必须是普通对象.使用自定义中间件进行异步操作.
详细信息:我想在每个帖子中添加评论.因此,当运行获取帖子时,我想为所有帖子调用fetch comment API.
这是我的代码:
export function bindComments(postId) {
return API.fetchComments(postId).then(comments => {
return {
type: BIND_COMMENTS,
comments,
postId
}
})
}
Run Code Online (Sandbox Code Playgroud)
谢谢
我正在尝试使用User-Alice的登录凭据登录firebase.
但是当我通过授权程序时,我收到一条消息,说我以User-Bob身份登录.这在文档中没有提到,也没有解释如何更改我登录的用户.
如何将Firebase登录用户从User-Bob更改为User-Alice?
今天,Firebase发布了全新的Cloud Products for Firebase产品,我刚创建了一个hello world功能,并将其部署在我现有的firebase项目中.
看起来它捆绑所有依赖项并将其上传到firebase就像aws lambda函数一样.但即使在代码的微小变化上也需要太多时间才能完成,并且还需要良好的互联网连接.如果由于某种原因您处于脱机状态,那么在您可以在本地计算机上执行和测试该功能的方法之前,您所处的代码就处于黑暗状态.
有没有办法在本地测试Firebase的云功能?
function node.js firebase google-cloud-functions firebase-cloud-functions
firebase ×4
javascript ×3
reactjs ×3
arrays ×1
command-line ×1
css ×1
function ×1
google-docs ×1
json ×1
node.js ×1
object ×1
polymer ×1
polymer-1.0 ×1
react-redux ×1
react-router ×1