如何使用border-bottom为链接加下划线设置动画,以便文本和下划线之间有空格?
我知道如何以下面的方式执行它,以便默认的text-decoration元素是动画的.但是我希望链接和下划线之间有空格,这就是为什么我认为我需要使用border-bottom.但我无法通过过渡动画获得边框底部的工作.我怎么能这样做?我试着寻找其他解决方案,但找不到任何解决方案.谢谢!
h2 > a {
position: relative;
color: #000;
text-decoration: none;
}
h2 > a:before {
content: "";
position: absolute;
width: 100%;
height: 2px;
bottom: 0;
left: 0;
background-color: #000;
visibility: hidden;
-webkit-transform: scaleX(0);
transform: scaleX(0);
-webkit-transition: all 0.3s ease-in-out 0s;
transition: all 0.3s ease-in-out 0s;
}
h2 > a:hover:before {
visibility: visible;
-webkit-transform: scaleX(1);
transform: scaleX(1);
}
Run Code Online (Sandbox Code Playgroud) 如何在每个页面加载时随机显示一个组件(使用 React)?
例如,我有两个组件:
<ComponentOne /> and <ComponentTwo />
Run Code Online (Sandbox Code Playgroud)
我想在每个页面加载时随机显示一个组件。
我应该在 componentDidMount() 中做吗?
class MyComponent extends React.Component {
loadRandomComponent() {
// return <ComponentOne /> || <ComponentTwo />
}
componentDidMount() {
this.loadRandomComponent();
}
}
Run Code Online (Sandbox Code Playgroud) 我正在使用 Rails 4、带有 Apartment gem 的子域和 Devise (3.4.1)。我对 Devise Confirmable 生成的电子邮件确认链接有疑问。当用户创建帐户时,他们会收到一封电子邮件:
You can confirm your account email through the link below:
http://lvh.me:3000/users/confirmation?confirmation_token=xsTNUw5oQYTPf_CBwZXD
Run Code Online (Sandbox Code Playgroud)
但是,它不起作用,因为用户的子域不在链接上,它应该是例如
http://mysubdomain.lvh.me:3000/users/confirmation?confirmation_token=xsTNUw5oQYTPf_CBwZXD
Run Code Online (Sandbox Code Playgroud)
如果我在浏览器上手动添加子域链接,它会确认该帐户。
如何更改confirmation_instructions.html.erb link_to 以生成前面带有子域的confirmation_url?例如:
<p>Welcome <%= @email %>!</p>
<p>You can confirm your account email through the link below:</p>
<p><%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token, :subdomain => @resource.subdomain) %></p>
Run Code Online (Sandbox Code Playgroud)
我尝试过例如https://github.com/plataformatec/devise/wiki/How-To:-Send-emails-from-subdomains和https://github.com/fortuity/rails3-subdomain-devise/wiki/Tutorial- %28Walkthrough%29但这对我来说都不起作用,我收到了错误:
"NoMethodError in Accounts#create, undefined method `subdomain' for #<User:0x...>"
Run Code Online (Sandbox Code Playgroud)
这是我的 AccountsController 中的创建操作:
def create
@account = Account.new(account_params)
if @account.valid? …
Run Code Online (Sandbox Code Playgroud) 当使用map函数打印出所有值时,如何在值之间添加逗号?(使用React,这就是为什么我有钥匙等)
{ cars.map(car => {
return(
<p key={car.id}>{car.title} ,</p>
);
}); }
Run Code Online (Sandbox Code Playgroud)
这就是我想要的结果,在最后一个数组项的末尾没有逗号:
Audi, Nissan, Mazda, Toyota
Run Code Online (Sandbox Code Playgroud)
我应该这样做吗?
{ cars.map((car, index) => {
const separator = ", ";
if(index === car.length - 1) {
return(
<p key={car.id}>{car.title} + separator </p>
);
}
});
}
Run Code Online (Sandbox Code Playgroud)