Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
aa152147
五子棋
提交
5abdde73
五
五子棋
项目概览
aa152147
/
五子棋
与 Fork 源项目一致
Fork自
inscode / VueJS
通知
1
Star
43
Fork
23
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
五
五子棋
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
5abdde73
编写于
7月 30, 2023
作者:
L
lhf6623
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add: unocss
上级
5ab171ed
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
38 addition
and
67 deletion
+38
-67
.gitignore
.gitignore
+1
-0
README.md
README.md
+1
-1
package.json
package.json
+2
-0
src/App.vue
src/App.vue
+9
-9
src/assets/main.css
src/assets/main.css
+0
-44
src/components/RandomTree.vue
src/components/RandomTree.vue
+2
-12
src/main.js
src/main.js
+2
-0
uno.config.js
uno.config.js
+19
-0
vite.config.js
vite.config.js
+2
-1
未找到文件。
.gitignore
浏览文件 @
5abdde73
...
...
@@ -7,6 +7,7 @@ yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
package-lock.json
pnpm-lock.yaml
node_modules
.DS_Store
...
...
README.md
浏览文件 @
5abdde73
...
...
@@ -8,7 +8,7 @@ Vue.js 是基于 JavaScript 构建用户界面的库。该模板使用 Vite 来
## 自定义配置
请参阅
[
[Vite配置参考
](
https://vitejs.dev/config/
)
.
请参阅
[
[Vite配置参考]
]
(
https://vitejs.dev/config/
)
.
## 项目设置
...
...
package.json
浏览文件 @
5abdde73
...
...
@@ -7,11 +7,13 @@
"preview"
:
"vite preview --port 4173"
},
"dependencies"
:
{
"
@unocss/reset
"
:
"
^0.54.0
"
,
"
guess
"
:
"
^1.0.2
"
,
"
vue
"
:
"
^3.3.4
"
},
"devDependencies"
:
{
"
@vitejs/plugin-vue
"
:
"
^4.2.3
"
,
"
unocss
"
:
"
^0.54.0
"
,
"
vite
"
:
"
^4.3.9
"
}
}
src/App.vue
浏览文件 @
5abdde73
...
...
@@ -76,20 +76,20 @@ async function playChess(item, row, col) {
</
script
>
<
template
>
<div
class=
"content flex-start"
>
<p
class=
"flex-between mr-6px"
>
<label
for=
"size"
class=
"space-nowrap"
>
棋盘大小:
</label>
<div
p-6px
box-border
flex
justify-start
>
<p
mr-6px
flex
justify-between
>
<label
for=
"size"
whitespace-nowrap
>
棋盘大小:
</label>
<input
v-model=
"size"
id=
"size"
type=
"number"
>
</p>
<p
class=
"flex-between mr-6px"
>
<label
for=
"win_size"
class=
"space-nowrap"
>
胜利棋数:
</label>
<p
mr-6px
flex
justify-between
>
<label
for=
"win_size"
whitespace-nowrap
>
胜利棋数:
</label>
<input
v-model=
"win_size"
id=
"win_size"
type=
"number"
min=
"3"
max=
"8"
>
</p>
<button
@
click=
"confirm"
class=
"space-nowrap mr-6px px-6px"
>
重新开始
</button>
<button
@
click=
"back"
class=
"space-nowrap px-6px"
>
返回上一步
</button>
<button
@
click=
"confirm"
whitespace-nowrap
mr-6px
px-6px
>
重新开始
</button>
<button
@
click=
"back"
whitespace-nowrap
px-6px
>
返回上一步
</button>
</div>
<div
class=
"content border-top content-lattice
"
>
<p
class=
"row"
v-for=
"(lattice, r_i) in lattices"
:key=
"r_i"
>
<div
p-6px
box-border
flex
flex-col
items-center
border=
"t t-solid #999
"
>
<p
flex
flex-row
v-for=
"(lattice, r_i) in lattices"
:key=
"r_i"
>
<p
class=
"col"
:class=
"records_obj[`$
{r_i}_${c_i}`]" v-for="(item, c_i) in lattice" :key="`${r_i}-${c_i}`"
@click="playChess(item, r_i, c_i)">
</p>
...
...
src/assets/main.css
浏览文件 @
5abdde73
...
...
@@ -16,50 +16,10 @@ body,
font-weight
:
normal
;
}
.content
{
padding
:
6px
;
box-sizing
:
border-box
;
}
.flex-between
{
display
:
flex
;
justify-content
:
space-between
;
align-items
:
center
;
}
.flex-start
{
display
:
flex
;
justify-content
:
start
;
align-items
:
center
;
}
.mr-6px
{
margin-right
:
6px
;
}
.px-6px
{
padding-left
:
6px
;
padding-right
:
6px
;
}
input
{
width
:
60px
;
}
.border-top
{
border-top
:
1px
solid
#999
;
}
.content-lattice
{
display
:
flex
;
flex-direction
:
column
;
align-items
:
center
;
}
.row
{
display
:
flex
;
flex-direction
:
row
;
}
.col
{
width
:
20px
;
height
:
20px
;
...
...
@@ -122,8 +82,4 @@ input {
.isWin
::after
{
background-color
:
red
;
border-color
:
var
(
--p-win-border-color
);
}
.space-nowrap
{
white-space
:
nowrap
;
}
\ No newline at end of file
src/components/RandomTree.vue
浏览文件 @
5abdde73
<
template
>
<canvas
class=
"canvas"
width=
"400"
height=
"300"
ref=
"canvas"
></canvas>
<canvas
absolute
right-10px
bottom-10px
pointer-events-none
opacity-40
class=
"canvas"
width=
"400"
height=
"300"
ref=
"canvas"
></canvas>
</
template
>
<
script
setup
>
...
...
@@ -69,14 +70,3 @@ function drawBranch(ctx, v0, thick, len, dir) {
drawBranch
(
ctx
,
v1
,
thick
*
0.8
,
len
*
0.8
,
dir
-
Math
.
random
()
*
46
);
}
</
script
>
<
style
>
.canvas
{
position
:
absolute
;
right
:
10px
;
bottom
:
10px
;
pointer-events
:
none
;
opacity
:
0.4
;
}
</
style
>
\ No newline at end of file
src/main.js
浏览文件 @
5abdde73
import
{
createApp
}
from
'
vue
'
import
App
from
'
./App.vue
'
import
'
@unocss/reset/normalize.css
'
import
'
virtual:uno.css
'
import
'
./assets/main.css
'
...
...
uno.config.js
0 → 100644
浏览文件 @
5abdde73
// uno.config.js
import
{
defineConfig
,
presetAttributify
,
presetIcons
,
presetTypography
,
presetUno
,
transformerDirectives
,
transformerVariantGroup
}
from
'
unocss
'
export
default
defineConfig
({
presets
:
[
presetUno
(),
presetAttributify
(),
presetIcons
(),
presetTypography
(),
],
transformers
:
[
transformerDirectives
(),
transformerVariantGroup
(),
],
})
\ No newline at end of file
vite.config.js
浏览文件 @
5abdde73
import
{
defineConfig
}
from
'
vite
'
import
vue
from
'
@vitejs/plugin-vue
'
import
UnoCSS
from
'
unocss/vite
'
// https://vitejs.dev/config/
export
default
defineConfig
({
plugins
:
[
vue
()],
plugins
:
[
vue
()
,
UnoCSS
(),
],
server
:
{
host
:
true
},
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录