小程序
小游戏
企业微信
微信支付
扫描小程序码分享
之前那位好心大佬帮我写出来的能不能再给我一份,之前的不小心被我删了
3 个回答
加粗
标红
插入代码
插入链接
插入图片
上传视频
这会儿开发者工具抽风,没法发出来了。。直接贴代码吧
js: const app = getApp() Page({ data: { test: [1, 2, 3], start: 6, end: 24, list: [ { label: "今天", values: [7, 8, 9, 20, 21] }, { label: "昨天", values: [10, 11, 12, 13, 14] }, ] }, }) wxml: <wxs module="util"> function hasValue(values, value) { return values.indexOf(value) != -1 } module.exports.hasValue = hasValue </wxs> <view class="title-column"> <view class="title">时段</view> <view class="mark" wx:for="{{end-start+1}}" wx:key="$this"> <view class="mark-start"> <view class="mark-label">{{item+start}}</view> <view class="mark-line"></view> </view> </view> </view> <view class="value-column" wx:for="{{list}}" wx:key="label"> <view class="title">{{item.label}}</view> <view class="value {{util.hasValue(item.values, hour+start)?'has-value':'not-has-value'}}" wx:for="{{end-start+1}}" wx:for-item="hour" wx:key="$this"> </view> </view> wxss: .title-column { display: flex; height: 60rpx; line-height: 60rpx; font-size: 18rpx; border-bottom: 1px solid #333; } .title { width: 100rpx; flex-shrink: 0; text-align: center; } .mark { flex: 1 0 0; position: relative; } .mark-start { position: absolute; left: 0; width: 0; display: flex; flex-direction: column; align-items: center; } .mark-line { width: 1px; height: 4px; background-color: #333; position: absolute; bottom: 0; } .mark:nth-child(2n+1) .mark-label { opacity: 0; } .mark:nth-child(2n+1) .mark-line { height: 2px; } .value-column { display: flex; align-items: center; height: 40rpx; line-height: 40rpx; font-size: 18rpx; } .value { flex: 1 0 0; height: 30rpx; } .has-value { background-color: #aaa; } .not-has-value { background-color: red; } .value:last-child { background-color: transparent; }
你好,麻烦通过点击下方“反馈信息”按钮,提供出现问题的。
</div>
<script type="text/javascript">
new Vue({
el: '#app',
data: {
start: 6,
end: 24,
test: [1, 2, 3],
list: [{
label: "今天",
values: [7, 8, 9, 20, 21]
},
{
label: "昨天",
values: [10, 11, 12, 13, 14]
]
// Vue.filter('my-filter', function (value) {
// // 返回处理后的值
// })
});
// <wxs module="util">
// function hasValue(values, value) {
// return values.indexOf(value) != -1
// }
// module.exports.hasValue = hasValue
// </wxs>
</script>
<style>
.title-column {
display: flex;
height: 60rpx;
line-height: 60rpx;
font-size: 18rpx;
border-bottom: 1px solid #333;
查看你的历史代码
自己用CSS也可以写一套,不难
关注后,可在微信内接收相应的重要提醒。
请使用微信扫描二维码关注 “微信开放社区” 公众号
这会儿开发者工具抽风,没法发出来了。。直接贴代码吧
js: const app = getApp() Page({ data: { test: [1, 2, 3], start: 6, end: 24, list: [ { label: "今天", values: [7, 8, 9, 20, 21] }, { label: "昨天", values: [10, 11, 12, 13, 14] }, ] }, }) wxml: <wxs module="util"> function hasValue(values, value) { return values.indexOf(value) != -1 } module.exports.hasValue = hasValue </wxs> <view class="title-column"> <view class="title">时段</view> <view class="mark" wx:for="{{end-start+1}}" wx:key="$this"> <view class="mark-start"> <view class="mark-label">{{item+start}}</view> <view class="mark-line"></view> </view> </view> </view> <view class="value-column" wx:for="{{list}}" wx:key="label"> <view class="title">{{item.label}}</view> <view class="value {{util.hasValue(item.values, hour+start)?'has-value':'not-has-value'}}" wx:for="{{end-start+1}}" wx:for-item="hour" wx:key="$this"> </view> </view> wxss: .title-column { display: flex; height: 60rpx; line-height: 60rpx; font-size: 18rpx; border-bottom: 1px solid #333; } .title { width: 100rpx; flex-shrink: 0; text-align: center; } .mark { flex: 1 0 0; position: relative; } .mark-start { position: absolute; left: 0; width: 0; display: flex; flex-direction: column; align-items: center; } .mark-line { width: 1px; height: 4px; background-color: #333; position: absolute; bottom: 0; } .mark:nth-child(2n+1) .mark-label { opacity: 0; } .mark:nth-child(2n+1) .mark-line { height: 2px; } .value-column { display: flex; align-items: center; height: 40rpx; line-height: 40rpx; font-size: 18rpx; } .value { flex: 1 0 0; height: 30rpx; } .has-value { background-color: #aaa; } .not-has-value { background-color: red; } .value:last-child { background-color: transparent; }
</div>
<script type="text/javascript">
new Vue({
el: '#app',
data: {
start: 6,
end: 24,
test: [1, 2, 3],
list: [{
label: "今天",
values: [7, 8, 9, 20, 21]
},
{
label: "昨天",
values: [10, 11, 12, 13, 14]
},
]
},
// Vue.filter('my-filter', function (value) {
// // 返回处理后的值
// })
});
// <wxs module="util">
// function hasValue(values, value) {
// return values.indexOf(value) != -1
// }
// module.exports.hasValue = hasValue
// </wxs>
</script>
<style>
.title-column {
display: flex;
height: 60rpx;
line-height: 60rpx;
font-size: 18rpx;
border-bottom: 1px solid #333;
查看你的历史代码
自己用CSS也可以写一套,不难