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

date-picker-week-range

v1.3.0

Published

A date picker (week-range) based on Elements-Plus

Downloads

8

Readme

week-range-demo

A date picker (week-range) based on Elements-Plus

基于element-plus的周范围日期选择器 week-range

github:week-range-date-picker

(如果您觉得好用的话可以给我1颗star:star:,谢谢^-^)

在线预览(online demo):week-range-demo

使用说明 NPM Install&Use:

:sparkles:注意 Notice:sparkles:

Make sure you have installed element-plus before using this plugin.

Elements-plus officially provides a day-range selector and a month-range selector, but not a week-range selector, so this plugin was developed.

本插件基于element-plus开发,使用前需要确保已经安装element-plus依赖!

element-plus官方提供了日范围选择器和月范围选择器,没有提供周范围的选择器,于是开发了本插件。

:sparkles:Element-plus官方文档:sparkles::

https://element-plus.org/zh-CN/

https://element-plus.gitee.io/zh-CN/component/date-picker.html#%E9%80%89%E6%8B%A9%E4%B8%80%E6%AE%B5%E6%97%B6%E9%97%B4

:sparkles:如何使用 How to use:sparkles::

npm i date-picker-week-range

:point_left:全局注册 Global Registration

:point_down:main.js:
import { createApp } from 'vue'
import ElementPlus from 'element-plus'  //引入插件
import 'element-plus/theme-chalk/index.css' //默认css样式
import zhCn from 'element-plus/es/locale/lang/zh-cn'   //引入中文包,如果你需要的话
import App from './App.vue'

import weekRange from 'date-picker-week-range'

createApp(App).use(ElementPlus).use(weekRange).mount('#app')
:point_down:App.vue:

通过< week-range >使用,通过v-model绑定周选择器选取的值

分隔符,两个日历选择器的默认显示文字以及shortcuts等都可以自定义传入。

used by < week-range >, and don't forget to use v-model to bind the values

注意:必须引入样式:@import 'date-picker-week-range/style.css'

NOTICE: you need to import the css file: @import 'date-picker-week-range/style.css

<template>
  <div>
    <week-range
      v-model="value"
      unlink-panels
      format="YYYY [Week] ww"
      range-separator="-"
      start-placeholder="Choose Start Week"
      end-placeholder="Choose End Week"
      :shortcuts="shortcuts"
    >
    </week-range>
    {{ value.toString() }}
  </div>
</template>
 
<script>
import { ref } from "vue";

export default {

  setup() {
    const value = ref("");

    const shortcuts = [
      {
        text: "Last week",
        value: () => {
          const end = new Date();
          const start = new Date();

          return [start, end];
        },
      },
      {
        text: "Last 3 weeks",
        value: () => {
          const end = new Date();
          const start = new Date();
          start.setTime(start.getTime() - 3600 * 1000 * 24 * 7 * 2);
          return [start, end];
        },
      },
      {
        text: "Last 6 weeks",
        value: () => {
          const end = new Date();
          const start = new Date();
          start.setTime(start.getTime() - 3600 * 1000 * 24 * 7 * 5);
          return [start, end];
        },
      },
    ];

    return {
      value,
      shortcuts,
    };
  },
};
</script>
 
<style>
@import "date-picker-week-range/style.css";
</style>

:point_left:局部注册 Local Registration

组件内import{WeekRange}注册为组件使用

Local Registration: import { WeekRange } as a component

<template>
  <week-range
    v-model="value"
    unlink-panels
    format="YYYY [Week] ww"
    range-separator="-"
    start-placeholder="Choose Start Week"
    end-placeholder="Choose End Week"
  >
  </week-range>
</template>

<script>
import { WeekRange } from "date-picker-week-range";
import { ref } from "vue";
export default {
  components: {
    WeekRange,
  },
  setup() {
    const value = ref("");

    return {
      value,
    };
  },
};
</script>

<style>
@import "date-picker-week-range/style.css";
</style>