//原生方法获取值,清除首尾空格上传str2

var str = document.getElementById("input").trim();

Vue中提供了修饰符删除首尾空格。

<input v-model.trim="msg">
Logo

前往低代码交流专区

更多推荐