如何使用react-router,并将链接导航到特定页面上的特定位置?(例如/home-page#section-three)
细节:
我正在使用react-router我的React应用程序.
我有一个站点范围的导航栏,需要链接到页面的特定部分,如/home-page#section-three.
因此,即使您在说/blog,单击此链接仍将加载主页,第三部分滚动到视图中.这正是标准的<a href="/home-page#section-three>运作方式.
注意:react-router的创建者没有给出明确的答案.他们说它正在进行中,并且同时使用其他人的答案.我会尽力保持这个问题的最新进展和可能的解决方案,直到出现主导的问题.
研究:
这个问题是从2015年(所以10年前的反应时间).最受欢迎的答案是用来HistoryLocation代替HashLocation.基本上这意味着将位置存储在窗口历史记录中,而不是存储在哈希片段中.
坏消息是......即使使用HistoryLocation(大多数教程和文档在2016年所说的内容),锚标签仍然不起作用.
https://github.com/ReactTraining/react-router/issues/394
ReactTraining上的一个线程,关于如何使用anchor链接与react-router.这是没有确认的答案.要小心,因为大多数建议的答案都已过时(例如使用"哈希"道具<Link>)
Yahoo的Finance API的查询限制是多少?或者描述限制的文档在哪里?
对于所有雅虎的API,我只能找到所有API的一般文档.如果你知道雅虎财务API的文档在哪里,也值得赞赏.(我一直在谷歌搜索几天,在雅虎的API网站上,最后转向SO的朋友)
谢谢!
我<div>在父容器中有两个子元素<div>,如下所示:
<div class="row">
<div class="item">
<p>Sup?</p>
</div>
<div class="item">
<p>Sup?</p>
<p>Wish that other guy was the same height as me</p>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
我尝试了以下CSS:
.item {
background: rgba(0,0,0,0.1);
display: inline-block;
}
.row {
border: 1px solid red;
}
Run Code Online (Sandbox Code Playgroud)
我怎样才能让两个孩子(div.item)成为最高孩子的身高?
jsFiddle:http://jsfiddle.net/7m4f7/
我正在开发一个Rails 4应用程序.在我的笔记本电脑上,开发完成了localhost:3000.该网站的实际域名是roomidex.com.
如何设置Facebook应用程序以便它适用于生产和开发?
这是当前的配置:
App Domains: roomidex.com
Website With Facebook Login:
Site URL: http://www.roomidex.com
Run Code Online (Sandbox Code Playgroud)
当我尝试在localhost:3000上进行Facebook登录时,我发现这并不奇怪:
{
"error": {
"message": "Invalid redirect_uri: Given URL is not allowed by the Application configuration.",
"type": "OAuthException",
"code": 191
}
}
Run Code Online (Sandbox Code Playgroud) 我不小心做了一个"hg commit --amend"而不是一个提交.如何在修改之前回滚提交?
转到此站点,单击右上角的"登录",将弹出一个twitter-bootstrap模式窗口,但显示为灰色.
为什么会这样?
当你将鼠标悬停在一个上面时<div>,我希望<a>页面的一个单独部分也可以"悬停".
<div class="initiator">
</div>
<div>
<a class="receiver href="#">Touch the div and I get hovered!</a>
</div>
Run Code Online (Sandbox Code Playgroud)
我已经尝试过这个jQuery,但它不会触发<a>悬停的CSS.
$(".initiator").hover(function(){
$(".receiver").hover();
console.log("div was hovered");
});
Run Code Online (Sandbox Code Playgroud) 可能重复:
自定义属性 - 是或不是?
可以为HTML元素分配任意属性吗?
例如:
<div imMakingUpAnAttribute="whatever"></div>
Run Code Online (Sandbox Code Playgroud) 我正在使用FormData上传文件.我还想发送一系列其他数据.
当我发送图像时,它工作正常.当我将一些文本附加到formdata时,它工作正常.当我尝试在下面附加'tags'数组时,其他一切工作正常但没有发送数组.
FormData和附加数组的任何已知问题?
实例化formData:
formdata = new FormData();
我创建的数组.Console.log显示一切正常.
// Get the tags
tags = new Array();
$('.tag-form').each(function(i){
article = $(this).find('input[name="article"]').val();
gender = $(this).find('input[name="gender"]').val();
brand = $(this).find('input[name="brand"]').val();
this_tag = new Array();
this_tag.article = article;
this_tag.gender = gender;
this_tag.brand = brand;
tags.push(this_tag);
console.log('This is tags array: ');
console.log(tags);
});
formdata.append('tags', tags);
console.log('This is formdata: ');
console.log(formdata);
Run Code Online (Sandbox Code Playgroud)
我是怎么发的:
// Send to server
$.ajax({
url: "../../build/ajaxes/upload-photo.php",
type: "POST",
data: formdata,
processData: false,
contentType: false,
success: function (response) {
console.log(response);
$.fancybox.close();
}
});
Run Code Online (Sandbox Code Playgroud) 我有一个rails应用程序没有应用到我的schema.rb.迁移应该创建一个表:
class CreateUserGraphs < ActiveRecord::Migration
def change
create_table :user_graphs do |t|
t.string :name
t.string :content
t.integer :user_id
t.string :type_id
t.integer :upload_id
t.timestamps
end
add_index :user_graphs, [:user_id, :created_at]
end
end
Run Code Online (Sandbox Code Playgroud)
我做db:reset.然后我尝试了rake db:migrate:up VERSION = 123123123(这是迁移#).我在"开发"环境中.
为什么迁移不会影响schema.rb?
ruby-on-rails database-migration rails-migrations ruby-on-rails-4