vue-bigscreen-temp 1.0.0

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.
package/README.md ADDED
File without changes
Binary file
@@ -0,0 +1,41 @@
1
+ import { defineComponent as m, ref as a, resolveComponent as u, createBlock as p, openBlock as f, mergeProps as d, withCtx as _, renderSlot as k } from "vue";
2
+ const C = {
3
+ name: "JButton"
4
+ }, w = /* @__PURE__ */ m({
5
+ ...C,
6
+ props: {
7
+ time: {
8
+ type: Number,
9
+ default: 1e3
10
+ }
11
+ },
12
+ emits: ["click"],
13
+ setup(e, { emit: t }) {
14
+ const c = e, l = t, o = a(0), r = () => {
15
+ (/* @__PURE__ */ new Date()).getTime() - o.value > c.time && l("click"), o.value = (/* @__PURE__ */ new Date()).getTime();
16
+ };
17
+ return (n, b) => {
18
+ const i = u("el-button");
19
+ return f(), p(i, d(n.$attrs, { onClick: r }), {
20
+ default: _(() => [
21
+ k(n.$slots, "default")
22
+ ]),
23
+ _: 3
24
+ }, 16);
25
+ };
26
+ }
27
+ }), s = {
28
+ JButton: w
29
+ }, B = (e) => {
30
+ for (const t in s)
31
+ e.component(t, s[t]);
32
+ }, T = (e, t) => {
33
+ B(e);
34
+ }, h = {
35
+ // 导出的对象必须具有 install,才能被 Vue.use() 方法安装
36
+ install: T
37
+ };
38
+ export {
39
+ w as JButton,
40
+ h as default
41
+ };
@@ -0,0 +1 @@
1
+ (function(t,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(t=typeof globalThis<"u"?globalThis:t||self,e(t.VueBigScreenTemp={},t.Vue))})(this,(function(t,e){"use strict";const r={name:"JButton"},s=e.defineComponent({...r,props:{time:{type:Number,default:1e3}},emits:["click"],setup(n,{emit:o}){const d=n,f=o,l=e.ref(0),p=()=>{new Date().getTime()-l.value>d.time&&f("click"),l.value=new Date().getTime()};return(i,T)=>{const a=e.resolveComponent("el-button");return e.openBlock(),e.createBlock(a,e.mergeProps(i.$attrs,{onClick:p}),{default:e.withCtx(()=>[e.renderSlot(i.$slots,"default")]),_:3},16)}}}),c={JButton:s},u=n=>{for(const o in c)n.component(o,c[o])},m={install:(n,o)=>{u(n)}};t.JButton=s,t.default=m,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
package/package.json ADDED
@@ -0,0 +1,69 @@
1
+ {
2
+ "name": "vue-bigscreen-temp",
3
+ "version": "1.0.0",
4
+ "private": false,
5
+ "type": "module",
6
+ "main": "dist/vue-bigscreen-temp.umd.js",
7
+ "module": "dist/vue-bigscreen-temp.es.js",
8
+ "types": "dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "import": "./dist/vue-bigscreen-temp.es.js",
12
+ "require": "./dist/vue-bigscreen-temp.umd.js"
13
+ },
14
+ "./style.css": "./dist/style.css"
15
+ },
16
+ "files": [
17
+ "dist",
18
+ "packages"
19
+ ],
20
+ "engines": {
21
+ "node": "^20.19.0 || >=22.12.0"
22
+ },
23
+ "scripts": {
24
+ "lib": "vite build",
25
+ "deploy": "deploy.sh",
26
+ "dev": "vite",
27
+ "build": "run-p type-check \"build-only {@}\" --",
28
+ "preview": "vite preview",
29
+ "build-only": "vite build",
30
+ "type-check": "vue-tsc --build",
31
+ "lint:oxlint": "oxlint . --fix -D correctness --ignore-path .gitignore",
32
+ "lint:eslint": "eslint . --fix --cache",
33
+ "lint": "run-s lint:*",
34
+ "format": "prettier --write --experimental-cli src/"
35
+ },
36
+ "dependencies": {
37
+ "autofit.js": "^3.2.8",
38
+ "axios": "^1.13.2",
39
+ "element-plus": "^2.13.1",
40
+ "pinia": "^3.0.4",
41
+ "postcss-px-to-viewport": "^1.1.1",
42
+ "vue": "^3.5.25",
43
+ "vue-router": "^4.6.3"
44
+ },
45
+ "devDependencies": {
46
+ "@vitejs/plugin-vue": "^3.2.0",
47
+ "@vitejs/plugin-vue-jsx": "^2.0.1",
48
+ "vite-plugin-compression": "^0.5.1",
49
+ "vite-plugin-dts": "^1.7.3",
50
+ "vite-plugin-vue-setup-extend": "^0.4.0",
51
+ "@prettier/plugin-oxc": "^0.0.5",
52
+ "@tsconfig/node24": "^24.0.3",
53
+ "@types/node": "^24.10.1",
54
+ "@vue/eslint-config-prettier": "^10.2.0",
55
+ "@vue/tsconfig": "^0.8.1",
56
+ "eslint": "^9.39.1",
57
+ "eslint-plugin-oxlint": "~1.29.0",
58
+ "eslint-plugin-vue": "~10.5.1",
59
+ "jiti": "^2.6.1",
60
+ "npm-run-all2": "^8.0.4",
61
+ "oxlint": "~1.29.0",
62
+ "prettier": "3.6.2",
63
+ "sass": "^1.97.1",
64
+ "typescript": "~5.9.0",
65
+ "vite": "^7.2.4",
66
+ "vite-plugin-vue-devtools": "^8.0.5",
67
+ "vue-tsc": "^3.1.5"
68
+ }
69
+ }
@@ -0,0 +1,33 @@
1
+ import type { Component, App } from 'vue'
2
+ // import ElementPlus from 'element-plus'
3
+ // import 'element-plus/dist/index.css'
4
+ // import locale from 'element-plus/lib/locale/lang/zh-cn' // 因element-plus默认是英文,我们指定一下默认中文
5
+ import JButton from './j-button/src/index.vue'
6
+
7
+ // 存储组件列表
8
+ const components: {
9
+ [propName: string]: Component
10
+ } = {
11
+ JButton,
12
+ }
13
+ // 插件声明:声明所有插件
14
+ // 插件注册:在 Vue 项目的入口文件中,通过 ( app.use(插件) ) 进行注册
15
+ const installComponents: any = (app: App) => {
16
+ for (const key in components) {
17
+ app.component(key, components[key])
18
+ }
19
+ }
20
+ // vue插件
21
+ // - install:每个插件都有一个 install 方法
22
+ // - 参数:是通过 Vue.createApp() 创建的 app 实例
23
+ const install: any = (app: any, router?: any) => {
24
+ // !router && installRouter(app);
25
+ installComponents(app)
26
+ }
27
+
28
+ // 按需引入
29
+ export { JButton }
30
+ export default {
31
+ // 导出的对象必须具有 install,才能被 Vue.use() 方法安装
32
+ install,
33
+ }
@@ -0,0 +1,5 @@
1
+ import Button from './src/index.vue'
2
+ import { withInstall } from '../withInstall'
3
+
4
+ const JButton = withInstall(Button)
5
+ export default JButton
@@ -0,0 +1,29 @@
1
+ <template>
2
+ <el-button v-bind="$attrs" @click="handleClick">
3
+ <slot />
4
+ </el-button>
5
+ </template>
6
+ <script lang="ts">
7
+ export default {
8
+ name: 'JButton',
9
+ }
10
+ </script>
11
+ <script setup lang="ts">
12
+ import { ref } from 'vue'
13
+ const props = defineProps({
14
+ time: {
15
+ type: Number,
16
+ default: 1000,
17
+ },
18
+ })
19
+ // 抛出事件
20
+ const emits = defineEmits(['click'])
21
+ const record = ref(0)
22
+ const handleClick = () => {
23
+ const newTime = new Date()
24
+ if (newTime.getTime() - record.value > props.time) {
25
+ emits('click')
26
+ }
27
+ record.value = new Date().getTime()
28
+ }
29
+ </script>
@@ -0,0 +1,21 @@
1
+ import { App, Plugin } from 'vue'
2
+
3
+ type SFCWithInstall<T> = T & Plugin
4
+
5
+ export const withInstall = <T, E extends Record<string, any>>(
6
+ main: T,
7
+ extra?: E
8
+ ) => {
9
+ ;(main as SFCWithInstall<T>).install = (app: App) => {
10
+ for (const comp of [main, ...Object.values(extra ?? {})]) {
11
+ app.component(comp.name, comp)
12
+ }
13
+ }
14
+ if (extra) {
15
+ for (const [compName, comp] of Object.entries(extra)) {
16
+ ;(main as Record<string, any>)[compName] = comp
17
+ }
18
+ }
19
+ // 将 T 断言为具体的类型 T & plugin & Record<string, any>
20
+ return main as SFCWithInstall<T> & E
21
+ }