在uni-app中,创建一个简单的报名成功页面可以如下所示:
<template>
<view class="success-page">
<view class="header">报名成功</view>
<image class="icon" src="/static/images/success.png" mode="widthFix"></image>
<view class="content">
您已成功提交报名信息!我们将在审核后通过短信或邮件通知您后续事宜,请留意查收。
</view>
<button class="btn" type="primary" @tap="redirectToHome">返回首页</button>
</view>
</template>
<script>
export default {
methods: {
redirectToHome() {
uni.switchTab({
url: '/pages/index/index' // 替换为你的首页路径
});
}
}
};
</script>
<style scoped>
.success-page {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
padding: 30px;
}
.header {
font-size: 24px;
color: #333;
margin-bottom: 20px;
}
.icon {
width: 200px;
height: 200px;
margin-bottom: 30px;
}
.content {
font-size: 16px;
color: #666;
text-align: center;
line-height: 1.5;
margin-bottom: 30px;
}
.btn {
width: 80%;
margin-top: 30px;
}
</style>
这个示例代码定义了一个显示“报名成功”信息的页面,包含一个图标、一段提示文字以及一个跳转到首页的按钮。样式上确保了内容居中显示,并且提供了一种简洁明了的视觉反馈。
请注意替换redirectToHome
方法中的URL为你实际项目的首页路径。