插入Html代码Ext.ui.iFrame的问题 在EXTJS中,我想在iframe中插入下面的html代码:
测试代码ExtJs正在工作 Ext.create(' Ext.ux.IFrame',{ id:iframeId, contentEl = X }
答案 0 :(得分:0)
您需要使用setHtml()
方法在uxiframe
中插入html。
在 FIIDLE 中,我使用uxiframe
创建了一个演示版。我希望这可以帮助您或指导您实现您的要求。
代码段
Ext.application({
name: 'TestIframe',
requires: ['Ext.ux.IFrame'],
launch: function () {
Ext.create('Ext.panel.Panel', {
renderTo: Ext.getBody(),
layout: 'hbox',
title: 'Ux iFrame example',
items: [{
xtype: 'uxiframe',
itemId: 'uxiframe',
height: window.innerHeight,
width: '100%',
src: 'https://fiddle.sencha.com/#view/editor'
}],
tbar: ['->', {
xtype: 'button',
text: 'Insert HTML',
margin: '0 15 0 0',
handler: function () {
this.up('panel').down('#uxiframe').setHtml(`<form action="/action_page.php">First name:<br><input type="text" name="firstname" value="Mickey"><br>Last name:<br><input type="text" name="lastname" value="Mouse"><br><br><input type="submit" value="Submit"></form> `);
}
}]
});
}
});