在微信小程序開發過程中 遇到個坑 此處引用 swipeCell 組件 剛開始是組件不顯示 然后又遇到樣式不生效
首先排除問題
- 是否在.json文件中引入了組件
{"usingComponents": {"van-swipe-cell": "@vant/weapp/swipe-cell/index","van-cell-group": "@vant/weapp/cell-group/index","van-cell": "@vant/weapp/cell/index",},"navigationBarTitleText": "收貨地址"
}
- 是否在 wxml中引入了該組件
<van-swipe-cell right-width="{{ 65 }}" left-width="{{ 65 }}"><view slot="left" class="van-swipe-cell__left">選擇</view><van-cell-group><van-cell title="單元格" value="內容" /></van-cell-group><view slot="right" class="van-swipe-cell__right">刪除</view>
</van-swipe-cell>
排除了以上問題 swipeCell 顯示了 但是 左右滑動 樣式不對
解決辦法
在 .scss 文件中 自己寫樣式吧
.van-swipe-cell__right {display: flex;justify-content: center;align-items: center;width: 130rpx;font-size: 30rpx;color: #fff;background-color: #f44;
}.van-swipe-cell__left {background-color: #07c160;
}
各位大佬 有沒有其它解決辦法 麻煩 留言指教下 拜托拜托!!