Javascript 在Safari中使用Vue.js进行模型绑定
我有一个在Firefox和Chrome中运行良好的应用程序,但在Safari中没有。问题是模型绑定在下面的一组单选按钮上 如果我登录到Javascript 在Safari中使用Vue.js进行模型绑定,javascript,model,safari,vue.js,vuejs2,Javascript,Model,Safari,Vue.js,Vuejs2,我有一个在Firefox和Chrome中运行良好的应用程序,但在Safari中没有。问题是模型绑定在下面的一组单选按钮上 如果我登录到v-on:change=“getQuestions()调用控制台,它返回空,但在其他浏览器中可以。我需要一个Polyfill吗 <div v-for="app in appliances"> <div class="col-sm-6 col-md-3" id="select_appliance"> <div
v-on:change=“getQuestions()
调用控制台,它返回空,但在其他浏览器中可以。我需要一个Polyfill吗
<div v-for="app in appliances">
<div class="col-sm-6 col-md-3" id="select_appliance">
<div id="ck-button">
<label>
<input type="radio" id="select_button" v-model="appliance" v-bind:value="app.id" v-on:change="getQuestions()">
<span><img v-bind:src="app.icon" height="80px" width="auto"></br></br>{{app.appliance}}</span>
</label>
</div>
</div>
</div>
您能提供JSFIDLE或更多代码吗?我们不知道getQuestion方法是什么样子,而且当您想要触发method
v-on:change=“getQuestions”时,您不需要在模板中使用括号“
-完全没问题。我添加了getQuestions@BelminBedak。正如您看到的,我正在测试控制台日志,这些日志在Safari中完全返回空。我认为问题出在其他地方,单元测试可以检测到它。我刚刚测试了简化版本,在最新的Safari中工作得很好。可能是v绑定到导致问题的值@BelminBedakI不这样认为-纯值不应该是问题。
getQuestions: function (){
console.log('hi');
console.log(this.appliance);
console.log('bye');
var self = this;
console.log(self.appliance);
axios.get('/get_questions/' + this.appliance, {
})
.then(function(response) {
console.log(response.data);
self.questions = response.data;
self.numberQuestions = self.questions.questions.length;
self.getAnswers();
})
.catch(function(error) {
console.log(error);
});
},