input 框自适应

方法一:

    <input class="tabTitleStyle" type="text" ng-keyup="changeTabWidth($event)" value="{{tab.tabTitle}}">
 
  $scope.changeTabWidth = function($event){
            console.log('$event',$event)
            $event.target.style.width  = $event.target.value.length * 7 + 'px'
        }

方法二:

        <span contenteditable="true">{{tab.tabTitle}}</span>

推荐阅读更多精彩内容