vue-resource更换为axios
npm install axios
/*main.js*/
import axios from 'axios'
Vue.prototype.$ajax = axios
/*components*/
import axios from 'axios'
export default {
created () {
axios.get('./static/data.json').then(res => {
})
}
}
获取DOM
<div class="tab" ref="domList">
</div>
<script>
created () {
this.$nextTick(() => {
console.log(this.$refs.domList)
})
}
</script>