使用uniapp框架,<view class="content"> <view v-show="current === 0"> <uni-section title="业务信息" type="line">,页面不能上下拖动的原因是什么?
时间: 2023-07-06 12:29:38 浏览: 50
可能是因为你的页面内容没有超出屏幕高度,或者你的页面设置了 `overflow:hidden` 样式导致不能滚动。你可以尝试给页面内容添加一些高度,或者将页面容器的样式改为 `overflow:auto`,以便在内容超出屏幕时启用滚动。例如:
```
<view class="content" style="height: 100vh; overflow: auto;">
<view v-show="current === 0">
<uni-section title="业务信息" type="line">
<!-- 这里是页面内容 -->
</uni-section>
</view>
</view>
```
其中,`height: 100vh` 表示让页面容器的高度等于当前视口高度,`overflow: auto` 表示启用滚动条。这样就可以让页面内容能够上下滚动了。
相关问题
做个下面代码的样式:<template> <view> <view class="choose"> <view class="title">选择地址</view> <view class="user_info"> <view class="name-phone"><text>{{nickname}}</text><text>{{phone}}</text></view> <view class="address">{{address_detail}}</view> </view> </view> <!-- 订单信息 --> <view class="order-content"> <view class="product"> <view class="img"> <image :src="'http://localhost:3000/'+product.img" mode=""></image> </view> <view class="right-info"> <view class="product-name">黑糖拿铁</view> <view class="price-num"> <text>${{product.price}}</text> <text>x{{product.num}}</text> </view> </view> </view> <view class="num-allprice"> <text>共计{{product.num}}件商品</text> <text>订单金额 :{{product.allPrice}}元</text> </view> </view> <button @click="pay">立即结算</button> </view> </template>
以下是代码的样式:
```html
<template>
<view>
<view class="choose">
<view class="title">选择地址</view>
<view class="user_info">
<view class="name-phone">
<text>{{nickname}}</text>
<text>{{phone}}</text>
</view>
<view class="address">{{address_detail}}</view>
</view>
</view>
<!-- 订单信息 -->
<view class="order-content">
<view class="product">
<view class="img">
<image :src="'http://localhost:3000/'+product.img" mode=""></image>
</view>
<view class="right-info">
<view class="product-name">黑糖拿铁</view>
<view class="price-num">
<text>${{product.price}}</text>
<text>x{{product.num}}</text>
</view>
</view>
</view>
<view class="num-allprice">
<text>共计{{product.num}}件商品</text>
<text>订单金额 :{{product.allPrice}}元</text>
</view>
</view>
<button @click="pay">立即结算</button>
</view>
</template>
<style>
.choose {
/* 样式 */
}
.title {
/* 样式 */
}
.user_info {
/* 样式 */
}
.name-phone {
/* 样式 */
}
.address {
/* 样式 */
}
.order-content {
/* 样式 */
}
.product {
/* 样式 */
}
.img {
/* 样式 */
}
.right-info {
/* 样式 */
}
.product-name {
/* 样式 */
}
.price-num {
/* 样式 */
}
.num-allprice {
/* 样式 */
}
</style>
```
请注意,这里的样式只是示例,具体的样式需要根据实际情况进行调整。
作为uniapp开发,使用了<view class="uni-list-cell">,把行高设置为30rpx
可以通过在样式中设置height属性,将行高设置为30rpx。具体步骤如下:
1. 在view标签上添加class属性,值为uni-list-cell,这样可以使该view样式与uni-list-item相同,达到和uni-list-item一样的效果。
2. 在该view标签的样式中添加height属性,值为30rpx,即可将行高设置为30rpx。
示例代码如下:
```html
<template>
<view>
<view class="uni-list-cell" style="height:30rpx;">这是一行内容</view>
</view>
</template>
<style>
.uni-list-cell {
display: flex;
flex-direction: row;
align-items: center;
padding: 20rpx;
background-color: #fff;
border-bottom: 1rpx solid #eee;
box-sizing: border-box;
}
</style>
```