-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
chizuki
committed
Feb 9, 2023
1 parent
5be8c20
commit 5367af8
Showing
11 changed files
with
1,035 additions
and
510 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,37 @@ | ||
{ | ||
"name": "playground", | ||
"private": true, | ||
"version": "0.0.1", | ||
"description": "", | ||
"dependencies": { | ||
"hoci":"workspace:*", | ||
"axios": "^0.27.2", | ||
"dayjs": "^1.11.4", | ||
"element-plus": "^2.2.18", | ||
"jquery": "^3.6.0", | ||
"query-string": "^7.1.1", | ||
"vue": "^3.2.31", | ||
"vue-router": "^4.1.2" | ||
}, | ||
"devDependencies": { | ||
"@types/jquery": "^3.5.14", | ||
"@vitejs/plugin-vue": "^3.0.1", | ||
"@vitejs/plugin-vue-jsx": "^2.0.0", | ||
"compression": "^1.7.4", | ||
"rollup-plugin-visualizer": "^5.8.3", | ||
"sass": "^1.55.0", | ||
"typescript": "^4.8.4", | ||
"unplugin-vue-components": "^0.22.8", | ||
"vite": "^3.1.8", | ||
"vite-plugin-inspect": "^0.6.0", | ||
"vite-plugin-windicss": "^1.8.7", | ||
"windicss": "^3.5.6" | ||
}, | ||
"scripts": { | ||
"dev": "vite", | ||
"preview": "vite preview", | ||
"build": "vite build" | ||
}, | ||
"author": "chizuki", | ||
"license": "MIT" | ||
"name": "playground", | ||
"private": true, | ||
"version": "0.0.1", | ||
"description": "", | ||
"dependencies": { | ||
"axios": "^0.27.2", | ||
"dayjs": "^1.11.4", | ||
"element-plus": "^2.2.18", | ||
"hoci": "workspace:*", | ||
"jquery": "^3.6.0", | ||
"query-string": "^7.1.1", | ||
"vue": "^3.2.31", | ||
"vue-router": "^4.1.2" | ||
}, | ||
"devDependencies": { | ||
"@types/jquery": "^3.5.14", | ||
"@vitejs/plugin-vue": "^4.0.0", | ||
"@vitejs/plugin-vue-jsx": "^3.0.0", | ||
"compression": "^1.7.4", | ||
"rollup-plugin-visualizer": "^5.8.3", | ||
"sass": "^1.55.0", | ||
"typescript": "^4.8.4", | ||
"unplugin-vue-components": "^0.22.8", | ||
"vite": "^4.1.1", | ||
"vite-plugin-inspect": "^0.7.15", | ||
"vite-plugin-windicss": "^1.8.10", | ||
"windicss": "^3.5.6" | ||
}, | ||
"scripts": { | ||
"dev": "vite", | ||
"preview": "vite preview", | ||
"build": "vite build" | ||
}, | ||
"author": "chizuki", | ||
"license": "MIT" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,58 @@ | ||
<script lang="tsx"> | ||
import { defineComponent, ref } from "vue"; | ||
import { HiItem, HiSelection, HiSwitch } from "hoci"; | ||
import { defineComponent, reactive, ref } from "vue"; | ||
import { HiItem, HiSelection, HiSwitch } from "hoci"; | ||
export default defineComponent(() => { | ||
const selectedIndex = ref(2); | ||
const logs = ref<string[]>([]); | ||
export default defineComponent(() => { | ||
const selectedIndex = ref(2); | ||
const logs = ref<string[]>([]); | ||
function log(...args: any[]) { | ||
logs.value.push(args.map(r => { | ||
if (typeof r === "object") { | ||
return JSON.stringify(r); | ||
} | ||
return r; | ||
}).join(" ")); | ||
const selectionState = reactive({ | ||
multiple: false, | ||
clearable: false | ||
}) | ||
// eslint-disable-next-line no-console | ||
console.log(...args); | ||
} | ||
function log(...args: any[]) { | ||
logs.value.push(args.map(r => { | ||
if (typeof r === "object") { | ||
return JSON.stringify(r); | ||
} | ||
return r; | ||
}).join(" ")); | ||
function handleChange(index: number) { | ||
log("change", JSON.stringify(index)); | ||
selectedIndex.value = index; | ||
} | ||
// eslint-disable-next-line no-console | ||
console.log(...args); | ||
} | ||
const isChecked = ref(true); | ||
return () => { | ||
return <div class="w-full p-4"> | ||
<HiSelection activateEvent="click" onChange={handleChange} v-model={selectedIndex.value} tag="div" itemClass="cursor-pointer px-2 py-1" class="flex space-x-4 items-center" activeClass="text-white bg-hex-f00"> | ||
<HiItem value={1}>Item 1</HiItem> | ||
<HiItem value={2}>Item 2</HiItem> | ||
<HiItem value={3}>Item 3</HiItem> | ||
</HiSelection> | ||
<HiSwitch v-model={isChecked.value} class="mt-4 select-none" activeClass="text-hex-f00">Switch</HiSwitch> | ||
<div>当前选择:{selectedIndex.value}</div> | ||
<div class="mt-4"></div> | ||
<div>Console:</div> | ||
<div class="mt-2"> | ||
{logs.value.map((log, index) => <div key={index}>{log}</div>)} | ||
</div> | ||
</div>; | ||
}; | ||
}); | ||
function handleChange(index: number) { | ||
log("change", JSON.stringify(index)); | ||
selectedIndex.value = index; | ||
} | ||
function clearLog() { | ||
logs.value.length =0; | ||
} | ||
return () => { | ||
return <div class="w-full p-4"> | ||
<HiSelection {...selectionState} activateEvent="click" onChange={handleChange} v-model={selectedIndex.value} tag="div" itemClass="duration-300 cursor-pointer px-2 py-1" class="flex space-x-4 items-center" activeClass="text-white bg-hex-f00"> | ||
<HiItem value={1}>Item 1</HiItem> | ||
<HiItem value={2}>Item 2</HiItem> | ||
<HiItem value={3}>Item 3</HiItem> | ||
</HiSelection> | ||
<div class="flex space-x-4 items-center"> | ||
<HiSwitch tag="span" v-model={selectionState.multiple} class="cursor-pointer mt-4 duration-200 select-none" activeClass="text-hex-f00">Multiple</HiSwitch> | ||
<HiSwitch tag="span" v-model={selectionState.clearable} class="cursor-pointer mt-4 duration-200 select-none" activeClass="text-hex-f00">Clearable</HiSwitch> | ||
</div> | ||
<div>Selected:{selectedIndex.value}</div> | ||
<div class="mt-4"></div> | ||
<div class="flex justify-between items-center"> | ||
<div>Console: </div> | ||
<button onClick={clearLog} class="border-solid border-1 border-gray-50">Clear</button> | ||
</div> | ||
<div class="bg-gray-500 h-100 mt-2 text-white px-4 overflow-y-auto"> | ||
{logs.value.map((log, index) => <div class="h-5 leading-5" key={index}>{log}</div>)} | ||
</div> | ||
</div>; | ||
}; | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.