Skip to content
This repository was archived by the owner on Oct 17, 2023. It is now read-only.

Commit 4b7a1fd

Browse files
authored
Merge pull request #5 from Cksheuen/main
nia
2 parents 256c5c3 + 9040d24 commit 4b7a1fd

22 files changed

+1898
-0
lines changed

cksheuen/.gitignore

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
.DS_Store
12+
dist
13+
dist-ssr
14+
coverage
15+
*.local
16+
17+
/cypress/videos/
18+
/cypress/screenshots/
19+
20+
# Editor directories and files
21+
.vscode/*
22+
!.vscode/extensions.json
23+
.idea
24+
*.suo
25+
*.ntvs*
26+
*.njsproj
27+
*.sln
28+
*.sw?

cksheuen/.vscode/extensions.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"recommendations": ["Vue.volar", "Vue.vscode-typescript-vue-plugin"]
3+
}

cksheuen/README.md

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# test
2+
3+
This template should help get you started developing with Vue 3 in Vite.
4+
5+
## Recommended IDE Setup
6+
7+
[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin).
8+
9+
## Type Support for `.vue` Imports in TS
10+
11+
TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin) to make the TypeScript language service aware of `.vue` types.
12+
13+
If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a [Take Over Mode](https://github.com/johnsoncodehk/volar/discussions/471#discussioncomment-1361669) that is more performant. You can enable it by the following steps:
14+
15+
1. Disable the built-in TypeScript Extension
16+
1) Run `Extensions: Show Built-in Extensions` from VSCode's command palette
17+
2) Find `TypeScript and JavaScript Language Features`, right click and select `Disable (Workspace)`
18+
2. Reload the VSCode window by running `Developer: Reload Window` from the command palette.
19+
20+
## Customize configuration
21+
22+
See [Vite Configuration Reference](https://vitejs.dev/config/).
23+
24+
## Project Setup
25+
26+
```sh
27+
yarn
28+
```
29+
30+
### Compile and Hot-Reload for Development
31+
32+
```sh
33+
yarn dev
34+
```
35+
36+
### Type-Check, Compile and Minify for Production
37+
38+
```sh
39+
yarn build
40+
```

cksheuen/auto-imports.d.ts

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/* eslint-disable */
2+
/* prettier-ignore */
3+
// @ts-nocheck
4+
// noinspection JSUnusedGlobalSymbols
5+
// Generated by unplugin-auto-import
6+
export {}
7+
declare global {
8+
9+
}

cksheuen/components.d.ts

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/* eslint-disable */
2+
/* prettier-ignore */
3+
// @ts-nocheck
4+
// Generated by unplugin-vue-components
5+
// Read more: https://github.com/vuejs/core/pull/3399
6+
export {}
7+
8+
declare module 'vue' {
9+
export interface GlobalComponents {
10+
DeleteBut: typeof import('./src/components/DeleteBut.vue')['default']
11+
Detail: typeof import('./src/components/Detail.vue')['default']
12+
ElButton: typeof import('element-plus/es')['ElButton']
13+
ElDescriptions: typeof import('element-plus/es')['ElDescriptions']
14+
ElDescriptionsItem: typeof import('element-plus/es')['ElDescriptionsItem']
15+
ElInput: typeof import('element-plus/es')['ElInput']
16+
ElPagination: typeof import('element-plus/es')['ElPagination']
17+
ElPopconfirm: typeof import('element-plus/es')['ElPopconfirm']
18+
ElTable: typeof import('element-plus/es')['ElTable']
19+
ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
20+
RouterLink: typeof import('vue-router')['RouterLink']
21+
RouterView: typeof import('vue-router')['RouterView']
22+
Table: typeof import('./src/components/Table.vue')['default']
23+
}
24+
}

cksheuen/env.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/// <reference types="vite/client" />

cksheuen/index.html

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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>Vite App</title>
8+
</head>
9+
<body>
10+
<div id="app"></div>
11+
<script type="module" src="/src/main.ts"></script>
12+
</body>
13+
</html>

cksheuen/package.json

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"name": "test",
3+
"version": "0.0.0",
4+
"private": true,
5+
"scripts": {
6+
"dev": "vite",
7+
"build": "run-p type-check \"build-only {@}\" --",
8+
"preview": "vite preview",
9+
"build-only": "vite build",
10+
"type-check": "vue-tsc --noEmit -p tsconfig.app.json --composite false"
11+
},
12+
"dependencies": {
13+
"element": "^0.1.4",
14+
"element-plus": "^2.3.14",
15+
"less": "^4.2.0",
16+
"pinia": "^2.1.6",
17+
"vue": "^3.3.4"
18+
},
19+
"devDependencies": {
20+
"@tsconfig/node18": "^18.2.2",
21+
"@types/node": "^18.17.17",
22+
"@vitejs/plugin-vue": "^4.3.4",
23+
"@vue/tsconfig": "^0.4.0",
24+
"npm-run-all2": "^6.0.6",
25+
"typescript": "~5.2.0",
26+
"unplugin-vue-components": "^0.25.2",
27+
"vite": "^4.4.9",
28+
"vue-tsc": "^1.8.11"
29+
}
30+
}

cksheuen/public/favicon.ico

4.19 KB
Binary file not shown.

cksheuen/src/App.vue

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<template>
2+
<div class="body">
3+
<div class="title">title</div>
4+
<Table></Table>
5+
<Detail></Detail>
6+
</div>
7+
</template>
8+
9+
<script lang="ts" setup>
10+
import Table from '@/components/Table.vue';
11+
import Detail from '@/components/Detail.vue';
12+
</script>
13+
14+
15+
16+
<style scoped lang='less'>
17+
.title {
18+
position: absolute;
19+
top: 10px;
20+
left: 50%;
21+
transform: (-50%);
22+
}
23+
</style>
24+
<style>
25+
* {
26+
padding: 0;
27+
margin: 0;
28+
}
29+
30+
html,
31+
body,
32+
#app {
33+
height: 100vh;
34+
background-color: rgb(245, 245, 245);
35+
}
36+
</style>

cksheuen/src/assets/logo.svg

+1
Loading

cksheuen/src/components/DeleteBut.vue

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<template>
2+
<el-popconfirm confirm-button-text="Yes" cancel-button-text="No" icon-color="#626AEF"
3+
title="Are you sure to delete this?" @confirm="delItem(props.index)">
4+
<template #reference>
5+
<el-button>Delete</el-button>
6+
</template>
7+
</el-popconfirm>
8+
</template>
9+
10+
<script setup lang="ts">
11+
import { useControlData } from '@/stores/useControlData';
12+
const controlData = useControlData()
13+
14+
const props = defineProps<{
15+
index: number
16+
}>()
17+
18+
const delItem = (index: number) => {
19+
controlData.delItem(index)
20+
}
21+
22+
</script>

cksheuen/src/components/Detail.vue

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<template>
2+
<el-drawer v-model="controlData.detailState" :show-close="false" direction="btt" size="75vh"
3+
:before-close="handleClose">
4+
<el-descriptions class="margin-top" title="Details" :column="3" border>
5+
<template #extra>
6+
<el-button v-if="controlData.editState" @click="saveNewVal">Confirm</el-button>
7+
<el-button type="primary" @click="changeEditState">Edit</el-button>
8+
</template>
9+
<el-descriptions-item v-for="item in controlData.dataKeyName">
10+
<template #label v-if="item != 'thumbnail'">
11+
<div class="cell-item">
12+
{{ item }}
13+
</div>
14+
</template><!-- v-model="controlData.data[controlData.detaiIndex]![item]" -->
15+
<el-input id="newVal" :v-model="getVal(controlData.detaiIndex, item)"
16+
v-if="controlData.editState && item != 'images' && item != 'thumbnail'" />
17+
18+
<div class="content" v-if="item != 'images' && item != 'thumbnail' && !controlData.editState">
19+
{{ getVal(controlData.detaiIndex, item) }}
20+
</div>
21+
<img v-else-if="item != 'thumbnail' && !controlData.editState"
22+
:src="(getVal(controlData.detaiIndex, item) as string[])[0]"
23+
:alt="(getVal(controlData.detaiIndex, 'title') as string)">
24+
</el-descriptions-item>
25+
</el-descriptions>
26+
</el-drawer>
27+
</template>
28+
29+
<script setup lang="ts">
30+
import { ElButton, ElDrawer } from 'element-plus'
31+
import { useControlData } from '@/stores/useControlData';
32+
33+
const controlData = useControlData()
34+
const handleClose = () => {
35+
controlData.close()
36+
controlData.checkState(false)
37+
}
38+
39+
const changeEditState = () => {
40+
controlData.checkState(!controlData.editState)
41+
}
42+
43+
const saveNewVal = () => {
44+
let domArr = document.querySelectorAll('#newVal')
45+
for (let i = 0; i < domArr.length; i++)
46+
controlData.editItem(i, (domArr[i] as HTMLInputElement).value)
47+
48+
changeEditState()
49+
}
50+
51+
const getVal = (index: number, item: string): number | string | string[] => {
52+
53+
return controlData.data && controlData.data[index] ? controlData.data[index]![item] : '---'
54+
}
55+
</script>
56+
57+
<style scoped lang="less">
58+
.cell-item {
59+
display: flex;
60+
align-items: center;
61+
}
62+
63+
.margin-top {
64+
margin-top: 20px;
65+
}
66+
</style>
67+

0 commit comments

Comments
 (0)