小编Kar*_*rma的帖子

React-Native:嵌套在SectionList中的Flatlist

我正在尝试在部分列表中呈现几个平面列表。最终目标是这样的:

包含多个部分的提要页面(您过去的订单、午餐时间等)

但是,我似乎无法让它正确渲染。它多次渲染同一个项目。

            <SafeAreaView style={styles.container}>
                <SectionList
                    sections={posts}
                    keyExtractor={(item, index) => item + index}
                    renderItem={({ item }) => 
                        <FlatList
                            horizontal
                            data={posts}
                            renderItem={this.renderPosts}
                            keyExtractor={(item, index) => index}
                        />
                    }
                    renderSectionHeader={({ section: { title } }) => (
                        <Text style={styles.header}>{title}</Text>
                    )}
                />
            </SafeAreaView>





    renderPosts = (element) => {
        const { image, opinions, votes, name } = element.item;
        return (
            <Card>
                <Card.Cover source={{ uri: image }}/>
                <View>
                    <Card.Content>
                        <Title numberOfLines={1}>{name}</Title>
                    </Card.Content>

                    <Card.Content>
                        <Caption>{opinions} opinions</Caption>

                        <Headline style={{ fontSize: 10 }}>{votes}%</Headline>
                    </Card.Content>
                </View>
            </Card>
        )
    }
Run Code Online (Sandbox Code Playgroud)

JSON …

json reactjs react-native react-native-flatlist react-native-sectionlist

5
推荐指数
1
解决办法
1万
查看次数

Django CSS未更新

我有以下代码可以在我的Django项目的base.html中引用我的CSS脚本:

<link href="{% static 'css/project.css' %}" rel="stylesheet">
Run Code Online (Sandbox Code Playgroud)

问题是,每当我从“ project.css”添加/删除样式时,运行服务器时它都不会更新。

我知道发生这种情况是因为每次页面加载时,浏览器缓存都会认为它之前已经看到过该文件,然后从磁盘重新加载缓存的版本。我也知道一个解决方案是每次进行更新时都更改css文件名。

每次刷新浏览器时,是否有更简单的方法来重新加载.css文件?

提前致谢

css django

1
推荐指数
3
解决办法
2632
查看次数