如何添加超链接,如条款和条件 Xtemplate?
How to Add An Hyperlink Like Terms and Conditions Xtemplate?
{
xtype : 'label',
cls : 'termsandconditions',
html : ['<div>You are agreeing to our <a href="#" onclick="window.open("http://www.google.com", "_system");"> Terms and Conditions']
}
这正是我所做的。这是正确的做法吗?
没有正确的方法来做到这一点,但使用 component
和 autoEl
属性 似乎是最简单的方法。我这样使用它:
{
xtype : 'component',
type : 'button',
style : {
fontSize : '0.8em'
},
autoEl : {
tag : 'a',
href : '#',
html : 'Legal Notice'
},
listeners: {
click: {
element: 'el',
fn: function(e)
{
window.open('/path/to/document', '_blank');
}
}
}
}
你好终于有了一个我喜欢的工作。
{
xtype: 'component',
cls: 'termsandconditions',
tpl: [
'You are agreeing to our ',
'<a onclick="{termsLink}"> ',
'Terms and Conditions',
'</a>',
],
data: {
termsLink: "window.open('http://www.google.com','_system');",
}
}
{
xtype : 'label',
cls : 'termsandconditions',
html : ['<div>You are agreeing to our <a href="#" onclick="window.open("http://www.google.com", "_system");"> Terms and Conditions']
}
这正是我所做的。这是正确的做法吗?
没有正确的方法来做到这一点,但使用 component
和 autoEl
属性 似乎是最简单的方法。我这样使用它:
{
xtype : 'component',
type : 'button',
style : {
fontSize : '0.8em'
},
autoEl : {
tag : 'a',
href : '#',
html : 'Legal Notice'
},
listeners: {
click: {
element: 'el',
fn: function(e)
{
window.open('/path/to/document', '_blank');
}
}
}
}
你好终于有了一个我喜欢的工作。
{
xtype: 'component',
cls: 'termsandconditions',
tpl: [
'You are agreeing to our ',
'<a onclick="{termsLink}"> ',
'Terms and Conditions',
'</a>',
],
data: {
termsLink: "window.open('http://www.google.com','_system');",
}
}