我是新手,请多指教!
如何将控制台返回给我的对象的值传输到网页上?目前,余额值在控制台中,但没有显示在页面上。
编辑:如果我希望单独在控制台中显示对象,我应该使用myObj.key吗?例如,我想在我的网页左侧显示余额值,在右侧显示块的值,我应该使用myObj.balance和myObj.block吗?
这是我的代码,请指导,谢谢!
<template>
<div class="box-card">
<p class="title-text">余额</p>
<p class="number-text">{{Balance}}</p>
</div>
</template>
<script>
export default {
data() {
return {
userId: 0,
// page config
currentPage: 1,
total: 0,
pageSize: 20,
userBalance: [],
Balance: '',
}
},
watch: {},
mounted() {
this.userId = this.$route.query["user_id"];
this.userId = 41;
this.getUserBalance();
this.getUserIncomeRecord();
console.log('hello');
},
methods: {
pageChange(val) {
this.currentPage = val;
},
getUserBalance() {
Core.Api.User.getUserBalance(this.userId).then(res => {
console.log(res);
res == this.Balance;
})
},
</script>
append
函数等等,但我不记得全部了。 - Felix函数
。document.querySelector('yourSelector').innerText = yourObject.balance
。 - deEr.