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
20713ac9
Commit
20713ac9
authored
Apr 20, 2024
by
Yuan Zhixiang
Browse files
添加隐藏的自定义功能,默认关闭“高亮新增的变量”
parent
eed661f9
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/App.vue
View file @
20713ac9
...
...
@@ -223,6 +223,8 @@ function get_oj_solution_id(){
}
get_oj_solution_id
()
const
feature_show_new_vars
=
ref
(
false
)
provide
(
'
app
'
,
{
loading
,
code_input
,
...
...
@@ -241,7 +243,8 @@ provide('app', {
click_step
,
highlight_lines
,
click_line
,
edit_mode
edit_mode
,
feature_show_new_vars
})
</
script
>
...
...
src/components/ControlPanel.vue
View file @
20713ac9
...
...
@@ -5,13 +5,17 @@ import EditButton from './buttons/EditButton.vue';
import
RunButton
from
'
./buttons/RunButton.vue
'
;
import
PrevButton
from
'
./buttons/PrevButton.vue
'
;
import
NextButton
from
'
./buttons/NextButton.vue
'
;
import
CommandButton
from
'
./buttons/CommandButton.vue
'
;
const
{
total_steps
,
edit_mode
}
=
inject
(
'
app
'
)
const
{
total_steps
,
edit_mode
,
stdin_input
}
=
inject
(
'
app
'
)
const
css_grid_template_columns
=
computed
(()
=>
{
return
`repeat(
${
total_steps
.
value
}
, 1fr)`
;
})
const
command_available
=
computed
(()
=>
{
return
stdin_input
.
value
.
startsWith
(
"
/set
"
)
})
</
script
>
...
...
@@ -25,6 +29,7 @@ const css_grid_template_columns = computed(() => {
<RunButton
v-show=
"edit_mode"
/>
<PrevButton
v-show=
"!edit_mode"
/>
<NextButton
v-show=
"!edit_mode"
/>
<CommandButton
v-show=
"command_available"
/>
</div>
</
template
>
...
...
src/components/StackView.vue
View file @
20713ac9
...
...
@@ -2,7 +2,7 @@
import
{
computed
,
inject
,
provide
,
watch
,
ref
}
from
'
vue
'
;
import
VarUnit
from
'
./VarUnit.vue
'
;
const
{
get_step
,
current_step
}
=
inject
(
'
app
'
)
const
{
get_step
,
current_step
,
feature_show_new_vars
}
=
inject
(
'
app
'
)
const
current_stack
=
computed
(()
=>
{
// 当前要显示的帧(主要显示stack部分)
return
get_step
(
current_step
.
value
+
1
)
...
...
@@ -68,7 +68,9 @@ function check_changed(value) { // 检查某个地址的值是否发生了变化
return
'
changed
'
}
}
else
{
return
'
new
'
if
(
feature_show_new_vars
.
value
){
return
'
new
'
}
}
}
return
'
x
'
...
...
src/components/buttons/CommandButton.vue
0 → 100644
View file @
20713ac9
<
script
setup
>
import
{
computed
,
inject
}
from
'
vue
'
;
const
{
stdin_input
,
feature_show_new_vars
}
=
inject
(
'
app
'
)
const
command
=
computed
(()
=>
{
if
(
stdin_input
.
value
.
length
<=
5
){
return
''
}
else
{
return
stdin_input
.
value
.
slice
(
5
)
}
})
function
click
(){
const
cmd
=
command
.
value
if
(
cmd
==
'
help
'
){
stdin_input
.
value
=
'
available commands:
\n
/set show_new_vars
'
}
else
if
(
cmd
==
'
show_new_vars
'
){
feature_show_new_vars
.
value
=
!
feature_show_new_vars
.
value
stdin_input
.
value
=
'
feature_show_new_vars:
'
+
feature_show_new_vars
.
value
}
else
{
stdin_input
.
value
=
'
unknown command
\n
use /set help
'
}
}
</
script
>
<
template
>
<button
class=
"button"
@
click=
"click"
>
执行
</button>
</
template
>
<
style
scoped
>
@import
'@/assets/button.css'
;
</
style
>
\ No newline at end of file
src/components/buttons/RunButton.vue
View file @
20713ac9
...
...
@@ -26,7 +26,7 @@ function click() {
@import
'@/assets/button.css'
;
.button
{
display
:
flex
;
display
:
inline-
flex
;
align-items
:
center
;
/* 垂直居中 */
}
...
...
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