0

我一直在使用 [vue-multiselect]

[1]:https ://www.npmjs.com/package/vue-multiselect 。在一个表单中,我有多个多选下拉菜单。主要问题是浏览器的自动完成行为。我要么想关闭它,要么希望它按预期工作。我试图通过禁用自动完成

  autocomplete="off"
 // autocomplete="nope"
//autocomplete="random-text"

但他们都没有工作。或者,如果我们保持自动完成行为,那么在选择多选输入的自动建议时,除了其他多选输入之外,我会得到其他输入由浏览器自动填充。Other multiselect does not allow autofill of values in other multiselects given by browser when any autosuggestion from first multiselect is selected. 例如,我有三个多选:州、区、市在选择州时,我会从浏览器中获得自动建议。在其中一个鼠标悬停时,我会在我之前填写的 District and City 中获得 District and City 自动填充。但是当我从 State 中选择 Autosuggestion 值(当然是由浏览器而不是我给出的)时,我会从 State、District 和 City 中得到所有值,这对用户不利。请,

4

1 回答 1

1

在 HTML 代码中

onFocus={handleFocus}

在脚本文件中

handleFocus = e => { e.target.setAttribute("autocomplete", "nope"); };
于 2021-03-04T09:03:00.333 回答