![](https://i-blog.csdnimg.cn/direct/f25e8ddaa3c04dd2b0531c2b8986f42f.png)
示例
<script>
import SurveyResult from './SurveyResult.vue';
export default {
data() {
return {
results: [],
};
},
methods: {
loadExperiences() {
fetch('https://obgcvwmpcjrehzgcjyhl.supabase.co/rest/v1/LearningExpriences', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
'apikey': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im9iZ2N2d21wY2pyZWh6Z2NqeWhsIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MjU3OTI3NDYsImV4cCI6MjA0MTM2ODc0Nn0.grIUs9lo75yuUAfz3xLfKW3estlNCkEremeQHrLLcXk',
},
}).then(response => {
if (response.ok) {
return response.json();
}
}).then(data => {
console.log(data);
for (const id in data) {
this.results.push({id:id, name:data[id].name, rating:data[id].rating});
}
});
},
},
components: {
SurveyResult,
},
};
</script>