mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 21:38:13 +00:00
Przywrócono select box dla stacji z wieloma posterunkami
This commit is contained in:
+17
@@ -153,6 +153,8 @@ export default class App extends Vue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
|
this.detectIEVersion();
|
||||||
|
|
||||||
if (StorageManager.getStringValue("version") != this.VERSION) {
|
if (StorageManager.getStringValue("version") != this.VERSION) {
|
||||||
StorageManager.setStringValue("version", this.VERSION);
|
StorageManager.setStringValue("version", this.VERSION);
|
||||||
|
|
||||||
@@ -164,6 +166,21 @@ export default class App extends Vue {
|
|||||||
this.hasReleaseNotes &&
|
this.hasReleaseNotes &&
|
||||||
!StorageManager.getBooleanValue("version_notes_read");
|
!StorageManager.getBooleanValue("version_notes_read");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
detectIEVersion() {
|
||||||
|
var rv = -1;
|
||||||
|
if (navigator.appName == "Microsoft Internet Explorer") {
|
||||||
|
var ua = navigator.userAgent;
|
||||||
|
var re = new RegExp("MSIE ([0-9]{1,}[\\.0-9]{0,})");
|
||||||
|
if (re.exec(ua) != null) rv = parseFloat(RegExp.$1);
|
||||||
|
} else if (navigator.appName == "Netscape") {
|
||||||
|
var ua = navigator.userAgent;
|
||||||
|
var re = new RegExp("Trident/.*rv:([0-9]{1,}[\\.0-9]{0,})");
|
||||||
|
if (re.exec(ua) != null) rv = parseFloat(RegExp.$1);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log("IE version:", rv);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,10 @@
|
|||||||
<div class="select-box">
|
<div class="select-box">
|
||||||
<div class="select-box_content">
|
<div class="select-box_content">
|
||||||
<label>
|
<label>
|
||||||
<select v-model="selectedItem">
|
<select
|
||||||
|
v-model="selectedItem"
|
||||||
|
:style="bgColor ? 'background-color:' + bgColor : ''"
|
||||||
|
>
|
||||||
<option value disabled selected hidden>
|
<option value disabled selected hidden>
|
||||||
{{ title }}
|
{{ title }}
|
||||||
</option>
|
</option>
|
||||||
@@ -10,8 +13,7 @@
|
|||||||
{{ item.value }}
|
{{ item.value }}
|
||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
|
<span class="arrows"></span>
|
||||||
<span> </span>
|
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -24,6 +26,7 @@ import { Component, Vue, Prop, Watch, Emit } from "vue-property-decorator";
|
|||||||
export default class SelectBox extends Vue {
|
export default class SelectBox extends Vue {
|
||||||
@Prop({ required: true }) title!: string;
|
@Prop({ required: true }) title!: string;
|
||||||
@Prop({ required: true }) itemList!: { id: string | number; value: string }[];
|
@Prop({ required: true }) itemList!: { id: string | number; value: string }[];
|
||||||
|
@Prop() bgColor!: string;
|
||||||
|
|
||||||
@Emit("selected")
|
@Emit("selected")
|
||||||
onItemSelected() {
|
onItemSelected() {
|
||||||
@@ -47,19 +50,20 @@ export default class SelectBox extends Vue {
|
|||||||
|
|
||||||
.select-box {
|
.select-box {
|
||||||
&_content {
|
&_content {
|
||||||
|
// display: inline-block;
|
||||||
|
|
||||||
position: relative;
|
position: relative;
|
||||||
margin: 0.5em 0;
|
margin: 0.5em auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
select {
|
select {
|
||||||
border: none;
|
border: none;
|
||||||
outline: none;
|
outline: none;
|
||||||
min-width: 10em;
|
|
||||||
|
|
||||||
background-color: #333;
|
|
||||||
border-radius: 0.5em;
|
|
||||||
|
|
||||||
|
background: #333;
|
||||||
padding: 0.35em 0.5em;
|
padding: 0.35em 0.5em;
|
||||||
|
padding-right: 2em;
|
||||||
|
border-radius: 0.5em;
|
||||||
|
|
||||||
font-size: 1em;
|
font-size: 1em;
|
||||||
color: white;
|
color: white;
|
||||||
@@ -73,7 +77,13 @@ export default class SelectBox extends Vue {
|
|||||||
transition: all 0.3s;
|
transition: all 0.3s;
|
||||||
|
|
||||||
&:focus {
|
&:focus {
|
||||||
background: #5c5c5c;
|
// border: 1px solid red;
|
||||||
|
|
||||||
|
background: #777;
|
||||||
|
|
||||||
|
option {
|
||||||
|
background: #333;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,13 +91,13 @@ export default class SelectBox extends Vue {
|
|||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
span {
|
.arrows {
|
||||||
$arrowCol: #d8d8d8;
|
$arrowCol: #d8d8d8;
|
||||||
$arrowWidth: 0.35em;
|
$arrowWidth: 0.35em;
|
||||||
|
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 20%;
|
top: 20%;
|
||||||
right: 0.25em;
|
// right: 0.25em;
|
||||||
|
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
|
|
||||||
|
|||||||
@@ -16,28 +16,18 @@
|
|||||||
</a>
|
</a>
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
<!-- <div class="select-box" v-if="stationInfo.checkpoints">
|
<select-box
|
||||||
<div class="option-container">
|
v-if="stationInfo && stationInfo.checkpoints"
|
||||||
<div class="option-selected" @click="toggleOptionList">
|
:title="selectedOption"
|
||||||
<span>{{ selectedOption }}</span>
|
:itemList="
|
||||||
<img :src="require('@/assets/icon-select.svg')" alt="icon-select" />
|
stationInfo.checkpoints.map((cp, i) => ({
|
||||||
</div>
|
id: cp.checkpointName,
|
||||||
|
value: cp.checkpointName,
|
||||||
<ul class="option-list" :class="{ open: listOpen }">
|
}))
|
||||||
<li
|
"
|
||||||
class="option-item"
|
bgColor="#444"
|
||||||
v-for="(cp, i) in stationInfo.checkpoints"
|
@selected="chooseOption"
|
||||||
:key="i"
|
></select-box>
|
||||||
@click="() => chooseOption(cp.checkpointName)"
|
|
||||||
>
|
|
||||||
<input type="option-radio" name="sort" />
|
|
||||||
<label :id="cp.checkpointName">{{ cp.checkpointName }}</label>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div> -->
|
|
||||||
|
|
||||||
<!-- <select-box></select-box> -->
|
|
||||||
|
|
||||||
<span class="timetable-item loading" v-if="dataStatus == 0">{{
|
<span class="timetable-item loading" v-if="dataStatus == 0">{{
|
||||||
$t("app.loading")
|
$t("app.loading")
|
||||||
@@ -156,32 +146,24 @@ export default class SceneryTimetable extends Vue {
|
|||||||
listOpen: boolean = false;
|
listOpen: boolean = false;
|
||||||
selectedOption: string = "";
|
selectedOption: string = "";
|
||||||
|
|
||||||
mounted() {
|
loadSelectedOption() {
|
||||||
|
if (!this.stationInfo) return;
|
||||||
if (!this.stationInfo.checkpoints) return;
|
if (!this.stationInfo.checkpoints) return;
|
||||||
|
if (this.selectedOption != "") return;
|
||||||
|
|
||||||
if (this.selectedOption == "")
|
this.selectedOption = this.stationInfo.checkpoints[0].checkpointName;
|
||||||
this.selectedOption = this.stationInfo.checkpoints[0].checkpointName;
|
}
|
||||||
|
|
||||||
|
mounted() {
|
||||||
|
this.loadSelectedOption();
|
||||||
}
|
}
|
||||||
|
|
||||||
activated() {
|
activated() {
|
||||||
if (!this.stationInfo) return;
|
this.loadSelectedOption();
|
||||||
if (!this.stationInfo.checkpoints) return;
|
|
||||||
|
|
||||||
if (this.selectedOption == "")
|
|
||||||
this.selectedOption = this.stationInfo.checkpoints[0].checkpointName;
|
|
||||||
}
|
|
||||||
|
|
||||||
toggleOptionList() {
|
|
||||||
this.listOpen = !this.listOpen;
|
|
||||||
}
|
|
||||||
|
|
||||||
closeOptionList() {
|
|
||||||
this.listOpen = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
chooseOption(name: string) {
|
chooseOption(name: string) {
|
||||||
this.selectedOption = name;
|
this.selectedOption = name;
|
||||||
this.closeOptionList();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get currentURL() {
|
get currentURL() {
|
||||||
@@ -255,9 +237,6 @@ h3 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.select-box {
|
.select-box {
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
|
|
||||||
font-size: 1.2em;
|
font-size: 1.2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user