我已经使用react-router版本4 设置了React.当我直接在浏览器上输入URL时,路由工作正常,但是当我点击链接时,URL在浏览器上发生了变化(例如http:// localhost:8080/categories),但是内容不会更新(但如果我刷新,它会更新).
以下是我的设置:
该Routes.js设置如下:
import { Switch, Route } from 'react-router-dom';
import React from 'react';
// Components
import Categories from './containers/videos/Categories';
import Videos from './containers/videos/Videos';
import Home from './components/Home';
const routes = () => (
<Switch>
<Route exact path="/" component={Home}/>
<Route path="/videos" component={Videos}/>
<Route path="/categories" component={Categories}/>
</Switch>
);
export default routes;
Run Code Online (Sandbox Code Playgroud)
我在Nav.js中使用的链接如下:
<Link to="/videos">Videos</Link>
<Link to="/categories">Categories</Link>
Run Code Online (Sandbox Code Playgroud)
该App.js如下:
import React from 'react';
import './app.scss';
import Routes from './../routes';
import Nav …Run Code Online (Sandbox Code Playgroud) reactjs react-router react-redux react-router-redux react-router-v4
我有以下输入字段如下.在模糊时,该函数调用服务来更新服务器的输入值,一旦完成,它就会更新输入字段.
我怎样才能使它工作?我能理解为什么它不会让我改变字段,但我能做些什么来使它工作?
我不能使用,defaultValue因为我会将这些字段更改为其他字段
<input value={this.props.inputValue} onBlur={this.props.actions.updateInput} />
我有以下HTML格式,将给定元素放置在桌面顶部和移动设备底部(宽度<640像素)的有效方法是什么?由于有许多不同的设备,我不想写位置坐标,因为页面高度的内容会有所不同.有什么建议?
<html>
<head>
..
</head>
<body>
..
<p>I am on the top of desktop page, and bottom of mobile page</p>
...
</body>
</html>
Run Code Online (Sandbox Code Playgroud) 我有一个应用程序,它使用基于子域的不同数据库.基本上,模式将是相同的,但每个数据库的数据会有所不同.但是当我发布一些新功能并且它需要一些架构更改时,我需要运行一个命令,该命令将在所有配置的数据库上运行shards.yml.
database.yml的
default: &default
adapter: postgresql
encoding: unicode
pool: 15
host: localhost
port: 5432
username: postgres
password:
development:
<<: *default
database: app_default
production:
<<: *default
database: app_default
username: <%= ENV['BACKEND_DATABASE_USERNAME'] %>
password: <%= ENV['BACKEND_DATABASE_PASSWORD'] %>
Run Code Online (Sandbox Code Playgroud)
shards.yml
shared: &shared
adapter: postgresql
encoding: unicode
pool: 15
host: localhost
username: postgres
password:
port: 5432
octopus:
environments:
- development
- test
- production
development:
default:
<<: *shared
database: app
first:
<<: *shared
database: first
second:
<<: *shared
database: second
....
test:
test: …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用Chart.js中的饼图(http://www.chartjs.org/docs/#pieChart-exampleUsage).一切顺利,但动画会在页面加载后立即发生,但由于用户必须向下滚动才能看到图表,因此他们不会看到动画.无论如何我只能在滚动到该位置时才能启动动画?如果可能的话,每当该图表进入视图时,是否可以进行动画处理?
我的代码如下:
<canvas id="canvas" height="450" width="450"></canvas>
<script>
var pieData = [
{
value: 30,
color:"#F38630"
},
{
value : 50,
color : "#E0E4CC"
},
{
value : 100,
color : "#69D2E7"
}
];
var myPie = new Chart(document.getElementById("canvas").getContext("2d")).Pie(pieData);
</script>
Run Code Online (Sandbox Code Playgroud) 有一个用户存储,即内部部署AD.ADFS为SharePoint 2013和Power BI提供身份验证.
自定义Web应用程序需要从AD验证用户.Web应用程序后端还需要访问SharePoint REST API.
目标是使用单点登录实现上述目标.如果签入三个应用程序中的任何一个,用户不必输入其他任何一个的凭据.此外,自定义Web应用程序还显示来自SharePoint(iFrame和REST API)和Power BI(iFrame)的内容.
我们尝试了以下两种解决方案,但在任何一种情况下都遇到了问题.
什么不起作用:导航到Power BI或将其包含在iFrame中会将用户重定向到ADFS登录页面.这是因为用户尚未在浏览器中使用ADFS进行身份验证.
什么不起作用:Web应用程序无法使用从ADFS为Web应用程序收到的SAML令牌向SharePoint发出REST API请求.我们已尝试使用该SAML令牌代表登录用户从ADFS for SharePoint请求另一个令牌.这也不起作用.同样,SharePoint 2013内部部署可能不会代表请求接受.
有没有办法为所有三个应用程序提供SSO,同时还可以从Web应用程序获得对SharePoint的REST API访问?用户只需登录一次,最好只登录Web应用程序.
所以,我在ruby上有加密和解密方法,它们工作得很好.我按照这个问题的答案(如何使用CryptoJS AES解密消息.我有一个有效的Ruby示例),但它返回一个空字符串.
Ruby代码
def load_vars
@key = "2e35f242a46d67eeb74aabc37d5e5d05"
@algorithm = "aes-128-cbc"
end
def encryption(data)
begin
key = @key
aes = OpenSSL::Cipher.new(@algorithm)
aes.encrypt()
aes.key = key
iv_value = aes.random_iv
aes.iv = iv_value
crypt = aes.update(data) + aes.final()
crypt_string = (Base64.encode64(iv_value + crypt))
return crypt_string
end
end
def decryption(data)
begin
key = @key
aes = OpenSSL::Cipher.new(@algorithm)
iv_value = Base64.decode64(data)[0...16]
data_value = Base64.decode64(data)[16..-1]
aes.decrypt
aes.key = @key
aes.iv = iv_value
results = aes.update(data_value) + aes.final
return results
end
end …Run Code Online (Sandbox Code Playgroud) 我正在尝试运行bundle install,但收到以下错误消息(附上截图):
Gem::InstallError: The 'nio4r' native gem requires installed build tools.
Please update your PATH to include build tools or download the DevKit
from 'http://rubyinstaller.org/downloads' and follow the instructions
at 'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit'
An error occurred while installing nio4r (1.2.1), and Bundler cannot continue.
Make sure that `gem install nio4r -v '1.2.1'` succeeds before bundling.
Run Code Online (Sandbox Code Playgroud)
当我psql --version在railsApp容器内运行命令时,我得到9.4.12,当我在postgres容器内运行相同的命令时,我得到9.6.2. 我怎样才能让版本匹配?
当我尝试在执行pg_dumpsql 导入的Rails App 上进行迁移时,出现以下错误。
pg_dump: server version: 9.6.2; pg_dump version: 9.4.12
pg_dump: aborting because of server version mismatch
rails aborted!
Run Code Online (Sandbox Code Playgroud)
这是我的 Docker-compose.yml 文件:
version: "2.1"
services:
railsApp:
build:
context: ./
ports:
- "3000:3000"
links:
- postgres
volumes:
- .:/app
postgres:
image: postgres:9.6
ports:
- "5432:5432"
volumes:
- ./.postgres:/var/lib/postgresql
Run Code Online (Sandbox Code Playgroud)
Dockerfile:
FROM ruby:2.3.3
# setup /app as our working directory
RUN mkdir /app
WORKDIR /app
# Replace …Run Code Online (Sandbox Code Playgroud) 如何更改 Bootstrap 4 的 flexbox 网格系统的列顺序?
我有代码:
<div class="contents">
<div class="row row-1">
<div class="col-sm-6">Content Left</div>
<div class="col-sm-6">Content Right</div>
</div>
<div class="row row-2">
<div class="col-sm-6">Content Right</div>
<div class="col-sm-6">Content Left</div>
</div>
<div class="row row-3">
<div class="col-sm-6">Content Left</div>
<div class="col-sm-6">Content Right</div>
</div>
<div class="row row-4">
<div class="col-sm-6">Content Right</div>
<div class="col-sm-6">Content Left</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
我想设置它,以便每个偶数行的列顺序颠倒。到目前为止我拥有的 CSS:
.row:nth-child(2n) .col-sm-6:first-child{
float:right;
}
Run Code Online (Sandbox Code Playgroud)
JSFiddle:https ://jsfiddle.net/bq1L3gax/
javascript ×3
css ×2
reactjs ×2
adfs ×1
adfs2.0 ×1
aes ×1
bootstrap-4 ×1
charts ×1
cryptography ×1
cryptojs ×1
css3 ×1
docker ×1
flexbox ×1
html ×1
html5 ×1
html5-canvas ×1
jquery ×1
octopus ×1
onblur ×1
pg ×1
pg-dump ×1
postgresql ×1
powerbi ×1
react-redux ×1
react-router ×1
ruby ×1
sharding ×1
sharepoint ×1
windows-10 ×1