export default { methods: { /** 검색 조건 관련 **/ saveQueryParams(key, value) { sessionStorage.setItem(key, JSON.stringify(value)); }, resotreQueryParams(key) { const queryParams = sessionStorage.getItem(key); if(queryParams) { this.search = JSON.parse(queryParams); } }, saveRedirect(key, value) { sessionStorage.setItem(key, value); }, restoreRedirect(key) { const queryParams = sessionStorage.getItem(key); return queryParams; }, clearQueryParams() { sessionStorage.clear(); }, /** 검색 조건 관련 **/ /** pageId 추출 **/ fnIdExtraction() { if(this.$route.query.pageId != null && this.$route.query.pageId != undefined && this.$route.query.pageId != '') { this.pageId = this.$route.query.pageId; } else { // const { API_SERVER_HOST } = require("../../../../../../Global"); const { API_SERVER_HOST } = require("../../../Global"); const storeUrl = API_SERVER_HOST + this.restoreRedirect('redirect'); // 세션 스토리지에서 URL정보 호출 const url = new URL(storeUrl); // URL 객체 생성 const queryString = url.search; // 쿼리 스트링 추출 const params = new URLSearchParams(queryString); // URLSearchParams 객체 생성 this.pageId = params.get('pageId'); // pageId 파라미터 값 추출 } }, /** pageId 추출 **/ /** 게시판 pageId 추출 **/ fnBbsIdExtraction() { if(this.$route.path != null && this.$route.path != undefined && this.$route.path != '') { const regex = /^\/[^\/]+\/([^\/]+)\//; // 두 번째 '/'와 세 번째 '/' 사이의 문자열 추출 const match = this.$route.path.match(regex); // 라우터 경로와 정규식 매칭 if(match) { this.bbsMngId = match[1]; } } }, /** pageId 추출 **/ } }