@peng_kai/kit 0.0.3 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import { Tooltip as ATooltip } from "ant-design-vue";
3
3
  import { computed } from "vue";
4
- import dayjs from 'dayjs'
5
- import { default as relativeTime } from 'dayjs/plugin/relativeTime'
6
- import 'dayjs/locale/zh'
7
-
8
- dayjs.extend(relativeTime)
9
- dayjs.locale('zh')
4
+ import { kitDependencies } from "../../../../kitDependencies";
10
5
 
11
6
  defineOptions({
12
7
  inheritAttrs: false,
@@ -21,6 +16,8 @@ const props = withDefaults(
21
16
  template: 'MM-DD HH:mm:ss',
22
17
  },
23
18
  )
19
+ const { dayjs } = kitDependencies
20
+ console.log('💚datetime');
24
21
 
25
22
  const timestamp = computed(() => {
26
23
  let tsStr = String(props.timestamp)
@@ -39,7 +36,7 @@ const timestamp = computed(() => {
39
36
  <template>
40
37
  <ATooltip destroyTooltipOnHide>
41
38
  <template v-if="timestamp" #title>
42
- <div>{{ dayjs(timestamp).fromNow() }}</div>
39
+ <div>{{ dayjs(timestamp).fromNow?.() }}</div>
43
40
  <div>{{ dayjs(timestamp).format('YYYY-MM-DD HH:mm:ss') }}</div>
44
41
  </template>
45
42
  <span v-bind="$attrs">{{ timestamp ? dayjs(timestamp).format(props.template) : '-' }}</span>
@@ -0,0 +1,5 @@
1
+ import dayjs from "dayjs";
2
+
3
+ export const kitDependencies = {
4
+ dayjs: dayjs
5
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peng_kai/kit",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {