Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
najiu-admin-template
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
najiu-frontend
najiu-admin-template
Commits
8832a074
Commit
8832a074
authored
Jul 17, 2021
by
无木
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(code-editor): `value` not support use as `v-model`
修复value不支持v-model用法的问题 fixed: #933
parent
61ce25be
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
9 deletions
+24
-9
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
+21
-8
No files found.
CHANGELOG.zh_CN.md
View file @
8832a074
...
@@ -29,6 +29,7 @@
...
@@ -29,6 +29,7 @@
-
**Modal**
确保 props 正确被传递
-
**Modal**
确保 props 正确被传递
-
**MultipleTab**
修复可能会意外创建登录路由标签的问题
-
**MultipleTab**
修复可能会意外创建登录路由标签的问题
-
**BasicTree**
修复搜索功能可能导致
`checkedKeys`
丢失的问题
-
**BasicTree**
修复搜索功能可能导致
`checkedKeys`
丢失的问题
-
**CodeEditor**
修复 value 不支持 v-model 用法的问题
-
**其它**
-
**其它**
-
修复菜单默认折叠的配置不起作用的问题
-
修复菜单默认折叠的配置不起作用的问题
-
修复
`safari`
浏览器报错导致网站打不开
-
修复
`safari`
浏览器报错导致网站打不开
...
...
src/components/CodeEditor/src/CodeEditor.vue
View file @
8832a074
...
@@ -29,7 +29,7 @@
...
@@ -29,7 +29,7 @@
name
:
'
CodeEditor
'
,
name
:
'
CodeEditor
'
,
components
:
{
CodeMirrorEditor
},
components
:
{
CodeMirrorEditor
},
props
,
props
,
emits
:
[
'
change
'
],
emits
:
[
'
change
'
,
'
update:value
'
],
setup
(
props
,
{
emit
})
{
setup
(
props
,
{
emit
})
{
const
getValue
=
computed
(()
=>
{
const
getValue
=
computed
(()
=>
{
const
{
value
,
mode
}
=
props
;
const
{
value
,
mode
}
=
props
;
...
@@ -42,6 +42,7 @@
...
@@ -42,6 +42,7 @@
});
});
function
handleValueChange
(
v
)
{
function
handleValueChange
(
v
)
{
emit
(
'
update:value
'
,
v
);
emit
(
'
change
'
,
v
);
emit
(
'
change
'
,
v
);
}
}
...
...
src/views/demo/editor/json/index.vue
View file @
8832a074
<
template
>
<
template
>
<PageWrapper
title=
"代码编辑器组件示例"
contentFullHeight
fixedHeight
contentBackground
>
<PageWrapper
title=
"代码编辑器组件示例"
contentFullHeight
fixedHeight
contentBackground
>
<template
#extra
>
<template
#extra
>
<a-space
size=
"middle"
>
<a-button
@
click=
"showData"
type=
"primary"
>
获取数据
</a-button>
<RadioGroup
button-style=
"solid"
v-model:value=
"modeValue"
@
change=
"handleModeChange"
>
<RadioGroup
button-style=
"solid"
v-model:value=
"modeValue"
@
change=
"handleModeChange"
>
<RadioButton
value=
"application/json"
>
json数据
</RadioButton>
<RadioButton
value=
"application/json"
>
json数据
</RadioButton>
<RadioButton
value=
"htmlmixed"
>
html代码
</RadioButton>
<RadioButton
value=
"htmlmixed"
>
html代码
</RadioButton>
<RadioButton
value=
"javascript"
>
javascript代码
</RadioButton>
<RadioButton
value=
"javascript"
>
javascript代码
</RadioButton>
</RadioGroup>
</RadioGroup>
</a-space>
</
template
>
</
template
>
<CodeEditor
v-model:value=
"value"
:mode=
"modeValue"
/>
<CodeEditor
v-model:value=
"value"
:mode=
"modeValue"
/>
</PageWrapper>
</PageWrapper>
...
@@ -14,7 +17,7 @@
...
@@ -14,7 +17,7 @@
import
{
defineComponent
,
ref
}
from
'
vue
'
;
import
{
defineComponent
,
ref
}
from
'
vue
'
;
import
{
CodeEditor
}
from
'
/@/components/CodeEditor
'
;
import
{
CodeEditor
}
from
'
/@/components/CodeEditor
'
;
import
{
PageWrapper
}
from
'
/@/components/Page
'
;
import
{
PageWrapper
}
from
'
/@/components/Page
'
;
import
{
Radio
}
from
'
ant-design-vue
'
;
import
{
Radio
,
Space
,
Modal
}
from
'
ant-design-vue
'
;
const
jsonData
=
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"}]}
'
;
'
{"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 @@
...
@@ -51,7 +54,13 @@
</html>
</html>
`
;
`
;
export
default
defineComponent
({
export
default
defineComponent
({
components
:
{
CodeEditor
,
PageWrapper
,
RadioButton
:
Radio
.
Button
,
RadioGroup
:
Radio
.
Group
},
components
:
{
CodeEditor
,
PageWrapper
,
RadioButton
:
Radio
.
Button
,
RadioGroup
:
Radio
.
Group
,
ASpace
:
Space
,
},
setup
()
{
setup
()
{
const
modeValue
=
ref
(
'
application/json
'
);
const
modeValue
=
ref
(
'
application/json
'
);
const
value
=
ref
(
jsonData
);
const
value
=
ref
(
jsonData
);
...
@@ -72,7 +81,11 @@
...
@@ -72,7 +81,11 @@
}
}
}
}
return
{
value
,
modeValue
,
handleModeChange
};
function
showData
()
{
Modal
.
info
({
title
:
'
编辑器当前值
'
,
content
:
value
.
value
});
}
return
{
value
,
modeValue
,
handleModeChange
,
showData
};
},
},
});
});
</
script
>
</
script
>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment