@ftlab/one-vue3 0.0.2 → 0.0.3

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/store/lang.ts ADDED
@@ -0,0 +1,16 @@
1
+ import { defineStore } from 'pinia';
2
+ import storage from '../utils/storage';
3
+
4
+ export default defineStore('lang', {
5
+ state: () => {
6
+ return {
7
+ language: storage.get('language') || 'cn'
8
+ };
9
+ },
10
+ actions: {
11
+ setLanguage(lang?: string) {
12
+ this.language = lang || 'cn';
13
+ storage.set('language', lang);
14
+ }
15
+ }
16
+ });
@@ -0,0 +1,4 @@
1
+ // declare type Person = {
2
+ // name: string;
3
+ // age: number;
4
+ // };
@@ -0,0 +1,27 @@
1
+ export default {
2
+ get(key: string): any {
3
+ return localStorage.getItem(key);
4
+ },
5
+ set(key: string, value: any) {
6
+ localStorage.setItem(key, value);
7
+ },
8
+ remove(key: string) {
9
+ localStorage.removeItem(key);
10
+ },
11
+ // 保存token到本地缓存
12
+ setToken(token: string) {
13
+ this.set("token", token);
14
+ },
15
+ // 保存用户信息到本地缓存
16
+ setAuth(auth: any) {
17
+ this.set("auth", JSON.stringify(auth));
18
+ },
19
+ // 读取token
20
+ getToken() {
21
+ return this.get("token");
22
+ },
23
+ // 读取用户信息
24
+ getAuth() {
25
+ return this.get("auth") ? JSON.parse(this.get("auth")) : {};
26
+ },
27
+ };
package/index.html DELETED
@@ -1,13 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <link rel="icon" href="/favicon.ico" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
- <title>FtlOne</title>
8
- </head>
9
- <body>
10
- <div id="app"></div>
11
- <script type="module" src="/src/main.ts"></script>
12
- </body>
13
- </html>
@@ -1,9 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "composite": true,
4
- "module": "ESNext",
5
- "moduleResolution": "Node",
6
- "allowSyntheticDefaultImports": true
7
- },
8
- "include": ["vite.config.ts"]
9
- }
package/vite.config.ts DELETED
@@ -1,32 +0,0 @@
1
- import { defineConfig } from "vite";
2
- import vue from "@vitejs/plugin-vue";
3
- import AutoImport from "unplugin-auto-import/vite";
4
- import path from "path";
5
-
6
- // https://vitejs.dev/config/
7
- export default defineConfig({
8
- plugins: [
9
- vue(),
10
- //自动加载依赖
11
- AutoImport({
12
- imports: ["vue", "vue-router", "pinia"],
13
- dts: "auto-import.d.ts",
14
- }),
15
- ],
16
- build: {
17
- lib: {
18
- entry: path.resolve(__dirname, "./package/index.ts"), //指定组件编译入口文件
19
- name: "ftlOne",
20
- formats: ["es", "umd", "cjs"],
21
- fileName: "ftlOne",
22
- },
23
- rollupOptions: {
24
- external: ["vue"],
25
- output: {
26
- globals: {
27
- vue: "Vue",
28
- },
29
- },
30
- },
31
- },
32
- });