我理解变量检测在Angular 5.0中是如何工作的.
有人可以帮助我理解React中的相同功能以及它与Angular的不同之处是什么?
要求:我需要基于元素高度的平滑动画(由子元素驱动)
注意:请点击元素展开
JSFiddle:https : //jsfiddle.net/Lhmq0oqz/4/
我尝试过的:元素结构如下
document.querySelector('.parent').addEventListener('click', function(eve) {
eve.currentTarget.className.indexOf('expand') == -1 ? eve.currentTarget.className = 'parent expand' : eve.currentTarget.className = 'parent';
});Run Code Online (Sandbox Code Playgroud)
.parent {
max-height: 200px;
width: 400px;
background-color: yellow;
transition: max-height 1s ease;
overflow: auto;
}
.child-wrap {
width: 100%;
}
.child1 {
width: 100%;
background-color: green;
transition: height 1s;
}
.child2 {
height: 0px;
width: 0px;
background-color: red;
transition: height 1s;
}
.parent.expand {
max-height: 400px;
}
.expand .child-wrap{
display:table
}
.expand .child2 …Run Code Online (Sandbox Code Playgroud)要求:需要匹配所有以/public/ token开头的url 。
我尝试过的:我尝试了下面的正则表达式来匹配所有以 /public/ 开头的路径
正则表达式: /\/public\/.*/
当我在 regex101 中使用它时,它能够匹配以 /public/ token 开头的 url
但是当在 Express 路由器测试器(http://forbeslindesay.github.io/express-route-tester/?_ga=1.180272292.1056934125.1459765156)中尝试相同时,它不起作用
任何人都可以帮助我知道它不起作用的原因!
示例代码:
我的期望是所有用 /public/ 令牌声明的 URL 都应该通过这条路线
router.route(/\/public\/.*/)
.get(function(req, res, result){
// TODO
});
Run Code Online (Sandbox Code Playgroud)
例子:
https://localhost:8082/public/styles/styles.css
https://localhost:8082/public/js/rs.css
https://localhost:8082/public/images/qq.png
Run Code Online (Sandbox Code Playgroud) 我知道调用和应用方法的工作原理,但是要问这个问题,让我理解流程有些棘手。有人可以帮我理解这一点。
console.log.call.call.call.call.call.apply(a => a, [1, 2]);Run Code Online (Sandbox Code Playgroud)
angular ×1
animation ×1
css ×1
express ×1
javascript ×1
node.js ×1
reactjs ×1
regex ×1
url-routing ×1
virtual-dom ×1