Feat 所有包升级到最新版

This commit is contained in:
shunfa.xu 2020-05-22 17:23:09 +08:00
parent d22b31bea0
commit a7de81908c
6 changed files with 65 additions and 55 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

View File

@ -1,10 +1,10 @@
<template> <template>
<div> <div>
<!-- 可以删掉 顶部 --> <!-- 删除试试 顶部 -->
<HeaderCompontent></HeaderCompontent> <HeaderCompontent></HeaderCompontent>
<!-- 渲染出口 --> <!-- 渲染出口 -->
<router-view></router-view> <router-view></router-view>
<!-- 可以删除 底部菜单 --> <!-- 删除试试 底部菜单 -->
<FootComponent></FootComponent> <FootComponent></FootComponent>
</div> </div>
</template> </template>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

17
src/mock/index.js Normal file
View File

@ -0,0 +1,17 @@
// mock data
export const data = {
success: true,
data: [{
name: "React",
id: 1,
},{
name: "Vue",
id: 2,
},{
name: "Angular",
id: 3,
},{
name: "Flutter",
id: 4,
}]
};

View File

@ -1,42 +1,35 @@
<template> <template>
<div> <div>
<button v-on:click="loadMore">click me</button> <button v-on:click="loadMore">click me</button>
<div>
<ul> <ul>
<li v-for="(item, index) in listArr" :key="index"> <li v-for="(item, index) in listArr" :key="index">
<a href="">{{ index }} {{ item.name }}</a> <a href="">{{ index }} {{ item.name }}</a>
</li> </li>
</ul> </ul>
</div> </div>
<div class="loading" v-if="loading">
Loading...
</div>
</div>
</template> </template>
<script> <script>
let mock = require('../mock'); //
export default { export default {
data: () => ({ data: () => ({
loading: false,
listArr: [], listArr: [],
page: 1,
}), }),
created() { created() {
this.loadList(); this.loadList();
}, },
methods: { methods: {
loadList() { loadList(page) {
let url = "https://api.github.com/search/code?q=addClass+in:file+language:js+repo:jquery/jquery"; const {data, success} = mock.data;
fetch(url, { if (this.page > 1) {
method: "GET", console.log("page is:", this.page);
}).then((res) => { return this.listArr = this.listArr.concat(data);
const {data} = res; }
console.log(res); this.listArr = data;
this.listArr = data.items;
})
.catch();
}, },
loadMore() { loadMore() {
console.log("load more"); this.loadList(this.page++);
this.loadList();
}, },
}, },
}; };