【问题标题】:Show tables with display none and block inside a sweetalert2在 sweetalert2 中显示不显示和阻塞的表
【发布时间】:2020-02-23 04:43:48
【问题描述】:

我正在使用 TypeScript 在 sweetalert 中编写 HTML,并且我想在单击列表中的某个项目时显示和隐藏一个表格。我尝试了显示无和显示块,但它不起作用。

我有两个不同的 div,一个 div 有以下列表

 '<div class="page" style="display:flex !important; flex-direction:row !important; height:100vh !important;">'+
        '<div class="sidebar" style="flex:1 !important; border:solid black 1px !important; height:100% !important;" >'+
           '<ul class="list-group">'+
            '<li class="list-group-item" for="show"><span>Acceso a Universal</span></li>'+// acceso a universal deberia mostrar la tabla al darle click pero no hace nada ppor lo mismo del style que falta de aplicar.
            '<input type="radio" id="show" name="group" style="display: none !important;">'+//creamor un radio para poder seleccionar desde el span
            '<li class="list-group-item" for="show1">Carga de Información</li>'+
            '<input type="radio" id="show1" name="group" style="display: none !important;">'+
            '<li class="list-group-item" for="show2">Reportes</li>'+
            '<input type="radio" id="show2" name="group" style="display: none !important;">'+
            '<li class="list-group-item" for="show3">Banco de Archivos</li>'+
            '<input type="radio" id="show3" name="group" style="display: none !important;">'+
            '<li class="list-group-item" for="show4">SITI</li>'+
            '<input type="radio" id="show4" name="group" style="display: none !important;">'+
         '</ul>'+
        '</div>'+ 

另一个div有下表

'<div id="contenido" style="display:none !important;">'+'<table  class="table table-hover mb-0" style="border-collapse: separate !important;hight:border-spacing: 500px 500px!important;" >'+
            '<tr style="font-size: 12px !important;text-align:left !important;">'+
            '<th>Tipo de Permiso</th>'+'<th>Tipo de Permiso </th>'+'<th>Tipo de Permiso</th>'+'</tr>'+
            '<tr style=" font-size: 12px !important; text-align:left !important;"><td>'+accesoUniversal[0]+'</td>'+'<td>'+ accesoUniversal[1] +'</td><td>'+ accesoUniversal[2] +'</td></tr>'+'</table>'+'</div>'+

我基于下面的例子https://codepen.io/sekane81/pen/XbEVYv

【问题讨论】:

    标签: html css angular sweetalert2


    【解决方案1】:

    您将需要一个 Javascript 函数来更改表的 display 值。某种onChange 函数,它使用选中的单选按钮的值。

    Codepen 示例之所以有效,是因为输入和受影响的 DIV 是同级的,因此您可以使用同级组合器 ~。没有 CSS 方法可以向上移动通过父元素到达其他元素。

    【讨论】:

      猜你喜欢
      • 2014-05-14
      • 1970-01-01
      • 1970-01-01
      • 2015-03-08
      • 1970-01-01
      • 2012-01-28
      • 1970-01-01
      • 2011-02-21
      • 1970-01-01
      相关资源
      最近更新 更多