Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
basic-vue-admin
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Basic
basic-vue-admin
Commits
8832a074
提交
8832a074
authored
7月 17, 2021
作者:
无木
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(code-editor): `value` not support use as `v-model`
修复value不支持v-model用法的问题 fixed: #933
上级
61ce25be
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
19 行增加
和
4 行删除
+19
-4
CHANGELOG.zh_CN.md
CHANGELOG.zh_CN.md
+1
-0
CodeEditor.vue
src/components/CodeEditor/src/CodeEditor.vue
+2
-1
index.vue
src/views/demo/editor/json/index.vue
+16
-3
没有找到文件。
CHANGELOG.zh_CN.md
浏览文件 @
8832a074
...
...
@@ -29,6 +29,7 @@
-
**Modal**
确保 props 正确被传递
-
**MultipleTab**
修复可能会意外创建登录路由标签的问题
-
**BasicTree**
修复搜索功能可能导致
`checkedKeys`
丢失的问题
-
**CodeEditor**
修复 value 不支持 v-model 用法的问题
-
**其它**
-
修复菜单默认折叠的配置不起作用的问题
-
修复
`safari`
浏览器报错导致网站打不开
...
...
src/components/CodeEditor/src/CodeEditor.vue
浏览文件 @
8832a074
...
...
@@ -29,7 +29,7 @@
name
:
'CodeEditor'
,
components
:
{
CodeMirrorEditor
},
props
,
emits
:
[
'change'
],
emits
:
[
'change'
,
'update:value'
],
setup
(
props
,
{
emit
})
{
const
getValue
=
computed
(()
=>
{
const
{
value
,
mode
}
=
props
;
...
...
@@ -42,6 +42,7 @@
});
function
handleValueChange
(
v
)
{
emit
(
'update:value'
,
v
);
emit
(
'change'
,
v
);
}
...
...
src/views/demo/editor/json/index.vue
浏览文件 @
8832a074
<
template
>
<PageWrapper
title=
"代码编辑器组件示例"
contentFullHeight
fixedHeight
contentBackground
>
<template
#
extra
>
<a-space
size=
"middle"
>
<a-button
@
click=
"showData"
type=
"primary"
>
获取数据
</a-button>
<RadioGroup
button-style=
"solid"
v-model:value=
"modeValue"
@
change=
"handleModeChange"
>
<RadioButton
value=
"application/json"
>
json数据
</RadioButton>
<RadioButton
value=
"htmlmixed"
>
html代码
</RadioButton>
<RadioButton
value=
"javascript"
>
javascript代码
</RadioButton>
</RadioGroup>
</a-space>
</
template
>
<CodeEditor
v-model:value=
"value"
:mode=
"modeValue"
/>
</PageWrapper>
...
...
@@ -14,7 +17,7 @@
import
{
defineComponent
,
ref
}
from
'vue'
;
import
{
CodeEditor
}
from
'/@/components/CodeEditor'
;
import
{
PageWrapper
}
from
'/@/components/Page'
;
import
{
Radio
}
from
'ant-design-vue'
;
import
{
Radio
,
Space
,
Modal
}
from
'ant-design-vue'
;
const
jsonData
=
'{"name":"BeJson","url":"http://www.xxx.com","page":88,"isNonProfit":true,"address":{"street":"科技园路.","city":"江苏苏州","country":"中国"},"links":[{"name":"Google","url":"http://www.xxx.com"},{"name":"Baidu","url":"http://www.xxx.com"},{"name":"SoSo","url":"http://www.xxx.com"}]}'
;
...
...
@@ -51,7 +54,13 @@
</html>
`
;
export
default
defineComponent
({
components
:
{
CodeEditor
,
PageWrapper
,
RadioButton
:
Radio
.
Button
,
RadioGroup
:
Radio
.
Group
},
components
:
{
CodeEditor
,
PageWrapper
,
RadioButton
:
Radio
.
Button
,
RadioGroup
:
Radio
.
Group
,
ASpace
:
Space
,
},
setup
()
{
const
modeValue
=
ref
(
'application/json'
);
const
value
=
ref
(
jsonData
);
...
...
@@ -72,7 +81,11 @@
}
}
return
{
value
,
modeValue
,
handleModeChange
};
function
showData
()
{
Modal
.
info
({
title
:
'编辑器当前值'
,
content
:
value
.
value
});
}
return
{
value
,
modeValue
,
handleModeChange
,
showData
};
},
});
</
script
>
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论