From d995b39e02cc0d93dadc9705acbcd078fd98acd1 Mon Sep 17 00:00:00 2001 From: hide_d Date: Mon, 30 Aug 2021 01:30:56 +0900 Subject: [PATCH] js2ts: currentCity --- hwe/b_currentCity.php | 4 +--- hwe/ts/currentCity.ts | 31 +++++++++++++++++++++++++++++++ webpack.config.cjs | 1 + 3 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 hwe/ts/currentCity.ts diff --git a/hwe/b_currentCity.php b/hwe/b_currentCity.php index cf948da3..99435a51 100644 --- a/hwe/b_currentCity.php +++ b/hwe/b_currentCity.php @@ -31,9 +31,7 @@ $templates = new \League\Plates\Engine('templates'); - - - + diff --git a/hwe/ts/currentCity.ts b/hwe/ts/currentCity.ts new file mode 100644 index 00000000..56b513ba --- /dev/null +++ b/hwe/ts/currentCity.ts @@ -0,0 +1,31 @@ +import $ from 'jquery'; +import { exportWindow } from './util/exportWindow'; +import Popper from 'popper.js'; +exportWindow(Popper, 'Popper'); +import 'bootstrap'; +import 'select2/dist/js/select2.full.js' + + +$(function() { + $('#citySelector').select2({ + theme: 'bootstrap4', + placeholder: "도시를 선택해 주세요.", + allowClear: false, + language: "ko", + containerCss: { + display: "inline-block !important", + color: 'white !important' + }, + containerCssClass: 'simple-select2-align-center bg-secondary text-secondary', + dropdownCssClass: 'simple-select2-align-center bg-secondary text-secondary', + }); + $('#citySelector').on('select2:select', function(e){ + const data = e.params.data; + if(!data.selected || data.disabled){ + return; + } + const $obj = $('#citySelector').parents('form'); + $obj.trigger('submit'); + console.log($obj); + }); +}); \ No newline at end of file diff --git a/webpack.config.cjs b/webpack.config.cjs index 51436b31..070547ef 100644 --- a/webpack.config.cjs +++ b/webpack.config.cjs @@ -36,6 +36,7 @@ module.exports = (env, argv) => { main: '@/main.ts', dipcenter: '@/dipcenter.ts', diplomacy: '@/diplomacy.ts', + currentCity: '@/currentCity.ts', //FORM 입력용, frontend 변경후 제거