두번째 수정...
This commit is contained in:
parent
b6ad01ca62
commit
1bef1de9dc
2
.env
2
.env
@ -4,5 +4,5 @@
|
|||||||
# Prisma supports the native connection string format for PostgreSQL, MySQL, SQLite, SQL Server, MongoDB and CockroachDB.
|
# Prisma supports the native connection string format for PostgreSQL, MySQL, SQLite, SQL Server, MongoDB and CockroachDB.
|
||||||
# See the documentation for all the connection string options: https://pris.ly/d/connection-strings
|
# See the documentation for all the connection string options: https://pris.ly/d/connection-strings
|
||||||
|
|
||||||
API_TODO_URI = ['http://localhost:3000']
|
API_TODO_URI = ['http://localhost:3000/todo']
|
||||||
|
|
||||||
|
|||||||
@ -53,6 +53,5 @@
|
|||||||
"last 2 versions",
|
"last 2 versions",
|
||||||
"not dead",
|
"not dead",
|
||||||
"not ie 11"
|
"not ie 11"
|
||||||
],
|
]
|
||||||
"proxy": "http://localhost:3000"
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -100,7 +100,7 @@
|
|||||||
<input
|
<input
|
||||||
class="form-control me-2"
|
class="form-control me-2"
|
||||||
type="search"
|
type="search"
|
||||||
placeholder="Search"
|
placeholder="통합검색"
|
||||||
aria-label="Search"
|
aria-label="Search"
|
||||||
/>
|
/>
|
||||||
<button class="btn btn-outline-success" type="submit">Search</button>
|
<button class="btn btn-outline-success" type="submit">Search</button>
|
||||||
|
|||||||
@ -1,7 +1,35 @@
|
|||||||
<template>
|
<template>
|
||||||
|
<!-- 참조: https://codesandbox.io/s/3v0m1?file=/src/components/board/BoardList.vue -->
|
||||||
<div>
|
<div>
|
||||||
<table class="table table-striped">
|
<div class="container text-center">
|
||||||
<thead>
|
<div class="row">
|
||||||
|
<div class="col">total:{{ length }} / {{ total }}</div>
|
||||||
|
<div class="col">
|
||||||
|
<form class="d-flex" role="search">
|
||||||
|
<input
|
||||||
|
class="form-control me-2"
|
||||||
|
type="search"
|
||||||
|
v-model="searchString"
|
||||||
|
placeholder="통합검색"
|
||||||
|
aria-label="Search"
|
||||||
|
/>
|
||||||
|
<button class="btn btn-outline-success" type="submit">
|
||||||
|
Search
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<div class="col">
|
||||||
|
<select name="" id="" v-model="perPage">
|
||||||
|
<option value="">--라인수--</option>
|
||||||
|
<option :value="value" :key="idx" v-for="(value, idx) in total">
|
||||||
|
{{ value }}
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<table class="table table-striped table-bordered table-hover">
|
||||||
|
<thead class="table-light">
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col" :key="field.key" v-for="field in fields">
|
<th scope="col" :key="field.key" v-for="field in fields">
|
||||||
{{ field.label }}
|
{{ field.label }}
|
||||||
@ -28,9 +56,11 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
loading: null,
|
loading: null,
|
||||||
|
total: 0,
|
||||||
|
length: 0,
|
||||||
page: 0, // 현재 페이지
|
page: 0, // 현재 페이지
|
||||||
perPage: 10, // 페이지당 보여줄 갯수
|
perPage: 0, // 페이지당 보여줄 갯수
|
||||||
// bootstrap 'b-table' 필드 설정
|
searchString: '',
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
key: 'id',
|
key: 'id',
|
||||||
@ -54,17 +84,23 @@ export default {
|
|||||||
},
|
},
|
||||||
setup() {},
|
setup() {},
|
||||||
created() {
|
created() {
|
||||||
this.list()
|
const url = 'http://localhost:3000/todo'
|
||||||
|
this.list(url)
|
||||||
},
|
},
|
||||||
mounted() {},
|
mounted() {},
|
||||||
unmounted() {},
|
unmounted() {},
|
||||||
methods: {
|
methods: {
|
||||||
async list() {
|
async list(url) {
|
||||||
const url = 'http://localhost:3000/todo?per_page=5&page=1'
|
|
||||||
this.loading = null
|
this.loading = null
|
||||||
await axios.get(url).then((response) => {
|
await axios.get(url).then((response) => {
|
||||||
if (response.statusText === 'OK') {
|
if (response.statusText === 'OK') {
|
||||||
this.rows = response.data
|
console.log(response)
|
||||||
|
this.page = response.data.query.page
|
||||||
|
this.per_page = response.data.query.per_page
|
||||||
|
this.searchString = response.data.query.searchString
|
||||||
|
this.total = response.data.total
|
||||||
|
this.rows = response.data.rows
|
||||||
|
this.length = response.data.rows.length
|
||||||
} else {
|
} else {
|
||||||
throw new Error(`Network response was not ok. \n url => ${url}`)
|
throw new Error(`Network response was not ok. \n url => ${url}`)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user