Warning: error_log(/data/www/wwwroot/hmttv.cn/caches/error_log.php): failed to open stream: Permission denied in /data/www/wwwroot/hmttv.cn/phpcms/libs/functions/global.func.php on line 537 Warning: error_log(/data/www/wwwroot/hmttv.cn/caches/error_log.php): failed to open stream: Permission denied in /data/www/wwwroot/hmttv.cn/phpcms/libs/functions/global.func.php on line 537 www.日本在线观看,激情综合网站,免费国产成人综合

          整合營銷服務商

          電腦端+手機端+微信端=數據同步管理

          免費咨詢熱線:

          x-spreadsheet-Web端優秀的Javas

          x-spreadsheet-Web端優秀的Javascript電子表格

          x-spreadsheet是一款開源的基于Web的Javascript電子表格,在Github獲得6k+的star,它在功能上有點類似于google sheet,可以說是簡化版的web excel,雖然沒excel那么強大,但也能夠應付一些需求了。

          Github和體驗地址

          Github:https://github.com/myliang/x-spreadsheet

          DEMO:https://myliang.github.io/x-spreadsheet/

          安裝

          提供兩種方式

          • 直接引用(使用cdn或者下載到本地)
          <link rel="stylesheet" >
          <script src="https://unpkg.com/x-data-spreadsheet@1.0.21/dist/xspreadsheet.js"></script>
          
          • NPM安裝
          npm install x-data-spreadsheet
          

          使用方式

          <div id="xspreadsheet"></div>
          <script>
           x.spreadsheet('#xspreadsheet');
          </script>
          

          在瀏覽器運行結果如圖:

          或者你也可以使用模塊化的方式使用

          import Spreadsheet from "x-data-spreadsheet";
          // If you need to override the default options, you can set the override
          // const options={};
          // new Spreadsheet('#x-spreadsheet-demo', options);
          const s=new Spreadsheet("#x-spreadsheet-demo")
           .loadData({}) // load data
           .change(data=> {
           // save data to db
           });
          // data validation
          s.validate()
          

          所有默認的配置

          {
           showToolbar: true,
           showGrid: true,
           showContextmenu: true,
           view: {
           height: ()=> document.documentElement.clientHeight,
           width: ()=> document.documentElement.clientWidth,
           },
           row: {
           len: 100,
           height: 25,
           },
           col: {
           len: 26,
           width: 100,
           indexWidth: 60,
           minWidth: 60,
           },
           style: {
           bgcolor: '#ffffff',
           align: 'left',
           valign: 'middle',
           textwrap: false,
           strike: false,
           underline: false,
           color: '#0a0a0a',
           font: {
           name: 'Helvetica',
           size: 10,
           bold: false,
           italic: false,
           },
           },
          }
          

          國際化

          <!-- Import via CDN -->
          <link rel="stylesheet" >
          <script src="https://unpkg.com/x-data-spreadsheet@1.0.21/dist/xspreadsheet.js"></script>
          <script src="https://unpkg.com/x-data-spreadsheet@1.0.21/dist/locale/zh-cn.js"></script>
          <script>
           x.spreadsheet.locale('zh-cn');
          </script>
          

          或者

          // npm 
          import Spreadsheet from 'x-data-spreadsheet';
          import zhCN from 'x-data-spreadsheet/dist/locale/zh-cn';
          Spreadsheet.locale('zh-cn', zhCN);
          new Spreadsheet(document.getElementById('xss-demo'));
          

          上圖是我測試中文的

          功能

          它包含了一些基本用得到的功能

          • 撤銷和重做
          • 背景色
          • 格式清除
          • 格式化
          • 字型
          • 字體大小
          • 字體粗體
          • 字體斜體
          • 下劃線
          • 刪除線
          • 文本顏色
          • 填充顏色
          • 邊界
          • 合并單元格
          • 對齊
          • 文本換行
          • 固定單元格
          • 函數
          • 調整尺寸行高,寬
          • 復制,剪切,粘貼
          • 自動填充
          • 插入行、列
          • 刪除行、列
          • 數據驗證

          完整實例代碼,可直接運行

          <!DOCTYPE html>
          <html lang="en">
          
          <head>
           <meta charset="UTF-8">
           <meta name="viewport" content="width=device-width, initial-scale=1.0">
           <meta http-equiv="X-UA-Compatible" content="ie=edge">
           <title>x-spreadsheet</title>
           <link rel="stylesheet" >
           <script src="https://unpkg.com/x-data-spreadsheet@1.0.21/dist/xspreadsheet.js"></script>
           <script src="https://unpkg.com/x-data-spreadsheet@1.0.21/dist/locale/zh-cn.js"></script>
          </head>
          
          <body onload="load()">
           <div id="x-spreadsheet-demo"></div>
           <script>
           function load() {
           x.spreadsheet.locale('zh-cn');
           var table=x.spreadsheet('#x-spreadsheet-demo', {})
           .loadData({
           freeze: 'B3',
           styles: [{
           bgcolor: '#f4f5f8',
           textwrap: true,
           color: '#900b09',
           border: {
           top: ['thin', '#0366d6'],
           bottom: ['thin', '#0366d6'],
           right: ['thin', '#0366d6'],
           left: ['thin', '#0366d6'],
           },
           }, ],
           merges: [
           'C3:D4',
           ],
           rows: {
           1: {
           cells: {
           0: {
           text: 'testingtesttestetst'
           },
           2: {
           text: 'testing'
           },
           },
           },
           2: {
           cells: {
           0: {
           text: 'render',
           style: 0
           },
           1: {
           text: 'Hello'
           },
           2: {
           text: 'haha',
           merge: [1, 1]
           },
           }
           },
           8: {
           cells: {
           8: {
           text: 'border test',
           style: 0
           },
           }
           }
           },
           });
          
           table.change((cdata)=> {
           // console.log(cdata);
           console.log(table.validate());
           console.log(table);
           });
           }
           </script>
          
          
          </body>
          
          </html>
          

          兼容性

          支持主流瀏覽器(chrome, firefox, Safari),Edge貌似有問題,本地測試未通過

          總結

          值得注意的是在Github提供的cdn中版本號較低,在國際化的時候會出現錯誤,因此在更改官網的cdn版本至1.0.21即可,可以直接使用我上面更改后的,已經親自測試過,如果你覺得它對你有幫助,請麻煩點贊、轉發加關注喲!后續更多實用技巧和工具等著你!

          件化寫法:

          HTML:

          <div class="wrape">

          <div class="tab clearfix">

          <div class="t-item">tab1</div>

          <div class="t-item">tab2</div>

          <div class="t-item cur">tab3</div>

          <div class="t-item">tab4</div>

          <div class="t-item">tab5</div>

          </div>

          <div class="page">

          <div class="p-item cur">頁面1</div>

          <div class="p-item">頁面2</div>

          <div class="p-item">頁面3</div>

          <div class="p-item">頁面4</div>

          <div class="p-item">頁面5</div>

          </div>

          </div>


          css:

          .wrap{height:500px;width:80%;margin:50px auto;box-shadow:5px #ccc;}.fl{float:left;}.clearfix:after{content:'';display:table;clear:both;}.tab .t-item{float:left;width:20%;text-align:center;border:1px solid #ccc;box-sizing:border-box;padding:10px 0;cursor:pointer;}.tab .t-item.cur{color:red;background:#efefef;}.page{position:relative;height:450px;}.page .p-item{display:none;line-height:100px;height:100px;text-align:center;position:absolute;top:0px;left:0;height:100%;width:100%;}.page .p-item.cur{display:block;}

          效果預覽:


          js:

          天小編為大家介紹五種css樣式布局以及內服源代碼作為介紹,采用的方式是行內級樣式(就是將css樣式代碼與html寫在一起)

          已知布局元素的高度,寫出三欄布局,要求左欄、右欄寬度各為300px,中間自適應。

          一、浮動布局

          <!DOCTYPE html>

          <html>

          <head>

          <meta charset="utf-8" />

          <title>浮動布局</title>

          <style type="text/css">

          .wrap1 div{

          min-height: 200px;

          }

          .wrap1 .left{

          float: left;

          width: 300px;

          background: red;

          }

          .wrap1 .right{

          float: right;

          width: 300px;

          background: blue;

          }

          .wrap1 .center{

          background: pink;

          }

          </style>

          </head>

          <body>

          <div class="wrap1">

          <div class="left"></div>

          <div class="right"></div>

          <div class="center">

          浮動布局

          </div>

          </div>

          </body>

          </html>

          浮動布局的兼容性比較好,但是浮動帶來的影響比較多,頁面寬度不夠的時候會影響布局。

          二、絕對定位布局

          <!DOCTYPE html>

          <html>

          <head>

          <meta charset="utf-8" />

          <title>絕對定位布局</title>

          <style type="text/css">

          .wrap2 div{

          position: absolute;

          min-height: 200px;

          }

          .wrap2 .left{

          left: 0;

          width: 300px;

          background: red;

          }

          .wrap2 .right{

          right: 0;

          width: 300px;

          background: blue;

          }

          .wrap2 .center{

          left: 300px;

          right: 300px;

          background: pink;

          }

          </style>

          </head>

          <body>

          <div class="wrap2 wrap">

          <div class="left"></div>

          <div class="center">

          絕對定位布局

          </div>

          <div class="right"></div>

          </div>

          </body>

          </html>

          絕對定位布局快捷,但是有效性比較差,因為脫離了文檔流。

          三、flex布局

          <!DOCTYPE html>

          <html>

          <head>

          <meta charset="utf-8" />

          <title>flex布局</title>

          <style type="text/css">

          .wrap3{

          display: flex;

          min-height: 200px;

          }

          .wrap3 .left{

          flex-basis: 300px;

          background: red;

          }

          .wrap3 .right{

          flex-basis: 300px;

          background: blue;

          }

          .wrap3 .center{

          flex: 1;

          background: pink;

          }

          </style>

          </head>

          <body>

          <div class="wrap3 wrap">

          <div class="left"></div>

          <div class="center">

          flex布局

          </div>

          <div class="right"></div>

          </div>

          </body>

          </html>

          自適應好,高度能夠自動撐開

          四、table-cell表格布局

          <!DOCTYPE html>

          <html>

          <head>

          <meta charset="utf-8" />

          <title>table-cell表格布局</title>

          <style type="text/css">

          .wrap4{

          display: table;

          width: 100%;

          height: 200px;

          }

          .wrap4>div{

          display: table-cell;

          }

          .wrap4 .left{

          width: 300px;

          background: red;

          }

          .wrap4 .right{

          width: 300px;

          background: blue;

          }

          .wrap4 .center{

          background: pink;

          }

          </style>

          </head>

          <body>

          <div class="wrap4 wrap">

          <div class="left"></div>

          <div class="center">

          表格布局

          </div>

          <div class="right"></div>

          </div>

          </body>

          </html>

          兼容性好,但是有時候不能固定高度,因為會被內容撐高。

          五、網格布局

          <!DOCTYPE html>

          <html>

          <head>

          <meta charset="utf-8" />

          <title>網格布局</title>

          <style type="text/css">

          .wrap5{

          display: grid;

          width: 100%;

          grid-template-rows: 200px;

          grid-template-columns: 300px auto 300px;

          }

          .wrap5 .left{

          background: red;

          }

          .wrap5 .right{

          background: blue;

          }

          .wrap5 .center{

          background: pink;

          }

          </style>

          </head>

          <body>

          <div class="wrap5 wrap">

          <div class="left"></div>

          <div class="center">

          網格布局

          </div>

          <div class="right"></div>

          </div>

          </body>

          </html>

          希望大家可以一直關注我,支持我!感謝!!!


          主站蜘蛛池模板: 亚洲熟妇无码一区二区三区导航| 久久国产香蕉一区精品 | 久久精品无码一区二区三区| 精品国产一区AV天美传媒| 日本一区二区三区免费高清| 亚洲视频一区二区| 国产综合无码一区二区色蜜蜜| 精品少妇一区二区三区视频| 国产精品一区二区av不卡| 中文字幕无线码一区二区| 亚洲日韩AV一区二区三区中文 | 国产精品美女一区二区三区| 亚洲电影一区二区三区| 中文字幕亚洲一区二区三区| 精品国产一区在线观看| 成人丝袜激情一区二区| 亚洲福利秒拍一区二区| 久久人做人爽一区二区三区| 中文字幕无线码一区| 国产一区二区电影在线观看| 亚洲一区二区三区无码影院| 久久久久人妻一区精品| 日本在线视频一区| 国产日韩一区二区三区在线观看| 亚洲av片一区二区三区| 久久久久一区二区三区| 亚洲一区二区三区免费观看| 亚洲熟妇成人精品一区| 色窝窝免费一区二区三区| 日韩社区一区二区三区| 日本不卡一区二区视频a| 无码中文字幕人妻在线一区二区三区 | 国产一区二区三区播放心情潘金莲 | 少妇一夜三次一区二区| 一区二区三区在线播放视频| 无码国产精品一区二区免费3p | 日韩精品一区二区午夜成人版 | 国产免费伦精品一区二区三区 | 精品一区二区三区在线观看l | 中文字幕av无码一区二区三区电影| 国产一区二区三区免费|