npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

trs-page-html

v1.0.15

Published

pug模板储存仓库

Downloads

18

Readme

这是一个pug模板储存仓库

使用

// 安装
 npm install trs-page-html -D
// 引用对应模板即可
// 举个例子
//- 1. include ../../../src/pug/part/NewsList.pug
//- 2. +NewsList(6) 数字数量决定渲染的列表数量

简述

  1. 相关的公共css文件在项目中已有储存,这个地方备份了一份。
  2. 这里只是pug模板,其他非公共css和所有的js请在自己项目中添加

组件一览

1. HotNew (新闻头条)

示例

在需要应用的地方

// xxx.pug部分
include ../../../src/pug/part/HotNews.pug

.yydh-div.toutiao
    +HotNews(length)

// xxx.js部分
// 自己在pug添加所需js
var swp6 = new Swiper('.toutiao .swiper-container', {
    autoplay: 2500,
    loop: true,
    speed: 1000,
    mode: 'vertical',
    autoplayDisableOnInteraction: false
});
$('.toutiao').hover(function() {
    swp6.stopAutoplay();
},function() {
    swp6.startAutoplay();
})

| 参数 | 类型 | 例子 |备注 | |-----|-----|------|------| | length | number | 5 | 指的是头条新闻的数量 |

2. NewsList (新闻列表)

示例

在需要应用的地方

// xxx.pug部分
include ../../../src/pug/part/NewsList.pug

.yydh-div
    +NewsList(6)

| 参数 | 类型 | 例子 |备注 | |-----|-----|------|------| | length | number | 5 | 指的是新闻的数量 |

3. SlideNav (侧边导航)

示例

在需要应用的地方

// xxx.pug部分
include ../../../src/pug/part/SlideNav.pug

.yydh-div
    +SlideNav(['当地要闻', '部门信息', '乡镇动态', '中国政务', '当地政务', '媒体关注'])

| 参数 | 类型 | 例子 |备注 | |-----|-----|------|------| | arr | array | ['当地要闻', '部门信息', '...'] | 需要展示的导航名字 |

4. FriendshipLinks (友情链接)

示例

在需要应用的地方

// xxx.pug部分
include ../../../src/pug/part/FriendshipLinks.pug

.yydh-div
    +FriendshipLinks(['中央部省网站1', '中央部省网站2', '中央部省网站3', '中央部省网站4'])

// xxx.js部分
// 自己在pug添加所需js
$('.drop-select').dropDownImgText({
    tag: '.select',
    text: '.text',
    arrow: '.arrow-icon',
    drop: '.dropdown-menu',
    label: '.a'
});

| 参数 | 类型 | 例子 |备注 | |-----|-----|------|------| | arr | array | ['中央部省网站1', '中央部省网站2',...] | 指的是友情链接初始的名字 |

5. CmPage (分页)

示例

在需要应用的地方

// xxx.pug部分
include ../../../src/pug/part/CmPage.pug

.yydh-div
    +CmPage()
5. Location (当前位置)

示例

在需要应用的地方

// xxx.pug部分
include ../../../src/pug/part/Location.pug

.yydh-div
    +Location()
6. CmTab (切换)

示例

在需要应用的地方

// xxx.pug部分
include ../../../src/pug/part/CmTab.pug

.yydh-div.tab
    +CmTab({arr:['通知公告1', '便民提示1'], topClass:'top1',  contClass: 'cont1'})

// xxx.js部分
// 自己在pug添加所需js
$('.tab .cm-tab').tabSwitch({
    tabHead: '.top1 .panel',
    tabCont: '.cont1 .tabItem',
    cur: 'cur'
});

| 参数 | 类型 | 例子 |备注 | |-----|-----|------|------| | obj | object | { arr: ['通知公告1', '便民提示1'], topClass: 'top1', contClass: 'cont1'} | 见下一个表格 |

| key | 类型 | 例子 |备注 | |-----|-----|------|------| | arr | array | ['中央部省网站1', '中央部省网站2',...] | 指的是友情链接初始的名字 | | topClass | string | 'top1' | 指的是tab头部的class 用于js | | contClass | string | 'cont1' | 指的是tab内容部的class 用于js |

7. NewsPicCarousel (轮播)

示例

在需要应用的地方

// xxx.pug部分
include ../../../src/pug/part/NewsPicCarousel.pug

