如何在页面加载时调用vue.js函数
我有一个有助于过滤数据的功能。我在v-on:change用户更改选择内容时使用,但我甚至需要在用户选择数据之前调用该函数。我已经对AngularJS以前的使用做过同样的事情,ng-init但我知道在vue.js 这是我的功能: getUnits: function () { var input = {block: this.block, floor: this.floor, unit_type: this.unit_type, status: this.status}; this.$http.post('/admin/units', input).then(function (response) { console.log(response.data); this.units = response.data; }, function (response) { console.log(response) }); } 在blade文件中,我使用刀片表单来执行过滤器: <div class="large-2 columns"> {!! Form::select('floor', $floors,null, ['class'=>'form-control', 'placeholder'=>'All Floors', 'v-model'=>'floor', 'v-on:change'=>'getUnits()' ]) !!} </div> <div class="large-3 columns"> …