我的应用程序使用 Mithril.js 和 Play Framework。
我想知道是否有一种(好的)方法可以在秘银和游戏之间划分我的应用程序。我想让 play 呈现一个 login.html,这个 login.html 将只包含我的 mithril.js 组件(login.js)的导入。如果登录成功,我想将我的应用程序重定向到另一个 html 页面。此页面将包含我所有秘银组件的所有导入。
所以我的应用程序在播放框架方面只有两个 html 页面,一个只导入一个秘银组件,另一个导入所有其他组件(仅在检查凭据时)。
播放路由器:
GET / 控制器.Index.index
播放控制器:
def index = Action { Ok(views.html.login()) }
登录.html
<!DOCTYPE html>
<html lang="en">
<head>
<title>IHM</title>
StylesSheet import..
</head>
<body id="app" class="body">
<script src="https://cdnjs.cloudflare.com/ajax/libs/mithril/0.2.2-rc.1/mithril.min.js"></script>
<script src="@routes.Assets.versioned("javascripts/claravista/login.js")" type="text/javascript"></script>
<script type="text/javascript">
m.route.mode = "pathname";
m.route(document.getElementById('app'), "/", {
"/": login,
});
</script>
</body>
Run Code Online (Sandbox Code Playgroud)Mithril 询问播放检查凭据(在组件登录中)
m.request({method: "PUT", url: "/check-user", data : login.user }).then(returnCall);
Case Credentials false : 再问一次(我已经做了这部分)
Case Credentials true:重定向到另一个 html …
is there no event capturing? Id like to force event handling order, in autocomplete component, onblur event fires before onclick on item in a list, causing the list to toggle twice and so remaining visible after flickering.
在jQuery中
$('html head').length // 1
Run Code Online (Sandbox Code Playgroud)
和
$('html').find('head').length // 1
Run Code Online (Sandbox Code Playgroud)
和
$('html').find('head').filter('html head').length // 1
Run Code Online (Sandbox Code Playgroud)
但
$('html').find('html head').length // 0
Run Code Online (Sandbox Code Playgroud)
为什么?
javascript jquery jquery-selectors dom-traversal jquery-traversing
使用数组解构,可以通过插入逗号而不使用前面的引用来丢弃前导项:
const [ , two ] = [ 1, 2 ]
Run Code Online (Sandbox Code Playgroud)
函数签名也是如此 - 以下代码不会解析,因为签名中的前导逗号是意外的:
function ditchFirstArgument( , second ){}
Run Code Online (Sandbox Code Playgroud)
为什么我需要为ES6函数表达式中的前导参数提供参考?
据我所知,x++基本上是一种说法x = x + 1.到目前为止,这么清楚.在前端Javascript中,我偶尔会看到++x- 我似乎记得从jsPerf测试中我再也找不到了(一个Google如何++有效?)这在某个特定版本的IE中以某种方式获得了小的性能优势,并让它去那.
但是我最近遇到了一些在执行顺序(JS代码)中出现奇怪怪癖的东西:
var x = 1;
console.log(x++); // 1 (?!)
console.log(x); // 2
Run Code Online (Sandbox Code Playgroud)
...而
var x = 1;
console.log(++x); // 2 (what I would've expected)
console.log(x); // 2
Run Code Online (Sandbox Code Playgroud)
我无法理解这一点.当操作和赋值在括号内时,我们如何返回未修改的变量,因此在console.log调用之前应该执行所有权限,更不用说执行和返回了?
javascript operators execution variable-assignment order-of-execution
javascript ×5
mithril.js ×2
ecmascript-6 ×1
execution ×1
jquery ×1
operators ×1
parsing ×1
scala ×1