vue2_frontend...

This commit is contained in:
최준흠 2022-09-18 10:58:46 +09:00
parent 7de78be248
commit 7159838078
3 changed files with 43 additions and 37 deletions

View File

@ -55,20 +55,20 @@
:sort-by.sync="sortBy" :sort-by.sync="sortBy"
:sort-desc.sync="sortDesc" :sort-desc.sync="sortDesc"
@sort-changed="sortClick" @sort-changed="sortClick"
label-sort-asc=""
label-sort-desc=""
label-sort-clear=""
:select-mode="selectedRowMode"
selectable
@row-selected="rowSelectedToggle" @row-selected="rowSelectedToggle"
:sticky-header="commonTableAttributes.stickyHeader" :sticky-header="tableAttributes.stickyHeader"
:no-border-collapse="commonTableAttributes.noBorderCollapse" :no-border-collapse="tableAttributes.noBorderCollapse"
:striped="commonTableAttributes.striped" :striped="tableAttributes.striped"
:hover="commonTableAttributes.hover" :hover="tableAttributes.hover"
:no-local-sorting="commonTableAttributes.noLocalSorting" :no-local-sorting="tableAttributes.noLocalSorting"
:bordered="commonTableAttributes.bordered" :bordered="tableAttributes.bordered"
:dark="commonTableAttributes.dark" :dark="tableAttributes.dark"
:head-variant="commonTableAttributes.headVariant" :head-variant="tableAttributes.headVariant"
:label-sort-asc="tableAttributes.labelSortAsc"
:label-sort-desc="tableAttributes.labelSortDesc"
:label-sort-clear="tableAttributes.labelSortClear"
:select-mode="tableAttributes.selectedRowMode"
:selectable="tableAttributes.selectable"
> >
<!-- Field별 Filter용 --> <!-- Field별 Filter용 -->
<template #head(rowSelect)> <template #head(rowSelect)>
@ -143,7 +143,10 @@ export default {
computed: { computed: {
...todoStore.mapState(['total', 'rows', 'fields']) ...todoStore.mapState(['total', 'rows', 'fields'])
}, },
data: () => { created() {
this.setDatas()
},
data() {
return { return {
page: 1, // page: 1, //
perPage: process.env.VUE_APP_TABLE_DEFAULT_PERPAGE, // perPage: process.env.VUE_APP_TABLE_DEFAULT_PERPAGE, //
@ -154,17 +157,6 @@ export default {
{ text: '60줄', value: 60 }, { text: '60줄', value: 60 },
{ text: '100줄', value: 100 } { text: '100줄', value: 100 }
], ],
//
commonTableAttributes: {
stickyHeader: '50%',
//noBorderCollapse: false,
striped: true,
hover: true,
noLocalSorting: true,
bordered: true,
dark: false,
headVariant: 'light'
},
sortBy: 'id', sortBy: 'id',
sortDesc: true, sortDesc: true,
search: null, search: null,
@ -175,9 +167,9 @@ export default {
], ],
filter: null, filter: null,
filterField: null, filterField: null,
filterDateField: 'createdAt',
filterDateStart: null, filterDateStart: null,
filterDateEnd: null, filterDateEnd: null,
filterDateField: 'createdAt',
filterDateFieldOptions: [ filterDateFieldOptions: [
{ text: '수정일', value: 'updatedAt' }, { text: '수정일', value: 'updatedAt' },
{ text: '등록일', value: 'createdAt' } { text: '등록일', value: 'createdAt' }
@ -185,7 +177,21 @@ export default {
filterIsDone: '', filterIsDone: '',
selectedRows: [], selectedRows: [],
selectedRowAllToggle: false, selectedRowAllToggle: false,
selectedRowMode: 'multi' //'multi', 'single', 'range' tableAttributes: {
stickyHeader: '50%',
//noBorderCollapse: false,
striped: true,
hover: true,
noLocalSorting: true,
bordered: true,
dark: false,
headVariant: 'light',
labelSortAsc: '',
labelSortDesc: '',
labelSortClear: '',
selectable: true,
selectedRowMode: 'multi' //'multi', 'single', 'range'
}
} }
}, },
methods: { methods: {

View File

@ -62,7 +62,7 @@ const mutations = {
} }
} }
const actions = { const actions = {
register: async function (commit) { register: async function (context) {
const params = { const params = {
email: this.form.email, email: this.form.email,
password: this.form.password, password: this.form.password,
@ -71,25 +71,25 @@ const actions = {
await api.post('/auth/register', params).then((response) => { await api.post('/auth/register', params).then((response) => {
const { data } = response const { data } = response
if (data.access_token) { if (data.access_token) {
commit('login', data) context.commit('login', data)
} }
}) })
}, },
login: async function ({ commit, state }) { login: async function ({ context, state }) {
const params = { email: state.form.email, password: state.form.password } const params = { email: state.form.email, password: state.form.password }
console.log(params) console.log(params)
await api.post('/auth/login', params).then((response) => { await api.post('/auth/login', params).then((response) => {
const { data } = response const { data } = response
if (data.access_token) { if (data.access_token) {
commit('login', data) context.commit('login', data)
} }
}) })
}, },
logout: function (commit) { logout: function (context) {
return commit('logout') return context.commit('logout')
}, },
reload: function (commit, access_token) { reload: function (context, access_token) {
return commit('reload', access_token) return context.commit('reload', access_token)
} }
} }
export default { namespaced: true, state, getters, mutations, actions } export default { namespaced: true, state, getters, mutations, actions }

View File

@ -61,10 +61,10 @@ const mutations = {
} }
} }
const actions = { const actions = {
setDatas: async function (commit, params) { setDatas: async function (context, params) {
await api.get('/todo', { params: params }).then((response) => { await api.get('/todo', { params: params }).then((response) => {
const { data } = response const { data } = response
commit('setDatas', data) context.commit('setDatas', data)
}) })
} }
} }