YouKnowMe
YouKnowMe
  • 发布:2023-03-05 17:57
  • 更新:2023-03-05 17:57
  • 阅读:220

在小程序中设置uni-th的样式问题

分类:uni-app

下面的代码是用于固定表格的第一列在最左边,这样横向滚动表格的时候第一列始终显示,此代码在H5和APP中都没问题,但在微信小程序中class="fixcol"不会被编译到代码中,被过滤了(换成style也会被过滤),麻烦核实一下

<template>  
    <view>  
        <view class="scrolltable">  
            <uni-table border stripe>  
                <uni-tr>  

                    <uni-th :width="80" class="fixcol">编号</uni-th>  
                    <uni-th :width="90" v-for="i in 30"><text>列{{i}}</text></uni-th>  
                </uni-tr>  
                <uni-tr>  
                    <uni-td :width="80"  class="fixcol">777</uni-td>  
                    <uni-td :width="90" v-for="i in 30">数据{{i}}</uni-td>  
                </uni-tr>  
            </uni-table>  
        </view>  
    </view>  
</template>  

<script>  
    export default {  
        data() {  
            return {  

            }  
        },  

        methods: {  

        }  
    }  
</script>  

<style>  
    .scrolltable {  
        width: 300px;  
        min-width: 100%;  
        table-layout: auto;  
        white-space: nowrap;  
    }  

    .fixcol {  
        position: -webkit-sticky;  
        /* Safari */  
        position: sticky;  
        left: 0;  
        z-index: 1;  
        background-color: white;  
    }  
</style>  
2023-03-05 17:57 负责人:无 分享
已邀请:

要回复问题请先登录注册