frontend/src/views/CollectionView/CollectionToolbar.vue

62 lines
1.2 KiB
Vue
Raw Normal View History

2025-09-16 19:59:42 +03:00
<script setup>
2025-09-25 20:04:27 +03:00
import { ref, watch } from 'vue'
2025-09-16 20:59:21 +03:00
import router from '@/router/index.js'
2025-09-16 19:59:42 +03:00
const value = ref(null)
const options = [
{ label: 'Placeholder 1', value: 'Placeholder 1' },
{ label: 'Placeholder 2', value: 'Placeholder 2' },
]
2025-09-16 20:59:21 +03:00
const addMerch = () => {
router.push({ name: 'addMerch' })
}
2025-09-25 20:04:27 +03:00
const props = defineProps({
modelValue: {
type: String,
default: '',
},
})
const emit = defineEmits(['update:modelValue'])
const localValue = ref(props.modelValue)
watch(
() => props.modelValue,
(newVal) => {
localValue.value = newVal
}
)
watch(localValue, (newVal) => {
emit('update:modelValue', newVal)
})
2025-09-16 19:59:42 +03:00
</script>
<template>
<div class="toolbar">
2025-09-16 20:59:21 +03:00
<n-button type="primary" class="toolbar-item" @click="addMerch"> Add merch </n-button>
2025-09-16 19:59:42 +03:00
<div class="search-wrapper toolbar-item">
2025-09-25 20:04:27 +03:00
<n-input v-model:value="localValue" placeholder="Search..." clearable />
2025-09-16 19:59:42 +03:00
</div>
<div class="selector toolbar-item">
<n-select
placeholder="Select label"
clearable
multiple
v-model:value="value"
:options="options"
class="mobile-full-width" />
</div>
</div>
</template>
<style scoped>
</style>