我使用Vex来显示对话框。我需要条件显示或隐藏输入内的文本。
我有这个:
$(document).ready(function($) {
$('.w-more').click(function(){
var quota_ini = $(this).data('w-userquota');
var quota_current = $(this).data('w-quota');
vex.dialog.open({
message: 'Hola!',
input: [
'Cantidad actual: '+quota_ini+'€<br>',
'Cantidad apostada: '+quota_current +'€<br>'
].join('')
});
});
})
&#13;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/vex-js/2.3.4/css/vex-theme-os.css" rel="stylesheet"/>
<link href="https://cdnjs.cloudflare.com/ajax/libs/vex-js/2.3.4/css/vex.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vex-js/2.3.4/js/vex.combined.min.js"></script>
<div class='w-more' data-w-userquota="0" data-w-quota="20">Click</div>
&#13;
我需要这样的东西:
$('.more').click(function(){
var quota_ini = $(this).data('w-userquota');
var quota_current = $(this).data('w-quota');
vex.dialog.open({
message: 'Hola!',
input: [
if (quota_ini>0) {'Cuota actual: '+quota_ini+'<br>'},
if (quota_current>0) {'Cuota actual: '+quota_current+'<br>'}
].join('')
});
});
&#13;
有什么想法吗?或者有任何模态替代方法吗?