Geolocation 当前位置 API 在 IE11 windows 10 机器中不一致。下面是代码
function setCurrentPos(event, firstLoad) {
navigator.geolocation.getCurrentPosition(function (position) {
firstLoad || setCurrentLocation(event.target, position.coords);
}, function (error) {
1 === error.code && ($this.currentLocDenied = !0);
});
}
Run Code Online (Sandbox Code Playgroud)
5 次中有 4 次掉入错误块,响应代码为 2(POSITION_UNAVAILABLE),说明“无法确定当前位置。”。
出现允许用户访问位置的浏览器提示设置为允许,因此这不应成为原因。
版本信息
javascript internet-explorer-11 windows-10 google-location-services
我试图使用像这样的View Bag在我的视图上从我的控制器动作发送一个字符串值
public ActionResult Services()
{
ViewBag.TabVal = "EarnMoney";
return View();
}
Run Code Online (Sandbox Code Playgroud)
在我看来,我将View Bag值分配给这样的JavaScript变量
@section scripts{
<script>
var tab = @ViewBag.TabVal;
console.log(tab);
</script>
}
Run Code Online (Sandbox Code Playgroud)
在我的控制台上我得到了这个值
<li id="EarnMoney"> EarnMoney</li>
Run Code Online (Sandbox Code Playgroud)
这是我视图中的HTML元素.
为什么它在我的视图中选择元素而不给出一个字符串作为回报?这是非常奇怪的行为.
我试图在mongo中创建一个deleteAll方法,在其中我可以一次性删除多个记录,为该方法提供要删除的对象ID列表,如下所示
protected virtual DeleteResult DeleteAll(List<ObjectId> listId, WriteConcern concern = null)
{
return MongoCollection
.DeleteManyAsync(ItemWithListOfId(listId))
.Result;
}
protected FilterDefinition<T> ItemWithListOfId(List<ObjectId> id)
{
return Builders<T>.Filter.Eq("_id", id);
}
Run Code Online (Sandbox Code Playgroud)
它没有给出错误,但也没有删除任何记录。任何人有帮助吗?
javascript ×3
asp.net-mvc ×1
c# ×1
database ×1
flowchart ×1
mongodb ×1
nosql ×1
reactjs ×1
viewbag ×1
windows-10 ×1