.yydh-div.swiper1(style="width: 600px; height: 400px; position: relative;")
    +NewsPicCarousel({
            length: 5,
            imgurl: 'lunbo-big.png',
            myclass: 'sw1',
            pageclass: 'pg1',
            showarrow: 'show'
        })

// 自己在pug添加所需js
var swp10 =  new Swiper('.sw1', {
    pagination: '.pg1',
    autoplay: 3000,
    speed: 1000,
    loop: true,
    grabCursor:false,
    paginationClickable: true,
    autoplayDisableOnInteraction: false
});
$('.sw1').hover(function() {
    swp10.stopAutoplay();
},function() {
    swp10.startAutoplay();
})
$('.swiper1.swiper-button-prev').on('click', function(e){
    e.preventDefault()
    swp10.swipePrev()
})
$('.swiper1 .swiper-button-next').on('click', function(e){
    e.preventDefault()
    swp10.swipeNext()
})

| 参数 | 类型 | 例子 |备注 | |-----|-----|------|------| | obj | object | { length: 5, imgurl: 'lunbo-big.png', myclass: 'sw1', pageclass: 'pg1', showarrow: 'show'} | 见下一个表格 |

| key | 类型 | 例子 |备注 | |-----|-----|------|------| | length | number | 5 | 轮播图数量 | | imgurl | string | 'lunbo-big.png' | 图片在自己项目的名字(必须在images文件夹里) | | myclass | string | 'sw1' | 自己swiper的类名,用于js | | pageclass | string | 'pg1' | 自己分页器的类名,用于js | | showarrow | string | 'show' | show为显示左右两个箭头,其他不显示 |

8. Banner (大图轮播)

示例

在需要应用的地方,至于是一排显示1个或者3个 在各自的js里修改

// xxx.pug部分
include ../../../src/pug/part/Banner.pug

.yydh-div.swiper2(style="height: 100px;width: 1200px; ")
    +Banner({imgNameArr: ['yydh-sy-banner.png','yydh-sy-banner.png', 'yydh-sy-banner.png']})
    // =====================================================
.yydh-div.swiper3(style="height: 100px;width: 1200px; ")
    +Banner({imgNameArr: ['yydh-sy-banner.png','yydh-sy-banner.png', 'yydh-sy-banner.png'],showarrow: 'show'})

// xxx.js部分
// 自己在pug添加所需js
var swp8 = new Swiper('.swiper2 .swiper-container', {
    autoplay: 2500,
    loop: true,
    speed: 1000,
    autoplayDisableOnInteraction: false
});
$('.swiper2').hover(function() {
    swp8.stopAutoplay();
},function() {
    swp8.startAutoplay();
})

// 新闻动态下面的专题轮播
var mySwiper = new Swiper('.swiper3 .swiper-container',{
    autoplay:false,
    loop: true,
    speed:500,
    grabCursor:false,
    paginationClickable: true,
    autoplayDisableOnInteraction: false,
    slidesPerView: 3,
    nextButton: '.swiper3 .swiper-button-next',
    prevButton: '.swiper3 .swiper-button-prev'
}); 
$('.swiper3').hover(function() {
    mySwiper.stopAutoplay();
},function() {
    mySwiper.startAutoplay();
})
$('.swiper3 .swiper-button-prev').on('click', function(e){
    e.preventDefault()
    mySwiper.swipePrev()
})
$('.swiper3 .swiper-button-next').on('click', function(e){
    e.preventDefault()
    mySwiper.swipeNext()
})

| 参数 | 类型 | 例子 |备注 | |-----|-----|------|------| | obj | object | {imgNameArr: ['yydh-sy-banner.png', 'yydh-sy-banner.png', 'yydh-sy-banner.png']} | 见下一个表格 |

| key | 类型 | 例子 |备注 | |-----|-----|------|------| | imgNameArr | array | ['yydh-sy-banner.png','yydh-sy-banner.png', 'yydh-sy-banner.png'] | 一般这种banner图都是不一样的因此要定制传入, 图片在自己项目的名字(必须在images文件夹里 | | showarrow | string | 'show' | show为显示左右两个箭头,其他不显示 |

版本更新

--------------- 2022-11-18-------------------

完善 readme 文档建设

--------------- 2022-11-09-------------------

项目初始化