Implement defineModel where applicable

This commit is contained in:
Matthias 2023-05-28 17:25:15 +02:00
parent f943385ce3
commit da15452d30
3 changed files with 12 additions and 27 deletions

View File

@ -32,26 +32,18 @@
<script setup lang="ts">
import { Pairlist } from '@/types';
import { computed, ref } from 'vue';
import PairlistConfigParameter from '../general/PairlistConfigParameter.vue';
import { ref } from 'vue';
import PairlistConfigParameter from './PairlistConfigParameter.vue';
const props = defineProps<{
modelValue: Pairlist;
defineProps<{
index: number;
}>();
const emit = defineEmits(['update:modelValue', 'remove']);
const emit = defineEmits(['remove']);
const visible = ref(false);
const pairlist = computed({
get() {
return props.modelValue;
},
set(value: Pairlist) {
emit('update:modelValue', value);
},
});
const pairlist = defineModel<Pairlist>({ required: true });
</script>
<style>

View File

@ -25,21 +25,10 @@
<script setup lang="ts">
import { PairlistParameter, PairlistParamType } from '@/types';
import { computed } from 'vue';
const props = defineProps<{
defineProps<{
param: PairlistParameter;
modelValue: string | undefined;
}>();
const emit = defineEmits(['update:modelValue']);
const paramValue = computed({
get() {
return props.modelValue;
},
set(value) {
emit('update:modelValue', value);
},
});
const paramValue = defineModel<string>();
</script>

View File

@ -9,7 +9,11 @@ import { BootstrapVueNextResolver } from 'unplugin-vue-components/resolvers';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
createVuePlugin({}),
createVuePlugin({
script: {
defineModel: true,
},
}),
Components({
resolvers: [IconsResolve(), BootstrapVueNextResolver()],
dirs: [],