I'm confused by safari saving password box for few days: that is how to disable it popping up when submitting the form because I don't want to save the username and password.
Obviously, the "password" will trigger the saving mechanism。
<input type="test" name="username">
<input type="password" name="password">
But I change the "password" type to "text" type and use a property of css: -webkit-text-security which works for chrome rather than safari.
The -webkit-text-security can also inform the safari the element is a password input.
The following code using Vue framework and element-ui. The 'el-input' component has "off" value for "autocomplete" property default.
I post the data by axios rather than submit the form.
...methods: {
submit() {
const data = {
accountName: this.form.accountName,
password: this.form.password
}
axios.post(url, data)
}
}
.password {
-webkit-text-security: disc;
}
<el-form ref="form" label-position="right" :model="form">
<el-form-item label="账号名" prop="accountName">
<el-input v-model="form.accountName" :disabled="isEdit"></el-input>
</el-form-item>
<el-form-item label="登陆密码" prop="password" required>
<el-input class="password" type="text" ref="pwd1" v-model="form.password"></el-input>
</el-form-item>
</el-form>
<el-button class="submit-btn" type="primary" size="medium" @click="submit">create</el-button>
So, is there any other simple and effective ways to address it?
Hope your reply!
Thanks very much!
Best, Cassie