我用一些条件写了一个简单的事件监听器,奇怪的是数组playerGuess替换了数组allPlayerGuesses,而不是按预期推送。有人能说出我错过了什么吗?
// The cookie needs to be First in the chain.
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = "CustomExternal",
AuthenticationMode = AuthenticationMode.Passive,
CookieName = "MyAwesomeCookie",
ExpireTimeSpan = TimeSpan.FromMinutes(5),
//Additional custom cookie options....
});
//Note that SignInAsAuthenticationType == AuthenticationType
app.UseGoogleAuthentication(new GoogleOAuth2AuthenticationOptions
{
AuthenticationType = "GoogleBackOffice",
ClientId = "abcdef...",
ClientSecret = "zyxwv....",
SignInAsAuthenticationType = "CustomExternal"
});
答案 0 :(得分:0)
我遇到了这个问题。 当你执行allPlayerGuesses.push(playerGuess)时,它不仅会将其插入allPlayerGuesses,还会替换数组中playerGuess的现有值。您可以通过检查allPlayerGuesses的长度来验证这一点。这将在allPlayerGuesses中创建重复的条目。
解决方案是在每次进入点击事件时初始化playerGuess。
{{1}}
这可以解决您的问题。