用代码做一个简单的微信小程序
时间: 2024-04-30 20:22:13 浏览: 13
好的,以下是一个简单的微信小程序的代码。
HTML:
```
<view class="container">
<view class="header">
<text class="title">Hello World</text>
</view>
<view class="content">
<text>{{message}}</text>
</view>
</view>
```
JS:
```
Page({
data: {
message: 'Welcome to my mini program!'
}
})
```
CSS:
```
.container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #f2f2f2;
}
.header {
margin-bottom: 30px;
}
.title {
font-size: 28px;
font-weight: bold;
}
.content {
background-color: #fff;
padding: 20px;
border-radius: 5px;
box-shadow: 0px 2px 10px rgba(0,0,0,0.1);
}
```
这个小程序可以在页面中心展示一段文字("Welcome to my mini program!"),页面背景颜色为灰色,文字内容为黑色。