我是Material-UI的新手,刚开始使用菜单示例摆弄他们的App栏.当切换菜单下拉菜单时,它会打开Appbar本身,而我希望它在Navbar下方打开.
从文档中,我知道这可以通过这里Anchor EL解释完成.但是,当我实现这个组件时,没有任何反应.什么是"正确的材料 - UI方式"来处理这个问题?menu
class Header extends React.Component {
state = {
auth: true,
anchorEl: null,
anchorOriginVertical: 'bottom',
anchorOriginHorizontal: 'right',
transformOriginVertical: 'top',
transformOriginHorizontal: 'right',
anchorReference: 'anchorEl',
};
handleChange = (event, checked) => {
this.setState({ auth: checked });
};
handleMenu = event => {
this.setState({ anchorEl: event.currentTarget });
};
handleClose = () => {
this.setState({ anchorEl: null });
};
render() {
const { classes } = this.props;
const { auth, anchorEl } …Run Code Online (Sandbox Code Playgroud) 我试图通过在tableView函数中调用startAnimation()来为tableViewCell行的高度设置动画:
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier(cellIdentifier, forIndexPath: indexPath) as! TableViewCell
tableView.rowHeight = 44.0
startAnimation(tableView)
return cell
}
//MARK: Animation function
func startAnimation(tableView: UITableView) {
UIView.animateWithDuration(0.7, delay: 1.0, options: .CurveEaseOut, animations: {
tableView.rowHeight = 88.0
}, completion: { finished in
print("Row heights changed!")
})
}
Run Code Online (Sandbox Code Playgroud)
结果:行高确实发生了变化,但没有发生任何动画.我不明白为什么动画不起作用.我是否应该在某处定义一些开始和结束状态?
我正在尝试设置我的本地环境以测试 Firebase 云功能。我遵循了他们的文档,但现在遇到了以下错误:
错误:firestore:模拟器已退出,代码为:1
我发现了关于这个问题的其他 SO 线程,但没有与我的特定日志:
i Starting emulators: ["functions","firestore","hosting"]
? Your requested "node" version "8" doesn't match your global version "12"
? functions: Emulator started at http://localhost:5001
i firestore: Logging to firestore-debug.log
? firestore: Emulator started at http://localhost:8080
Error: firestore: emulator has exited with code: 1
Run Code Online (Sandbox Code Playgroud)
该firestore-debug.log文件并没有真正暗示我的方向:
Exception in thread "main" java.lang.UnsupportedClassVersionError: com/google/cloud/datastore/emulator/firestore/CloudFirestore : Unsupported major.minor version 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at …Run Code Online (Sandbox Code Playgroud) 我是一个相对较新的编程和使用bootstrap 3.0制作网站.
我想在页面中间制作两行.对于我使用的第一行div class="col-md-4 col-md-offset-2"和第二行div class="col-md-4".
我的第一个问题是,如果可以增加10行而不是12行,或者如果我还需要指定右边的2行呢?如果是这样,怎么办呢?
另外我想增加列之间的水平间距.我对此进行了一些研究并遇到了mixins,但它很难让我掌握.如果这里的任何人可以为我提供一种简单的方法来增加两列之间的水平间距,那将是很好的.
提前致谢.
如何等待异步componentDidMount()在渲染之前完成?
我的app.jsx:
constructor(props) {
super(props);
this.state = {
loggedInUser: null,
isAuthenticated: false,
isAuthenticating: true
};
}
componentDidMount() {
try {
var user = authUser();
console.log('User: ' + user)
if (user) {
console.log('Is logged in: ' + this.state.loggedInUser)
this.userHasAuthenticated(true);
}
}
catch(e) {
alert(e);
}
this.setState({ isAuthenticating: false });
}
render() {
console.log('in render: ' + this.state.loggedInUser)
// Should execute **after** authUser() in componentDidMount has finished
...
}
Run Code Online (Sandbox Code Playgroud)
componentDidMount调用此异步函数:
function authUser() {
firebase.auth().onAuthStateChanged(function(user) {
return user
})
}
console.log('in render: ' …Run Code Online (Sandbox Code Playgroud) 我正在通过 dev_appserver 在本地运行标准的应用引擎环境,无法摆脱以下错误:
导入错误:没有名为 google.auth 的模块
完整追溯(用 替换个人详细信息...):
Traceback (most recent call last):
File "/Users/.../google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 240, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "/Users/.../google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 299, in _LoadHandler
handler, path, err = LoadObject(self._handler)
File "/Users/.../google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 85, in LoadObject
obj = __import__(path[0])
File "/Users/.../.../main.py", line 6, in <module>
from services.get_campaigns import get_campaigns
File "/Users/.../.../get_campaigns.py", line 3, in <module>
from googleads import adwords
File "/Users/.../.../lib/googleads/__init__.py", line 17, in <module>
from ad_manager import AdManagerClient
File "/Users/.../lib/googleads/ad_manager.py", line 28, in <module> …Run Code Online (Sandbox Code Playgroud) 我正在尝试对两个单独页面上显示的组件运行完全相同的赛普拉斯测试。为了实现这一目标,我想我应该使用一个forEach语句,以便为每个“状态”运行相同的代码(参见下面的代码)。
问题在于,在状态 #1 的测试完成之前before,语句中的代码块开始针对状态 #2 运行。这会导致状态 #1 的测试失败(因为它具有状态 #2 固定装置)。
如何使before状态 #2 的部分等待状态 #1 中的所有测试完成?
const states = [
{
"startPath": "/path1",
"fixture": "fixture1"
},
{
"startPath": "/path2",
"fixture": "fixture2"
}
]
describe('Start test', function() {
// Loop through both test
states.forEach((state) => {
// In this before statement the fixtures are setup
before(function () {
cy.flushDB()
cy.fixture(state.fixture)
.then(fixtureData => {
new Cypress.Promise((resolve, reject) =>
cy.createCollections(fixtureData, resolve, reject)
)
})
.then(() => cy.visit(state.startPath)) …Run Code Online (Sandbox Code Playgroud) 在我的 create react app 项目中,我在生产版本(不是在我的开发版本中)遇到了以下错误:
Uncaught TypeError: (0 , o.default) is not a function at Object.ef(:4444/anonymous function)...
我一直在调查这个错误几个小时,但很难找出如何调试这个丑陋的 js。
使问题变得困难的是错误返回o .default 而不是SomeLibrary .default 所以我真的不知道从哪里开始我的搜索......
在这种情况下,o .default 是什么意思?有什么提示可以找出这里出了什么问题?
我想构建一个页面,用户可以通过单击按钮选择多个项目.我已经使用了焦点和活动类来使按钮改变外观但是使用我当前的代码我只能激活一个按钮.我正在寻找能够让用户激活多个按钮的代码.
HTML
<button class="btn btn-1">
button 1
</button>
<button class="btn btn-1">
button 2
</button>
<button class="btn btn-1">
button 3
</button>
<button class="btn btn-1">
button 4
</button>
Run Code Online (Sandbox Code Playgroud)
CSS
.btn:hover {
background-color: rgba(52, 152, 219,0.6);
}
.btn:focus {
background-color: rgba(52, 152, 219,0.6);
}
.btn:active, .btn:visited {
background-color: rgba(52, 152, 219,0.6);
}
.active {
background-color: rgba(52, 152, 219,0.6);
}
Run Code Online (Sandbox Code Playgroud)
这是我一直用来尝试为已经点击的按钮添加永久活动类的jQuery代码.这还没有用.
$(document).ready(function(){
$('.btn').click(function() {
$('.btn').addClass('active');
});
});
Run Code Online (Sandbox Code Playgroud) 我正在使用Eureka表单构建器构建表单,但不明白我如何获取表单中的值.他们在这里提供了文档中的说明.
表单结果传递给字典:
您可能已经注意到结果字典键是行标记值,值是行值.只有具有标记值的行才会添加到字典中.
我的代码:
override func viewDidLoad() {
super.viewDidLoad()
form =
Section()
<<< NameRow() { // NameRow is dictionary key, right?
$0.title = "Name:"
$0.value = "My name" // This is what should be printed
}
let dict = form.values(includeHidden: true)
// PROBLEM: This prints nil
print(dict["NameRow"])
}
Run Code Online (Sandbox Code Playgroud)
而这里是制定法令的公共功能
public func values(includeHidden includeHidden: Bool = false) -> [String: Any?]{
if includeHidden {
return allRows.filter({ $0.tag != nil })
.reduce([String: Any?]()) {
var result = $0
result[$1.tag!] = $1.baseValue …Run Code Online (Sandbox Code Playgroud) 我正在使用以下异步函数将数据写入Firebase实例:
function writeUserData(uid, fn, ln, userEmail) {
firebase.database().ref('users/' + uid).set({
firstName: fn,
lastName: ln,
email: userEmail
});
};
Run Code Online (Sandbox Code Playgroud)
一旦writeUserData完成,那么我想将用户重定向到另一个页面:
window.location.href = "./mypage.html";
Run Code Online (Sandbox Code Playgroud)
据我所知,这可以通过承诺来完成,但是我真的可以用一个很好的例子来解决这个问题。
firebase ×3
javascript ×3
reactjs ×3
swift ×2
animation ×1
css ×1
cypress ×1
eureka-forms ×1
grid-layout ×1
html ×1
jquery ×1
material-ui ×1
python ×1
spacing ×1
uitableview ×1