This commit is contained in:
王念超
2024-06-11 18:51:08 +08:00
parent e48c097d90
commit 0dd415c2f3
3 changed files with 19 additions and 7 deletions

7
js_node/test.cjs Normal file
View File

@@ -0,0 +1,7 @@
let path = require("path");
let fs = require("fs");
const axios = require('axios')
let str = fs.readFileSync('./save/allNew.min.json', "utf8");
console.log('str',JSON.parse(str)[0])

View File

@@ -36,7 +36,7 @@ const emit = defineEmits<{
}>()
const settingStore = useSettingStore()
const listRef: any = $ref()
let listRef: any = $ref()
function scrollToBottom() {
nextTick(() => {
@@ -44,13 +44,18 @@ function scrollToBottom() {
})
}
function scrollToTop() {
nextTick(() => {
listRef?.scrollTo(0, 0)
})
}
function scrollToItem(index: number) {
nextTick(() => {
listRef?.children[index]?.scrollIntoView({block: 'center', behavior: 'smooth'})
})
}
defineExpose({scrollToBottom, scrollToItem})
let pageNo = $ref(1)
@@ -106,7 +111,7 @@ function handleBatchDel() {
function handlePageNo(e) {
pageNo = e
console.log('listRef', listRef)
scrollToTop()
}
const s = useSlots()
@@ -202,7 +207,7 @@ defineRender(
: currentList.length ? (
<>
<div class="flex-1 overflow-auto"
ref='listRef'>
ref={e => listRef = e}>
{currentList.map((item) => {
return (
<div class="list-item-wrapper"

View File

@@ -217,7 +217,7 @@ defineRender(() => {
</div>
{
wordFormData.type ? (
<div class="add w-1/2">
<div class="flex-1 ml-4">
<div class="common-title">
{wordFormData.type === FormMode.Add ? '添加' : '修改'}单词
</div>
@@ -226,7 +226,7 @@ defineRender(() => {
ref="wordFormRef"
rules={wordRules}
model={wordForm}
label-width="6rem">
label-width="7rem">
<el-form-item label="单词" prop="word">
<el-input
modelValue={wordForm.word}
@@ -238,7 +238,7 @@ defineRender(() => {
modelValue={wordForm.trans}
onUpdate:model-value={e => wordForm.trans = e}
placeholder="多个翻译请换行"
autosize={{minRows: 2, maxRows: 6}}
autosize={{minRows: 6, maxRows: 10}}
type="textarea"/>
</el-form-item>
<el-form-item label="音标/发音①">