我正在为移动设备构建。
我有一个包含输入类型编号的表单。当设备语言设置为阿拉伯语时,每当我为此输入设置一个值时,它将以阿拉伯数字显示。
如果我做这样的事情:
document.getElementById('input-id').value = 444
在 UI 中,我们可以看到输入的值为??? ,这相当于阿拉伯数字中的 444。
我在 Input type="text" 中没有这个问题,因为它显示了一个字符串,所以它不会转换它们。
我知道我可以使用 Input 类型文本来代替,但我希望与我的应用程序的其余部分保持一致并使用 Input 类型编号
我在Chrome、Safari和Firefox 中遇到了这个问题。
澄清:我不想把它翻译成阿拉伯数字。我怎样才能做到这一点?
在Laravel 5.1上,一种方法不会重新发现帖子数据.
这是我的方法,其中$ request不存储post发送的数据.
class ProjectCommentController extends Controller
{
public function store(Request $request,$projectId)
{
$this->validate($request, [
'description' => ['required'],
'status' => ['required'],
'profile_id' => ['required']
]);
$project = Project::findOrFail($projectId);
return $project->comments()->save(new Comment([
'description' => $request->input('description'),
'status' => $request->input('status'),
'profile_id' => $request->input('profile_id')
]));
}
}
Run Code Online (Sandbox Code Playgroud)
这是我从测试中调用它的方式:
public function testProjectCommentCreation()
{
$category = factory(\App\Category::class)->create();
$project = factory(\App\Project::class)->create([
"category_id" => $category->id
]);
$profile = factory(\App\Profile::class)->create();
$comment = factory(\App\Comment::class)->make([
"profile_id"=>$profile->id
]);
$this->post(route('api.projects.comments.store', ['projects' => $project->id]), $comment->jsonSerialize(), $this->jsonHeaders)
->seeInDatabase('comments', ['project_id'=>$project->id,'description'=>$comment->description])
->assertResponseOk();
}
Run Code Online (Sandbox Code Playgroud)
这是$ comment-> jsonSerialize()存储的内容: …
我想查询匹配以下任何值的所有文档:
["Test","Cat","Dog"]
Run Code Online (Sandbox Code Playgroud)
在字段类别中.
我有以下映射:
"categories": {
"type": "string"
}
Run Code Online (Sandbox Code Playgroud)
一些示例文档是
"categories": [
"Test",
"Cat"
]
Run Code Online (Sandbox Code Playgroud)
要么
"categories": [
"Blue Cat",
"Ball"
]
Run Code Online (Sandbox Code Playgroud)
我可以使用以下查询将其拉出:
query: {
match: {
categories: {
query: ["Test","Cat","Dog"]
}
}
Run Code Online (Sandbox Code Playgroud)
但这会让我回复两份文件,因为它们都包含"猫",即使其中一只包含"蓝猫"形式,我怎么能指明它们我想要的确切值"猫"不是它包含它?
我读到了关于将映射的字段类型更改为嵌套,但是不接受数组作为嵌套对象,因为它没有键和值.
如果我使用此映射:
"categories": {
"type": "nested"
}
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
"object mapping for [categories] tried to parse field [null] as object, but found a concrete value"
Run Code Online (Sandbox Code Playgroud)
如何使用可能值的数组按字段类别进行过滤,并确保它与至少一个值完全匹配?