Vue.set for operating the array, due to the limitation of javascript, can not be used as a direct index of the array operation,
Therefore, this method vue Vue.set provided to operate the array, the following sample code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<Title> vue.set global operations </ title>
<script src="../assets/js/vue.js"></script>
</head>
<body>
<H1> vue.set global operations </ h1>
<hr>
<div id="app">
<ul>
<li v-for="(item,index) in arr">
{{item}}
</li>
</ul>
</div>
<p><button onclick="add()">add</button></p>
<script>
function add() {
Vue.set(app.arr, 1, 'dd')
}
was outData = {
arr: ['aa', 'bb', 'cc']
}
was app = new Vue ({
the '#app'
data: outData
})
</script>
</body>
</html>
![](https://img2018.cnblogs.com/blog/1675843/201906/1675843-20190627215106115-232772904.png)