vue3.0 + vite (一)頁面渲染
<template>
<el-card class="account-container">
<!-- 渲染資料 -->
<div class="title">{{text}}</div>
</el-card>
</template>
<script>
import { reactive, toRefs, onMounted } from "vue"; //引入vue
import { ElMessage } from "element-plus"; //elementUI庫
import axios from "@/utils/axios"; //axios請求地址
export default {
name: "Introduce",
setup() {
//定義欄位
const state = reactive({
text: "標題",
message: "我是一條訊息",
});
// 獲取串列
const getCarousels = () => {
state.loading = true;
axios
.post("/user/order/showList", {
params: {},
})
.then((res) => {
console.log(res);
});
};
//頁面掛載
onMounted(() => {
getCarousels();
});
//將定義的資料全部回傳給setup函式
return {
...toRefs(state),
};
},
};
</script>
<style scoped>
/* 樣式 */
.title {
font-size: 50px;
}
</style>
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/280724.html
標籤:其他
