为什么标签 Width: 'auto' 隐藏了无线电场?

Why labelWidth: 'auto' is hidding the radiofield?

我正在尝试包装 radiofieldlabel,但由于视图的响应性,我不想设置固定的 widthlabelWidth .但是当我将 labelWidth 设置为 autoinput element 被隐藏。

我做错了吗?谢谢。

在 sencha fiddle 和 select Ext JS 6.5.3.57 - Triton [Modern] 下拉菜单的启动函数中添加以下代码。

Ext.create('Ext.Panel', {
        fullscreen: true,
        layout: {
          type: 'vbox',
          align: 'stretch',
          pack: 'start'
        },
        items: [
            {
                xtype: 'panel',
                //flex: 1,
                //height: 100,
                layout: {
                  type: 'hbox',
                  align: 'stretch',
                  pack: 'start'
                },
                items: [
                    {
                        xtype: 'radiofield',
                        flex: 3,
                        //width: '100%',
                        label: 'afglngfsdlgkdslfkjsdlfkjdslkfjdslfkjsdlfkjsdlkfjsdlkfjsdlkfjdslkfjsdlkfjsdlkfjdslkfjldskfjsldkfjlsdkfjlsdkfjlsdkfjlsdkfjlkdsjflsdkjflsdkjflsdkjflsdkjflsdkjfklslfkdfjsldfk',
                        labelAlign: 'right',
                        labelWrap: true,
                        labelWidth: 'auto',
                        style: 'word-wrap: break-word;',
                        name : 'color',
                        value: 'red',
                        checked: true
                    },
                    {
                        xtype: 'textfield',
                        flex: 1,
                        margin: '0 0 0 10'
                    }
                ]
            }
        ]
    });

labelWrap true 允许标签换行。如果设置为 false,标签将被省略号截断。

CSSword-wrap属性定义当单词太长放不下时浏览器是否允许在单词内换行在它的容器内。

这里是FIDDLE,我创建了一个演示。我希望这会 help/guide 你达到你的要求。

代码片段

Ext.application({
    name: 'Fiddle',

    launch: function () {
        Ext.create({
            xtype: 'panel',
            fullscreen: true,
            layout: {
                type: 'vbox',
                align: 'stretch',
                pack: 'start'
            },
            items: [{
                xtype: 'panel',
                layout: {
                    type: 'hbox',
                    align: 'stretch',
                    pack: 'start'
                },
                items: [{
                    xtype: 'radiofield',
                    flex: 3,
                    label: 'afglngfsdlgkdslfkjsdlfkjdslkfjdslfkjsdlfkjsdlkfjsdlkfjsdlkfjdslkfjsdlkfjsdlkfjdslkfjldskfjsldkfjlsdkfjlsdkfjlsdkfjlsdkfjlkdsjflsdkjflsdkjflsdkjflsdkjflsdkjfklslfkdfjsldfk',
                    labelAlign: 'right',
                    labelWidth: 'auto',
                    name: 'color',
                    value: 'red',
                    checked: true
                }, {
                    xtype: 'textfield',
                    placeHolder: 'example',
                    flex: 1,
                    margin: '0 0 0 10'
                }, {
                    xtype: 'radiofield',
                    flex: 1,
                    label: 'The word-break CSS property specifies whether or not the browser should insert line breaks wherever the text would otherwise overflow its content box.',
                    labelAlign: 'right',
                    labelWrap: true,
                    labelWidth: 'auto',
                    name: 'color',
                    value: 'red'
                }]
            }]
        });
    }
});