Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
nemo-shen committed Dec 28, 2023
1 parent 9dae425 commit 6c4682f
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 22 deletions.
1 change: 1 addition & 0 deletions .eslintcache
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"/Users/nemo/github/vant-ui/vant-playground/src/App.vue":"1","/Users/nemo/github/vant-ui/vant-playground/src/components/Header.vue":"2","/Users/nemo/github/vant-ui/vant-playground/src/components/VersionSelect.vue":"3","/Users/nemo/github/vant-ui/vant-playground/src/env.d.ts":"4","/Users/nemo/github/vant-ui/vant-playground/src/main.ts":"5","/Users/nemo/github/vant-ui/vant-playground/src/store.ts":"6","/Users/nemo/github/vant-ui/vant-playground/src/template/App.vue":"7","/Users/nemo/github/vant-ui/vant-playground/src/template/main.vue":"8","/Users/nemo/github/vant-ui/vant-playground/src/template/vant.ts":"9","/Users/nemo/github/vant-ui/vant-playground/src/utils.ts":"10","/Users/nemo/github/vant-ui/vant-playground/vite.config.ts":"11"},{"size":2601,"mtime":1703765803719,"results":"12","hashOfConfig":"13"},{"size":6305,"mtime":1703775122356,"results":"14","hashOfConfig":"13"},{"size":2505,"mtime":1703775138932,"results":"15","hashOfConfig":"13"},{"size":38,"mtime":1703603148481,"results":"16","hashOfConfig":"13"},{"size":182,"mtime":1703774255702,"results":"17","hashOfConfig":"13"},{"size":2313,"mtime":1703775383235,"results":"18","hashOfConfig":"13"},{"size":203,"mtime":1703517827774,"results":"19","hashOfConfig":"13"},{"size":176,"mtime":1703515352143,"results":"20","hashOfConfig":"13"},{"size":567,"mtime":1703774255732,"results":"21","hashOfConfig":"13"},{"size":1378,"mtime":1703775648806,"results":"22","hashOfConfig":"13"},{"size":780,"mtime":1703774255745,"results":"23","hashOfConfig":"13"},{"filePath":"24","messages":"25","suppressedMessages":"26","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"lrjjg5",{"filePath":"27","messages":"28","suppressedMessages":"29","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"30","messages":"31","suppressedMessages":"32","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"33","messages":"34","suppressedMessages":"35","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"36","messages":"37","suppressedMessages":"38","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"39","messages":"40","suppressedMessages":"41","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"42","messages":"43","suppressedMessages":"44","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"45","messages":"46","suppressedMessages":"47","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"48","messages":"49","suppressedMessages":"50","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"51","messages":"52","suppressedMessages":"53","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"54","messages":"55","suppressedMessages":"56","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"/Users/nemo/github/vant-ui/vant-playground/src/App.vue",[],[],"/Users/nemo/github/vant-ui/vant-playground/src/components/Header.vue",[],[],"/Users/nemo/github/vant-ui/vant-playground/src/components/VersionSelect.vue",[],[],"/Users/nemo/github/vant-ui/vant-playground/src/env.d.ts",[],[],"/Users/nemo/github/vant-ui/vant-playground/src/main.ts",[],[],"/Users/nemo/github/vant-ui/vant-playground/src/store.ts",[],[],"/Users/nemo/github/vant-ui/vant-playground/src/template/App.vue",[],[],"/Users/nemo/github/vant-ui/vant-playground/src/template/main.vue",[],[],"/Users/nemo/github/vant-ui/vant-playground/src/template/vant.ts",[],[],"/Users/nemo/github/vant-ui/vant-playground/src/utils.ts",[],[],"/Users/nemo/github/vant-ui/vant-playground/vite.config.ts",[],[]]
17 changes: 5 additions & 12 deletions src/components/Header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,9 @@ import {
defineProps,
computed,
reactive,
ref,
unref,
type Ref,
inject,
isRef,
watch,
} from "vue";
import type { MaybeRef } from "@vueuse/core";
import { useDark, useFetch, useToggle, usePreferredDark } from "@vueuse/core";
Expand All @@ -27,18 +24,14 @@ const store = inject("store") as ReplStore;
const onChangeVersion = (key: keyof typeof versions, version: string) => {
versions[key].active = version;
let importMap;
switch (key) {
case "vue":
store.setVueVersion(version);
break;
case "vant":
const dep = {
version: version,
path: "/es/index.mjs",
};
const importMap = store.getImportMap();
importMap.imports[key] = genCdnLink(key, dep.version, dep.path);
importMap = store.getImportMap();
importMap.imports[key] = genCdnLink(key, version, '/es/index.mjs');
importMap.imports["vant/lib/index.css"] = genCdnLink(
"vant",
version,
Expand Down Expand Up @@ -108,7 +101,7 @@ if (isDark.value !== dark.value) {
}
const props = defineProps<{
lang: String;
lang: string;
config: {
logo: string;
title: string;
Expand Down Expand Up @@ -136,7 +129,7 @@ const anotherLang: any = computed(() => {
return {};
});
const langLabel = computed(() => anotherLang.label);
const langLabel = computed(() => anotherLang.value.label);
const themeImg = computed(() => {
if (dark.value) {
Expand Down
6 changes: 1 addition & 5 deletions src/components/VersionSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,10 @@ import {
defineProps,
defineEmits,
type Ref,
type MaybeRef,
watch,
toRefs,
isRef,
} from "vue";
const emit = defineEmits(["update:modelValue"]);
const showVersionPop = ref(false);
const props = defineProps<{
defineProps<{
modelValue: string;
options: Ref<string[]>;
label: string;
Expand Down
8 changes: 4 additions & 4 deletions src/store.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
// custom repl's store
import { File, ReplStore, type StoreOptions, type StoreState } from '@vue/repl';
import { File, ReplStore, type StoreOptions } from '@vue/repl';
import { utoa, genCdnLink } from './utils';

import welcomeCode2 from './template/App.vue?raw';
import welcomeCode from './template/App.vue?raw';
import mainCode from './template/main.vue?raw';
import vantCode from './template/vant.ts?raw';
import tsconfigCode from './template/tsconfig.json?raw';
import { computed, reactive, shallowRef } from 'vue';

interface Dependency {
pkg?: string;
Expand Down Expand Up @@ -89,6 +87,8 @@ class VantReplStore extends ReplStore {
}
}
const store = new VantReplStore({
serializedState: !!userFiles ? userFiles : utoa(JSON.stringify(_files)),
serializedState: userFiles
? userFiles
: utoa(JSON.stringify(_files)),
});
export default store;
2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { zlibSync, unzlibSync, strToU8, strFromU8 } from 'fflate';

export function debounce(fn: Function, n = 100) {
export function debounce(fn: (...args: any[]) => void, n = 100) {
let handle: any;
return (...args: any[]) => {
if (handle) clearTimeout(handle);
Expand Down

0 comments on commit 6c4682f

Please sign in to comment.