problem description
the columns of each table are stored in the database, and the column items are generated dynamically every time the table is generated, and the column items can be customized, but after getting the data of the columns from the server, push to columns, causes the browser to freeze infinitely. How to solve this problem.
related codes
<div id="vue">
<i-table
border
size="small"
:columns="columns"
:data="data">
</i-table>
</div>
<script>
new Vue({
el: "-sharpvue",
data: {
post_id: 1,
data: [],
columns: []
},
created: function () {
self = this;
},
mounted(){
jQuery.post("/get_columus", {
post_id: this.post_id
}, function (res) {
res.columns.map(item => {
console.log(item)
console.log(typeof item)
// self.columns.push(item)
});
self.data = res.data;
})
},
})
</script>
where the res returned by the server is as follows:
[{...}{...}{...}...{...}]
after console.log (typeof item), it is also displayed for object,. After printing console.log (item), it is {.}
.but self.columns.push (item) directly causes the browser to jam and vue reports an error. Is there something wrong with this?
the following is the array returned by the server: