Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
kadycui
game-admin
提交
b0e07d82
game-admin
项目概览
kadycui
/
game-admin
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
game-admin
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
b0e07d82
编写于
9月 20, 2023
作者:
kadycui
💻
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ADD: 搜索组件拆分
上级
1a0876ac
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
50 addition
and
27 deletion
+50
-27
src/components/Search.vue
src/components/Search.vue
+35
-0
src/pages/goods/list.vue
src/pages/goods/list.vue
+15
-27
未找到文件。
src/components/Search.vue
0 → 100644
浏览文件 @
b0e07d82
<
template
>
<el-form
:model=
"searchForm"
label-width=
"80px"
class=
"mb-3"
size=
"small"
>
<el-row
:gutter=
"20"
>
<slot/>
<template
v-if=
"showSearch"
>
<slot
name=
"show"
/>
</
template
>
<el-col
:span=
"8"
:offset=
"showSearch ? 0 : 8"
>
<div
class=
"flex items-center justify-end"
>
<el-button
type=
"primary"
@
click=
"$emit('search')"
>
搜索
</el-button>
<el-button
@
click=
"$emit('reset')"
>
重置
</el-button>
<el-button
type=
"primary"
text
@
click=
" showSearch = !showSearch"
>
{{ showSearch ? '收起' : '展开' }}
<el-icon>
<ArrowUp
v-if=
"showSearch"
/>
<ArrowDown
v-else
/>
</el-icon>
</el-button>
</div>
</el-col>
</el-row>
</el-form>
</template>
<
script
setup
>
import
{
ref
}
from
'
vue
'
const
showSearch
=
ref
(
false
)
defineEmits
(
"
search
"
,
"
reset
"
)
</
script
>
\ No newline at end of file
src/pages/goods/list.vue
浏览文件 @
b0e07d82
...
...
@@ -6,14 +6,15 @@
</el-tab-pane>
</el-tabs>
<el-card
shadow=
"never"
class=
"border-0"
>
<el-form
:model=
"searchForm"
label-width=
"80px"
class=
"mb-3"
size=
"small"
>
<el-row
:gutter=
"20"
>
<!-- 搜索 -->
<Search
@
search=
"getData"
@
reset=
"resetSearchForm"
>
<el-col
:span=
"8"
:offset=
"0"
>
<el-form-item
label=
"关键词"
>
<el-input
v-model=
"searchForm.title"
placeholder=
"商品名称"
clearable
></el-input>
</el-form-item>
</el-col>
<template
#show
>
<el-col
:span=
"8"
:offset=
"0"
>
<el-form-item
label=
"商品名称"
>
<el-input
v-model=
"searchForm.title"
placeholder=
"商品名称"
clearable
></el-input>
</el-form-item>
</el-col>
<el-col
:span=
"8"
:offset=
"0"
v-if=
"showSearch"
>
<el-form-item
label=
"商品分类"
prop=
"category_id"
>
<el-select
v-model=
"searchForm.category_id"
placeholder=
"请选择商品分类"
clearable
>
<el-option
v-for=
"item in category_list"
...
...
@@ -24,23 +25,9 @@
</el-select>
</el-form-item>
</el-col>
<el-col
:span=
"8"
:offset=
"showSearch ? 0 : 8"
>
<div
class=
"flex items-center justify-end"
>
<el-button
type=
"primary"
@
click=
"getData"
>
搜索
</el-button>
<el-button
@
click=
"resetSearchForm"
>
重置
</el-button>
<el-button
type=
"primary"
text
@
click=
" showSearch = !showSearch"
>
{{
showSearch
?
'
收起
'
:
'
展开
'
}}
<el-icon>
<ArrowUp
v-if=
"showSearch"
/>
<ArrowDown
v-else
/>
</el-icon>
</el-button>
</div>
</el-col>
</el-row>
</el-form>
</
template
>
</Search>
<!-- 新增 | 刷新 -->
<ListHeader
@
create=
"handleCreate"
@
refresh=
"getData"
/>
...
...
@@ -84,7 +71,7 @@
</
template
>
</el-table-column>
<el-table-column
label=
"总库存"
width=
"90"
prop=
"stock"
align=
"center"
/>
<el-table-column
label=
"操作"
align=
"center"
>
<el-table-column
label=
"操作"
align=
"center"
>
<
template
#default=
"scope"
>
<div
v-if=
"searchForm.tab != 'delete'"
>
<el-button
class=
"px-1"
type=
"primary"
size=
"small"
text
>
修改
</el-button>
...
...
@@ -158,6 +145,7 @@ import {
import
FormDrawer
from
"
@/components/FormDrawer.vue
"
import
ListHeader
from
"
@/components/ListHeader.vue
"
import
ChooseImage
from
"
@/components/ChooseImage.vue
"
import
Search
from
"
@/components/Search.vue
"
import
{
useInitTable
,
useInitForm
}
from
"
@/composables/useCommon.js
"
...
...
@@ -244,8 +232,8 @@ const tabbars = [{
// 商品分类
const
category_list
=
ref
([])
getCategoryList
().
then
(
res
=>
category_list
.
value
=
res
)
getCategoryList
().
then
(
res
=>
category_list
.
value
=
res
)
const
showSearch
=
ref
(
false
)
</
script
>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录