input宽度随文字变化而变化uniapp
<input type="text" placeholder-style="color:#999;" :value="inputValue" placeholder="搜索"
:style="'width:'+String(inputValue).length*10+'px;max-width:90%'" @input="onInput" />
data() {
return {
inputValue: "搜索",
};
},
onInput: function(e) {
console.log(e.detail.value)
var self = this;
self.setData({
inputValue: e.detail.value
});
},