Migrate all Vue components from Options API to <script setup>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -8,26 +8,21 @@
|
||||
</li>
|
||||
</ul>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
name: 'ResultCheck',
|
||||
props:['data', 'select'],
|
||||
data() {
|
||||
return {
|
||||
datadata: null,
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
data: function(newValue) {
|
||||
this.datadata = newValue;
|
||||
},
|
||||
select: function(newValue) {
|
||||
this.datadata = newValue;
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.datadata = this.select;
|
||||
this.$emitter.on('reset', data => this.datadata = data);
|
||||
},
|
||||
}
|
||||
<script setup>
|
||||
import { ref, watch } from 'vue';
|
||||
import emitter from '@/utils/emitter';
|
||||
|
||||
const props = defineProps(['data', 'select']);
|
||||
|
||||
const datadata = ref(props.select);
|
||||
|
||||
watch(() => props.data, (newValue) => {
|
||||
datadata.value = newValue;
|
||||
});
|
||||
|
||||
watch(() => props.select, (newValue) => {
|
||||
datadata.value = newValue;
|
||||
});
|
||||
|
||||
emitter.on('reset', (val) => datadata.value = val);
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user