我想使用vue-material创建一个登录页面。我有here的表格基础。我在服务器端使用laravel 5.4。
我的模板:
<div id="app">
<md-layout md-tag="form" novalidate @submit.stop.prevent="submit" md-align="center">
<md-layout md-tag="md-card" md-column md-flex="30" md-flex-medium="40" md-flex-small="60" md-flex-xsmall="90" class="md-primary">
<md-card-header>
<div class="md-title">Login</div>
</md-card-header>
<md-card-content>
<md-input-container>
<md-icon>person</md-icon>
<label>Email</label>
<md-input email required v-model="email" />
</md-input-container>
<md-input-container md-has-password>
<md-icon>lock</md-icon>
<label>Password</label>
<md-input type="password" required v-model="password" />
</md-input-container>
</md-card-content>
<md-card-actions>
<md-button type="submit">Login</md-button>
</md-card-actions>
</md-layout>
</md-layout>
</div>
我的问题:
如何设置表单使用POST而不是GET?
如何设置应发送输入字段值?
答案 0 :(得分:1)
要将请求从GET更改为POST,请将method
属性添加到呈现为表单的md-layout
标记中:
<md-layout
md-tag="form"
method="POST"
novalidate
@submit.stop.prevent="submit"
md-align="center"
>
然后,要在POST中发送输入字段的值,请将name
属性添加到输入中:
<md-input email required v-model="email" name="email" />
和
<md-input type="password" required v-model="password" name="password" />