我有<ui-select-match placeholder="Select areas...">{{$somestuff}}</ui-select-match>
带占位符的输入框的宽度设置为 10px;无论我做什么都会自动(如下图所示)。我不知道为什么会这样,如果我触摸页面上的任何内容,甚至调整浏览器窗口的大小,它都会返回显示整个占位符。
有人知道为什么会这样吗?在控制台中我可以看到它说: element.style: width: 10px;但是没有提到任何 css 文件的来源,而且我也没有触及任何 css 文件。
最佳答案
您所采用的 10px 宽度是由 angular ui-select 库添加的。您可以做的一种解决方案是使用 css !important 属性覆盖文本框的宽度。
.ui-select-container{
width:50px!important; //put whatever pixel value you need.it wont change
}
ui-select-container 类是在 ui-select 渲染后由库添加的。
关于javascript - Angular ui-select-match占位符自动设置宽度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43791218/