-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add ssr support + move project to vite (#8)
* fix: add import types * chore: add base vite config * chore: fix is ssr check * chore: fix jest & docs * docs: update
- Loading branch information
1 parent
bae46d0
commit ad7aa16
Showing
25 changed files
with
3,169 additions
and
16,545 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>VueEternalLoading Demo</title> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"> | ||
<script src="https://unpkg.com/[email protected]/dist/vue.global.js"></script> | ||
<script src="/vue-eternal-loading.umd.js"></script> | ||
<style> | ||
.vue-eternal-loading > div { | ||
margin: 10px; | ||
text-align: center; | ||
} | ||
/*.flex-cont {*/ | ||
/* overflow-x: auto; width: 500px;display: flex;*/ | ||
/*}*/ | ||
/*.flex-cont>* {*/ | ||
/* flex-shrink: 0;*/ | ||
/*}*/ | ||
</style> | ||
</head> | ||
<body> | ||
<div id="app"> | ||
<div class="container"> | ||
<div | ||
ref="container" | ||
class="d-flex" | ||
style="overflow-x: auto; width: 500px;" | ||
> | ||
<vue-eternal-loading | ||
class="flex-shrink-0" | ||
:load="load" | ||
position="left" | ||
:container="$refs['container']" | ||
> | ||
<template #loading> | ||
<div class="spinner-border text-success" role="status"> | ||
<span class="visually-hidden">Loading...</span> | ||
</div> | ||
</template> | ||
</vue-eternal-loading> | ||
|
||
<img | ||
v-for="user in users" | ||
:key="user.id" | ||
:src="user.avatar" | ||
class="flex-shrink-0" | ||
alt="..." | ||
style="width: 150px;height: 150px;" | ||
/> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<script> | ||
const URL = 'https://reqres.in/api/users'; | ||
const PAGE_SIZE = 5; | ||
|
||
const App = { | ||
data() { | ||
return { | ||
page: 1, | ||
users: [], | ||
} | ||
}, | ||
methods: { | ||
loadUsers(page) { | ||
return fetch( `${URL}?delay=1&per_page=${PAGE_SIZE}&page=${page}`, { | ||
method: 'GET', | ||
mode: 'cors', | ||
cache: 'no-cache', | ||
headers: { | ||
'Content-Type': 'application/json' | ||
}, | ||
}) | ||
.then(res => res.json()) | ||
.then(res => res.data); | ||
}, | ||
|
||
load(action) { | ||
this.loadUsers(this.page).then((users) => { | ||
this.users.unshift(...users); | ||
this.page += 1; | ||
action.loaded(users.length, PAGE_SIZE); | ||
}) | ||
} | ||
} | ||
} | ||
|
||
const app = Vue.createApp(App); | ||
app.component('vue-eternal-loading', window.TSPro.VueEternalLoading); | ||
app.mount('#app'); | ||
</script> | ||
</body> | ||
</html> |
Oops, something went wrong.