|
@@ -9,6 +9,8 @@
|
|
<div class="id">{{ item.id }}</div>
|
|
<div class="id">{{ item.id }}</div>
|
|
<div class="book_name">{{ item.book_name }}</div>
|
|
<div class="book_name">{{ item.book_name }}</div>
|
|
</div>
|
|
</div>
|
|
|
|
+ <van-button round block type="primary" @click="add"> 新增 </van-button>
|
|
|
|
+
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
@@ -25,16 +27,19 @@ const router = useRouter()
|
|
onMounted(async () => {
|
|
onMounted(async () => {
|
|
const res = await getAllBook()
|
|
const res = await getAllBook()
|
|
console.log(101010, res)
|
|
console.log(101010, res)
|
|
- books.value = res
|
|
|
|
|
|
+ books.value = res.data
|
|
})
|
|
})
|
|
|
|
|
|
function selectBook (item) {
|
|
function selectBook (item) {
|
|
window.localStorage.setItem('book', JSON.stringify(item))
|
|
window.localStorage.setItem('book', JSON.stringify(item))
|
|
window.localStorage.setItem('bookId', item.id)
|
|
window.localStorage.setItem('bookId', item.id)
|
|
-
|
|
|
|
|
|
+
|
|
// const route = useRoute()
|
|
// const route = useRoute()
|
|
router.back()
|
|
router.back()
|
|
}
|
|
}
|
|
|
|
+function add() {
|
|
|
|
+ router.push('/add_books')
|
|
|
|
+}
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|
|
<style scoped lang="scss">
|
|
@@ -47,6 +52,7 @@ function selectBook (item) {
|
|
background-color: #fff;
|
|
background-color: #fff;
|
|
margin-bottom: 24px;
|
|
margin-bottom: 24px;
|
|
display: flex;
|
|
display: flex;
|
|
|
|
+ color: black;
|
|
.id {
|
|
.id {
|
|
padding-right: 12px;
|
|
padding-right: 12px;
|
|
}
|
|
}
|