小编Mis*_*ify的帖子

如何阻止 Mud Blazor MudTable 列扩展以适合文本

我有一个包含 5 列的表,其中一列包含一些非常长的用户 ID(没有空格)。它不是将文本剪掉,而是扩展该列以容纳所有内容,将其他列推到右侧并导致出现滚动条。

该列正在扩展以适应长用户 ID

我已经研究了几个小时,试图找出如何修复宽度并阻止其溢出。我尝试将table-layout属性设置为fixed元素MudTable,并尝试使用width:20%; word-wrap:break-word; white-space:nowrap; overflow: hidden; text-overflow: ellipsis;我能想到的任何东西的变体,例如col MudTd等等,但没有任何效果,甚至没有任何效果。

该文档似乎根本没有涵盖溢出,这令人沮丧。设置col宽度效果很好,直到数据变得太长,并且设置max-width也没有帮助。

这似乎是 MudTable 中应该满足的问题,任何人都可以告诉我我做错了什么,或者建议修复吗?

这是我的桌子:

    <MudTable id="results-table" ServerData="@(new Func<TableState, Task<TableData<HiHi1User>>>(LoadUsers))" RowsPerPage="50" FixedHeader=@_tableFixedHeader FixedFooter=@_tableFixedFooter
         Style="table-layout:fixed" Height=@_tableFixedHeight Hover="true" Striped="true" Breakpoint="Breakpoint.Sm" Loading="@_loading" LoadingProgressColor="Color.Primary">
        <ColGroup>
            <col style="width:20%;" />
            <col style="width:20%;" />
            <col style="width:20%;" />
            <col style="width:20%;" />
            <col style="width:20%;" />
        </ColGroup>
        <HeaderContent>
            <MudTh id="user-id-hdr">User ID</MudTh>
            <MudTh id="group-id-hdr">Group ID</MudTh>
            <MudTh id="current-versions-hdr">Current Version</MudTh>
            <MudTh id="max-versions-hdr">Max Version</MudTh>
            <MudTh id="can-alter-gnf-hdr">Can Alter Night …
Run Code Online (Sandbox Code Playgroud)

css blazor mudblazor

6
推荐指数
1
解决办法
3041
查看次数

Python 海龟在边界内随机游走

我想使用海龟创建一个程序,该程序在随机方向上移动 50 次随机距离,在 x 和 y 轴上保持在 -300 到 300 范围内(通过向相反方向转动并在到达边界时向前移动) 。

当 if 语句为 true 时,代码运行良好,但偶尔当执行 else 语句时(由于超出边界),else 语句会一次又一次执行,直到计数达到 50。换句话说,它会沿着同一条线。我不明白为什么,因为当乌龟弹开时,它应该在边界内并再次运行 if 语句,而不是 else 语句。我该如何解决这个问题,以便乌龟在弹跳后继续随机行走?谢谢

我的代码如下所示

import turtle
import random

count = 0
while count <51:
    count += 1
    if (turtle.xcor() >-300 and turtle.xcor() <300) and\
       (turtle.ycor() >-300 and turtle.ycor() <300):
        turtle.forward(random.randint(30,100))
        turtle.right(random.randint(0,360))
    else:
        turtle.right(180)
        turtle.forward(300)
Run Code Online (Sandbox Code Playgroud)

python turtle-graphics

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

如何使用循环为字典中的每个值添加前缀?

我收到了以下字典:

phonebook = {'Tom': '0545345345367',
             'John': '0764345323434',
             'Sandy': '0235452342465',
             'Ewan': '0656875345234',
             'Andy': '0673423123454',
             'Rebecca': '0656875345234',
             'Vicky': '0456740034344',
             'Gary': '0656875345234'}
Run Code Online (Sandbox Code Playgroud)

问题是要求我'0044-'使用for循环在每个电话号码前添加前缀.我试图研究它,但我发现的一切似乎都太复杂了,不能像这样的问题.

python dictionary for-loop prefix

-1
推荐指数
1
解决办法
1649
查看次数