欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

angularJS實(shí)現(xiàn)表格部分列展開(kāi)縮起示例代碼

 更新時(shí)間:2021年09月09日 11:09:42   作者:爭(zhēng)??!……  
這篇文章主要介紹了angularJS實(shí)現(xiàn)表格部分列展開(kāi)縮起示例代碼,代碼簡(jiǎn)單易懂,對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下

AngularJS 簡(jiǎn)介

AngularJS 是一個(gè) JavaScript 框架。它可通過(guò) <script> 標(biāo)簽添加到 HTML 頁(yè)面。

AngularJS 通過(guò) 指令 擴(kuò)展了 HTML,且通過(guò) 表達(dá)式 綁定數(shù)據(jù)到 HTML。

AngularJS 是一個(gè) JavaScript 框架

AngularJS 是一個(gè) JavaScript 框架。它是一個(gè)以 JavaScript 編寫(xiě)的庫(kù)。

AngularJS 是以一個(gè) JavaScript 文件形式發(fā)布的,可通過(guò) script 標(biāo)簽添加到網(wǎng)頁(yè)中:

<script src="https://cdn.staticfile.org/angular.js/1.4.6/angular.min.js"></script>

下面看下angularJS實(shí)現(xiàn)表格部分列展開(kāi)縮起示例代碼,效果圖如下所示:

在這里插入圖片描述
在這里插入圖片描述

<html>
<head>
    <title> New Document </title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <script src="https://cdn.staticfile.org/angular.js/1.4.6/angular.min.js"></script>

    <!--    <script src='https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js'></script>-->
    <style type="text/css">
        table, tr, td, caption{
            border:1px solid #666;
            border-collapse:collapse;
            background-color:rgb(210, 219, 236);
        }

        td, caption{
            /*font-family:'微軟雅黑';*/
            font-family: "Fira Code Light";
            font-size:12px;
            text-align:center;
            padding:3px 15px;
        }

        caption{
            border-bottom:none;
            cursor:pointer;
        }
    </style>

    <script>
        var app = angular.module('myApp', []);
        app.controller('myCtrl', function($scope) {
            //默認(rèn)縮起
            $scope.myVar = true
            //顯示隱藏按鈕
            $scope.openClose = function () {
                $scope.myVar = !$scope.myVar;
                $scope.myVar1 = !$scope.myVar1;
            };
        });

    </script>
</head>

<body>
<table ng-app="myApp" ng-controller="myCtrl">
    <caption ng-click="openClose()">顯示/隱藏價(jià)格</caption>
    <tr>
        <td >產(chǎn)品</td>
        <td ng-hide = 'myVar1' ng-click="openClose()">...</td>
        <td  ng-hide = 'myVar'>價(jià)格</td>
        <td  ng-hide = 'myVar'>價(jià)格</td>
        <td  ng-hide = 'myVar'>價(jià)格</td>
        <td  ng-hide = 'myVar'>價(jià)格</td>
        <td >銷量</td>
    </tr>
    <tr>
        <td>A</td>
        <td ng-hide = 'myVar1'>...</td>
        <td  ng-hide = 'myVar'>18元</td>
        <td  ng-hide = 'myVar'>28元</td>
        <td  ng-hide = 'myVar'>38元</td>
        <td  ng-hide = 'myVar'>48元</td>
        <td>2</td>
    </tr>
    <tr>
        <td>B</td>
        <td ng-hide = 'myVar1'>...</td>
        <td  ng-hide = 'myVar'>77元</td>
        <td  ng-hide = 'myVar'>88元</td>
        <td  ng-hide = 'myVar'>88元</td>
        <td  ng-hide = 'myVar'>88元</td>
        <td>3</td>
    </tr>
    <tr>
        <td>C</td>
        <td ng-hide = 'myVar1'>...</td>
        <td  ng-hide = 'myVar'>66元</td>
        <td  ng-hide = 'myVar'>88元</td>
        <td  ng-hide = 'myVar'>88元</td>
        <td  ng-hide = 'myVar'>88元</td>
        <td>4</td>
    </tr>
</table>
</body>
</html>

到此這篇關(guān)于angularJS實(shí)現(xiàn)表格部分列展開(kāi)縮起示例代碼的文章就介紹到這了,更多相關(guān)angularJS表格展開(kāi)縮起內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評(píng)論