<div @click="pressButton">ppp</div>
new Vue({
el:'#paytype',
data:{
getData:{},
bankKey:{},
bankValue:{}
},
computed:{
banks:function(){
return bankKey.map((item,index) =>{
return {
key:item,
value:bankValue[index]
}
})
}
},
created:function(){
axios.post('../model/c_lend_return_manage.php','func=getdata')
.then(function (response) {
this.getData=response;
this.bankKey=Object.keys(response.data.banks[0]);
this.bankValue=Object.values(response.data.banks[0]);
})
.catch(function (error) {
console.log(error);
});
},
methods:{
pressButton:function(){
console.log('1',this.banks)
},
bankData:function(key){
switch(key){
case 'bank_num':
return '银行账号';
case 'bank_name':
return '银行账户名';
case 'bank_zhi':
return '开户支行';
default:
return '银行名称';
}
}
}
})
这里要加this
<div id="app">
<p>原始訊息:${ message }</p>
<p>反轉訊息:${ reversedMessage }</p>
</div>
var vm = new Vue({
el: '#app',
delimiters: ['${', '}'],
data: {
message: 'Hello World!'
},
computed: {
reversedMessage: function() {
return this.message.split('').reverse().join('');
}
}
});
沒有留言:
張貼留言