Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
uuai
test_git
提交
bb5d5920
T
test_git
项目概览
uuai
/
test_git
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
test_git
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
bb5d5920
编写于
5月 05, 2022
作者:
W
wuyb@phxg.cn
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
jsx
上级
fcecae37
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
22 addition
and
11 deletion
+22
-11
vite-demo/src/views/skills/components/jsx/btn1.vue
vite-demo/src/views/skills/components/jsx/btn1.vue
+14
-6
vite-demo/src/views/skills/components/jsx/index.vue
vite-demo/src/views/skills/components/jsx/index.vue
+2
-3
vite-demo/src/views/skills/components/jsx/renderFn.js
vite-demo/src/views/skills/components/jsx/renderFn.js
+6
-2
未找到文件。
vite-demo/src/views/skills/components/jsx/btn1.vue
浏览文件 @
bb5d5920
<
template
>
<div>
<h1>
title:
{{
title
}}
-
</h1>
<div
v-if=
"show"
>
<h1>
title:
-
{{
title
}}
-
</h1>
这是btn1组件
<p>
组件内部值:
{{
num
}}
</p>
<p>
props - type:
</p>
<p>
props - type:
{{
type
}}
</p>
<slot></slot>
<slot
name=
"name"
></slot>
<button
@
click=
"close"
>
关闭
</button>
</div>
</
template
>
<
script
>
...
...
@@ -14,12 +15,19 @@
export
default
defineComponent
({
name
:
'
btn1
'
,
props
:
{
title
:
String
title
:
String
,
type
:
Number
,
show
:
Boolean
},
setup
(
props
)
{
setup
(
props
,
{
emit
}
)
{
console
.
log
(
'
props - btn
'
,
props
);
const
num
=
ref
(
1
)
return
{
num
}
const
close
=
()
=>
{
console
.
log
(
'
close
'
)
emit
(
'
close
'
);
emit
(
'
update:show
'
,
false
)
}
return
{
num
,
close
}
}
})
</
script
>
\ No newline at end of file
vite-demo/src/views/skills/components/jsx/index.vue
浏览文件 @
bb5d5920
<
template
>
<button
@
click=
"componentsToggle"
>
切换
</button>
<renderFn
:type=
"componentsType"
title=
"自定义title"
:show=
"isShow"
>
<button
@
click=
"onShow"
>
显示
</button>
<renderFn
:type=
"componentsType"
title=
"自定义title"
:show.sync=
"isShow"
>
<div
default=
"
{text}">
<p>
默认插槽: 111111
</p>
</div>
...
...
@@ -27,9 +28,7 @@
let
isShow
=
ref
(
false
)
let
componentsType
=
ref
(
1
)
const
componentsToggle
=
()
=>
{
componentsType
.
value
=
componentsType
.
value
===
1
?
2
:
1
console
.
log
(
'
isShow
'
,
isShow
.
value
)
}
const
onShow
=
()
=>
{
isShow
.
value
=
true
...
...
vite-demo/src/views/skills/components/jsx/renderFn.js
浏览文件 @
bb5d5920
...
...
@@ -15,9 +15,13 @@ import {h, watch} from 'vue'
export
default
{
props
:
[
'
type
'
,
'
show
'
,
'
title
'
],
setup
(
props
,
{
slots
})
{
console
.
log
(
'
props
'
,
props
);
console
.
log
(
'
props
- renderFn
'
,
props
);
return
()
=>
[
props
.
type
===
1
?
h
(
btn1
,
slots
.
default
)
:
h
(
btn2
)
props
.
type
===
1
?
h
(
btn1
,
{
title
:
props
.
title
,
type
:
props
.
type
,
show
:
props
.
show
},
slots
.
default
)
:
h
(
btn2
)
]
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录