Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Yuan Zhixiang
c-render-vue
Commits
f6c14934
Commit
f6c14934
authored
Apr 23, 2024
by
Yuan Zhixiang
Browse files
添加仿断点样式,默认关闭
parent
6026a3f8
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/App.vue
View file @
f6c14934
...
@@ -224,6 +224,7 @@ function get_oj_solution_id(){
...
@@ -224,6 +224,7 @@ function get_oj_solution_id(){
get_oj_solution_id
()
get_oj_solution_id
()
const
feature_show_new_vars
=
ref
(
false
)
const
feature_show_new_vars
=
ref
(
false
)
const
feature_breakpoint_style
=
ref
(
false
)
provide
(
'
app
'
,
{
provide
(
'
app
'
,
{
loading
,
loading
,
...
@@ -244,7 +245,8 @@ provide('app', {
...
@@ -244,7 +245,8 @@ provide('app', {
highlight_lines
,
highlight_lines
,
click_line
,
click_line
,
edit_mode
,
edit_mode
,
feature_show_new_vars
feature_show_new_vars
,
feature_breakpoint_style
})
})
</
script
>
</
script
>
...
...
src/components/LineUnit.vue
View file @
f6c14934
...
@@ -3,7 +3,7 @@ import { computed, inject } from 'vue';
...
@@ -3,7 +3,7 @@ import { computed, inject } from 'vue';
const
props
=
defineProps
([
'
line
'
,
'
code
'
])
const
props
=
defineProps
([
'
line
'
,
'
code
'
])
const
{
current_line
,
next_line
,
click_line
,
highlight_lines
}
=
inject
(
'
app
'
)
const
{
current_line
,
next_line
,
click_line
,
highlight_lines
,
feature_breakpoint_style
}
=
inject
(
'
app
'
)
const
line
=
computed
(()
=>
{
// 行号
const
line
=
computed
(()
=>
{
// 行号
return
props
.
line
return
props
.
line
...
@@ -27,12 +27,23 @@ const is_next = computed(() => { // 是下一行
...
@@ -27,12 +27,23 @@ const is_next = computed(() => { // 是下一行
return
line
.
value
==
next_line
.
value
return
line
.
value
==
next_line
.
value
})
})
const
css_code_background
=
computed
(()
=>
{
// 对应的style
const
css_code_background
=
computed
(()
=>
{
// 对应的style
if
(
feature_breakpoint_style
.
value
){
return
'
white
'
}
if
(
Object
.
values
(
highlight_lines
.
value
).
includes
(
line
.
value
))
{
if
(
Object
.
values
(
highlight_lines
.
value
).
includes
(
line
.
value
))
{
return
'
#FFDAD6
'
return
'
#FFDAD6
'
}
else
{
}
else
{
return
'
white
'
return
'
white
'
}
}
})
})
const
breakpoint
=
computed
(()
=>
{
//
if
(
Object
.
values
(
highlight_lines
.
value
).
includes
(
line
.
value
))
{
return
'
'
}
else
{
return
'
'
}
})
function
click
()
{
function
click
()
{
click_line
(
line
.
value
)
click_line
(
line
.
value
)
}
}
...
@@ -42,6 +53,7 @@ function click() {
...
@@ -42,6 +53,7 @@ function click() {
<
template
>
<
template
>
<div>
<div>
<pre
:class=
"
{ blue: is_current, 'light-blue': is_next }">
{{
mark
}}
</pre>
<pre
:class=
"
{ blue: is_current, 'light-blue': is_next }">
{{
mark
}}
</pre>
<pre
class=
"breakpoint"
v-show=
"feature_breakpoint_style"
>
{{
breakpoint
}}
</pre>
<pre
:class=
"
{ blue: is_current }" class="code" @click="click">
{{
code
}}
</pre>
<pre
:class=
"
{ blue: is_current }" class="code" @click="click">
{{
code
}}
</pre>
</div>
</div>
</
template
>
</
template
>
...
@@ -76,4 +88,8 @@ pre {
...
@@ -76,4 +88,8 @@ pre {
filter
:
brightness
(
0.8
);
filter
:
brightness
(
0.8
);
transition-duration
:
200ms
;
transition-duration
:
200ms
;
}
}
.breakpoint
{
color
:
red
;
}
</
style
>
</
style
>
\ No newline at end of file
src/components/buttons/CommandButton.vue
View file @
f6c14934
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
import
{
computed
,
inject
}
from
'
vue
'
;
import
{
computed
,
inject
}
from
'
vue
'
;
const
{
stdin_input
,
feature_show_new_vars
}
=
inject
(
'
app
'
)
const
{
stdin_input
,
feature_show_new_vars
,
feature_breakpoint_style
}
=
inject
(
'
app
'
)
const
command
=
computed
(()
=>
{
const
command
=
computed
(()
=>
{
if
(
stdin_input
.
value
.
length
<=
1
){
if
(
stdin_input
.
value
.
length
<=
1
){
...
@@ -15,12 +15,16 @@ const command = computed(()=>{
...
@@ -15,12 +15,16 @@ const command = computed(()=>{
function
click
(){
function
click
(){
const
cmd
=
command
.
value
const
cmd
=
command
.
value
if
(
cmd
==
'
?
'
){
if
(
cmd
==
'
?
'
){
stdin_input
.
value
=
'
available commands:
\n
/show_new_vars
'
stdin_input
.
value
=
'
available commands:
\n
/show_new_vars
\n
/breakpoint_style
'
}
}
else
if
(
cmd
==
'
show_new_vars
'
){
else
if
(
cmd
==
'
show_new_vars
'
){
feature_show_new_vars
.
value
=
!
feature_show_new_vars
.
value
feature_show_new_vars
.
value
=
!
feature_show_new_vars
.
value
stdin_input
.
value
=
'
feature_show_new_vars:
'
+
feature_show_new_vars
.
value
stdin_input
.
value
=
'
feature_show_new_vars:
'
+
feature_show_new_vars
.
value
}
}
else
if
(
cmd
==
'
breakpoint_style
'
){
feature_breakpoint_style
.
value
=
!
feature_breakpoint_style
.
value
stdin_input
.
value
=
'
feature_breakpoint_style:
'
+
feature_breakpoint_style
.
value
}
else
{
else
{
stdin_input
.
value
=
'
unknown command
\n
use /?
'
stdin_input
.
value
=
'
unknown command
\n
use /?
'
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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