Browse Source

[WHAT] 修正Sort卡片手機版下拉選單回傳值

Dev
berlin-tzen 2 years ago
parent
commit
2fef85020a
  1. 13
      FrontEnd/components/newComponent/sort/sort.vue

13
FrontEnd/components/newComponent/sort/sort.vue

@ -42,10 +42,10 @@
<button class="btn-filter tw-text-transparent" @click="$emit('filter', true)"> <button class="btn-filter tw-text-transparent" @click="$emit('filter', true)">
filter filter
</button> </button>
<select class="tw-py-[9px] tw-rounded-[10px]" name="sort_by" v-model="sort" @change="onChnage">
<select class="tw-py-[9px] tw-rounded-[10px]" name="sort_by" v-model="sort" @change="onChnage()">
<option value="0">{{ $t("Select option") }}</option> <option value="0">{{ $t("Select option") }}</option>
<!-- <option v-for="(item, index) in sortType" :key="index" :value="item.value" :selected="sort = item.value"> --> <!-- <option v-for="(item, index) in sortType" :key="index" :value="item.value" :selected="sort = item.value"> -->
<option v-for="(item, index) in sortType" :key="index" :value="item.value">
<option v-for="(item, index) in sortType" :key=item.name :value="item.name">
{{ $t(item.value) }} {{ $t(item.value) }}
</option> </option>
</select> </select>
@ -66,8 +66,11 @@ export default {
}, },
}, },
data() { data() {
return { return {
sort: this.sortBy ? this.sortBy : "0", sort: this.sortBy ? this.sortBy : "0",
options: {}
}; };
}, },
watch: { watch: {
@ -78,14 +81,16 @@ export default {
}, },
sort: { sort: {
handler: function () { handler: function () {
this.$emit("change", this.sort);
// this.$emit("change", this.sort);
this.$emit("sort", this.sort);
}, },
}, },
}, },
methods: { methods: {
onClick(item) { onClick(item) {
this.sort = item.name; this.sort = item.name;
this.$emit("sort", this.sort);
// console.log(this.sort);
// this.$emit("sort", this.sort);
}, },
onChnage() { onChnage() {
this.$emit("sort", this.sort); this.$emit("sort", this.sort);

Loading…
Cancel
Save