0.0.0 • Published 1 year ago

hywd-archives-date v0.0.0

Weekly downloads
-
License
-
Repository
-
Last release
1 year ago

hywd-archives-date


项目地址

hywd-archives-date

项目简介

本项目是针对档案系统研发的档案行业日期控件,在需求与设计阶段充分考虑了档案工作的实际场景与使用要求,得出一个更符合档案工作实际需要的崭新的日期填写形式,提升档案数据录入的工作效率

技术栈

本项目采用 Vue3 作为前前端基础框架进行开发,使用下一代构建工具 Vite 进行构建,在运行与启速度上奔向巨人的肩膀

集成的组件

本项目建设初衷是创建一个纯粹的日期控件,所有没有使用任何其他第三方组件(VUE 基础组件除外),希望在未来的维护中尽量保持这一原则,如果有无法解决的问题,重读一遍 Vue3 吧,相信会有不同的启示

使用方式

为了方便组件的使用,项目中对集成方式进行了测试,使用方式非常简单,代码如下:

npm 安装

npm install hywd-archives-date

局部注册

<template>
  <div>
    <DateComponentsVue v-model="dateString" ref="DateComponents"></DateComponentsVue>
  </div>
</template>
<script>
import 'hywd-archives-date/dist/style.css'
import { DateComponentsVue } from 'hywd-archives-date'
export default {
  components: {
    DateComponentsVue
  },
  data() {
    return {
      dateString: ''
    }
  }
}
</script>

全局 注册

main.js

import 'hywd-archives-date/dist/style.css'
import { DateComponentsVue } from 'hywd-archives-date'
const app = createApp(App)
app.component('DateComponentsVue', DateComponentsVue)

GlobalInstallationDate.vue

<template>
  <div>
    <DateComponentsVue v-model="dateString" ref="DateComponents"></DateComponentsVue>
  </div>
</template>
<script>
export default {
  data() {
    return {
      dateString: ''
    }
  }
}
</script>

获取多种格式的返回值

this.$refs.DateComponents.renderData()

获取数据库存储的日期格式

/**
 * 返回数据库保存的形式
 * 以时分秒代表年月日
 * 时、分、秒为 01 则代表正常日期,直接显示
 * 时、分、秒为 00 则代表非正常日期,需要转换后显示
 * 年度为 0000 的直接存储 0000
 * 月份与日期为 00 的存储为 01
 * 正常日期 2023/03/15 01:01:01
 * 年度为 0000 0000/03/15 00:01:01
 * 月份为 00 2023/01/15 01:00:01
 * 日期为 00 2023/03/01 01:01:00
 * 全部为 00 0000/01/01 00:00:00
 */
this.$refs.DateComponents.renderDatebase()

项目安装

npm install

项目运行

npm run serve

编译为网页应用

npm run build

编译为组件库

npm run dist

代码分析

npm run lint

组件发布

npm 24 小时之内只允许发布一次,如需测试可以先发布到私服

注意:发布到私服时组件名称要加上 @archser/前缀,如 @archser/hywd-archives-date ,在项目中引用时也需要使用 @archser/hywd-archives-date 来引用

发布到 npm

  • 设置发布地址 npm config set registry=https://registry.npmjs.org
  • 登录 npm,会调用浏览器并通过邮件发送一次性密码 npm login registry=https://www.npmjs.com
  • 发布版本 npm publish

遇到的问题

npm notice Beginning October 4, 2021, all connections to the npm registry - including for package installation - must use TLS 1.2 or higher.

这个问题是在已经成功发布组件之后突然出现的,按照网上的说法更新 npm : npm install -g npm 和下载 tls :npm install -g https://tls-test.npmjs.com/tls-test-1.0.0.tgz 都无效,后来安装了 enable-tls-1.3.reg 之后正常了,具体原因不清楚

0.0.0

1 year ago