【问题标题】:Image field with sencha touch带煎茶触摸的图像场
【发布时间】:2012-05-11 13:49:11
【问题描述】:

我正在使用 sencha touch 来制作 form.fieldset。在我的模型中,我有一个图像字段,我该如何显示模型的当前图像?我的 form.fieldset 看起来像:

/**
 * This is used by the NestedList example to allow editing of an item in the Store
 */
Ext.define('ParkingSencha.view.EditorPanel', {
    extend: 'Ext.form.Panel',
    requires: ['Ext.form.FieldSet'],
    id: 'editorPanel',
    config: {
        modal: true,
        hideOnMaskTap: false,
        centered: true,
        width: 500,
        scrollable: false,
        items: [{
            xtype: 'fieldset',
            items: [
            {
                xtype: 'textfield',
                name: 'keyword',
                label: 'Mots clés'
            },
            {
                xtype: 'textfield',
                name: 'title',
                label: 'Titre'
            },
            {
                xtype: 'textfield',
                name: 'image',
                label: 'image'
            }
            ]
          }]
        }]
    }
});

【问题讨论】:

  • 您希望将图像加载到第三个文本字段区域吗?
  • 是的,我想将它加载到第三个文本字段中。我的图像存储在我的服务器上。

标签: sencha-touch extjs4 extjs


【解决方案1】:

对于在formfield使用/加载image,您需要使用image 组件,而不是textfield

这样做,

....
{
  xtype: 'image',
  src: 'http://www.sencha.com/assets/images/sencha-avatar-64x64.png',
  flex: 1
},
....

【讨论】:

  • 文本字段中的图像?这有什么意义呢?
  • 当您使用图像编辑模型时。您想显示当前图像吗?这就是我想做的。我写 textfield 只是因为我不知道该用什么。
  • 图像组件用于ST中的图像,而不是文本字段。
  • 我知道,你有什么解决办法吗?
【解决方案2】:

还有另一种解决方案,可以使用标签并在 html 标记内设置图像 ....:) 像这样

{
xtype:'label',
html:'<img src="path of image ">'
}

或者boomslang ans是不正确的,我会推荐你​​使用那个..

【讨论】:

    猜你喜欢
    • 2012-11-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-12-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多