HTML:
data () {
return {
pltxt: "评论",
inputText: '',
isHeight:true,
minHeight:0,
}
},
methods: {
autoTextarea() {
var extra = 0, //设置光标与输入框保持的距离(默认0)maxHeight = 60; //设置最大高度(可选)var _that = this;var isFirefox = !!document.getBoxObjectFor || 'mozInnerScreenX' in window,isOpera = !!window.opera && !!window.opera.toString().indexOf('Opera');
var paddingTop,paddingBottom
var style,_length,valueLength,stylHeight,scrollHeight,currHeight;
this.$nextTick(function () {
if(this.isHeight){
this.isHeight = false
this.minHeight = parseFloat(window.getComputedStyle(this.$refs.elememt).height)
}
paddingTop = parseInt(window.getComputedStyle(this.$refs.elememt).paddingTop)