显示不显示任何表并在sweetalert2内进行阻止

问题描述 投票:0回答:1

我正在用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个回答
0
投票

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

Codepen示例仅因为输入和受影响的DIV是同级而起作用,因此可以使用同级组合器~。没有CSS方法可以通过父母移动到其他元素。

© www.soinside.com 2019 - 2024. All rights reserved.