我有这个代码片段:
export default defineComponent({
name: "filter",
props: {},
setup() {
const states = useCounterStore();
return { states };
},
data() {
return {
items: [],
};
},
methods: {},
mounted() {
fetch("http://localhost:3000/tags")
.then((res) => res.json())
.then((data) => {
this.items = data;
alert(data);
})
.catch((err) => console.log(err.message));
},
});
fetch 被调用了两次,我不知道为什么。 有什么解决办法吗?
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号