You've already forked SmartisanNote.Remake
移除了无用的资源;
头部图片资源修改;
This commit is contained in:
@@ -1,18 +1,20 @@
|
||||
<template>
|
||||
<div class="code-fun-flex-row code-fun-items-center component">
|
||||
<!-- 左侧图标 -->
|
||||
<img class="left-icon" :src="leftIconSource" @click="handleLeftAction" />
|
||||
<div class="component">
|
||||
<div class="inner code-fun-flex-row code-fun-items-center">
|
||||
<!-- 左侧图标 -->
|
||||
<img class="left-icon" :src="leftIconSource" @click="handleLeftAction" />
|
||||
|
||||
<!-- 标题区域 -->
|
||||
<div class="title-container" @click="handleTitlePress">
|
||||
<span class="text">{{ title }}</span>
|
||||
<!-- 文件夹展开图标 -->
|
||||
<img v-if="showFolderIcon" class="folder-icon" :src="folderExpanded ? '/assets/icons/drawable-xxhdpi/folder_title_arrow_pressed.png' : '/assets/icons/drawable-xxhdpi/folder_title_arrow_normal.png'" @click.stop="handleFolderToggle" />
|
||||
<!-- 标题区域 -->
|
||||
<div class="title-container" @click="handleTitlePress">
|
||||
<span class="text">{{ title }}</span>
|
||||
<!-- 文件夹展开图标 -->
|
||||
<img v-if="showFolderIcon" class="folder-icon" :src="folderExpanded ? '/assets/icons/drawable-xxhdpi/folder_title_arrow_pressed.png' : '/assets/icons/drawable-xxhdpi/folder_title_arrow_normal.png'" @click.stop="handleFolderToggle" />
|
||||
</div>
|
||||
|
||||
<!-- 右侧操作按钮 -->
|
||||
<img v-if="actionIcon === 'create'" class="image_4" src="/assets/icons/drawable-xxhdpi/btn_create.png" @click="handleAction" />
|
||||
<div v-else class="image_4-placeholder"></div>
|
||||
</div>
|
||||
|
||||
<!-- 右侧操作按钮 -->
|
||||
<img v-if="actionIcon === 'create'" class="image_4" src="/assets/icons/drawable-xxhdpi/btn_create.png" @click="handleAction" />
|
||||
<div v-else class="image_4-placeholder"></div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -123,15 +125,18 @@ const handleTitlePress = () => {
|
||||
|
||||
<style scoped lang="less">
|
||||
.component {
|
||||
padding: 2rem 0.72rem 0.5rem;
|
||||
background-color: #00000000;
|
||||
background-image: url(assets/icons/drawable-xxhdpi/action_bar_default.png);
|
||||
padding: 4.5rem 0.72rem 0.5rem;
|
||||
background-image: url(/assets/icons/drawable-xxhdpi/title_bar_background.png);
|
||||
background-size: 100% 100%;
|
||||
background-position: 0% 0%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
.inner {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
width: 100%;
|
||||
transform: translateY(-3.2rem);
|
||||
}
|
||||
.left-icon,
|
||||
.image_4 {
|
||||
width: 1.7rem;
|
||||
|
||||
@@ -1,211 +1,86 @@
|
||||
<template>
|
||||
<div class="note-item-container">
|
||||
<!-- 左滑删除操作区域 -->
|
||||
<div v-if="onDelete" class="delete-area" :class="{ 'delete-area-visible': isSwiped }">
|
||||
<span class="delete-text">删除</span>
|
||||
</div>
|
||||
|
||||
<!-- 便签内容区域 -->
|
||||
<div
|
||||
class="note-content"
|
||||
:class="{
|
||||
'note-content-swiped': isSwiped,
|
||||
'note-content-pressed': isPressed,
|
||||
}"
|
||||
@click="onPress"
|
||||
@touchstart="handleTouchStart"
|
||||
@touchmove="handleTouchMove"
|
||||
@touchend="handleTouchEnd"
|
||||
@mousedown="handleMouseDown"
|
||||
@mouseup="handleMouseUp"
|
||||
@mouseleave="handleMouseLeave">
|
||||
<div class="note-header">
|
||||
<span class="note-date">
|
||||
{{ date }}
|
||||
</span>
|
||||
<ion-icon v-if="isStarred" :icon="star" class="star-icon"></ion-icon>
|
||||
</div>
|
||||
<div class="note-title-container">
|
||||
<span class="note-title">
|
||||
{{ firstLine || '无内容' }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed } from 'vue'
|
||||
import { star } from 'ionicons/icons'
|
||||
|
||||
const props = defineProps({
|
||||
title: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
content: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
date: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
isStarred: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
onPress: {
|
||||
type: Function,
|
||||
required: true,
|
||||
},
|
||||
onDelete: {
|
||||
type: Function,
|
||||
default: null,
|
||||
},
|
||||
})
|
||||
|
||||
const isSwiped = ref(false)
|
||||
const isPressed = ref(false)
|
||||
const touchStartX = ref(0)
|
||||
const touchEndX = ref(0)
|
||||
|
||||
const firstLine = computed(() => {
|
||||
if (!props.content) return ''
|
||||
return props.content.split('\n')[0]
|
||||
})
|
||||
|
||||
const handleTouchStart = (event) => {
|
||||
touchStartX.value = event.touches[0].clientX
|
||||
isPressed.value = true
|
||||
}
|
||||
|
||||
const handleTouchMove = (event) => {
|
||||
touchEndX.value = event.touches[0].clientX
|
||||
// 如果有滑动,取消按下状态
|
||||
if (Math.abs(touchStartX.value - touchEndX.value) > 5) {
|
||||
isPressed.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const handleTouchEnd = () => {
|
||||
// 重置按下状态
|
||||
isPressed.value = false
|
||||
|
||||
// 计算滑动距离
|
||||
const swipeDistance = touchStartX.value - touchEndX.value
|
||||
|
||||
// 如果滑动距离超过阈值,则显示删除按钮
|
||||
if (swipeDistance > 50) {
|
||||
isSwiped.value = true
|
||||
} else if (swipeDistance < -50) {
|
||||
isSwiped.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const handleMouseDown = () => {
|
||||
isPressed.value = true
|
||||
}
|
||||
|
||||
const handleMouseUp = () => {
|
||||
isPressed.value = false
|
||||
}
|
||||
|
||||
const handleMouseLeave = () => {
|
||||
isPressed.value = false
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.note-item-container {
|
||||
height: 78.33px;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
margin-bottom: 1px;
|
||||
position: relative;
|
||||
background: var(--background-card);
|
||||
}
|
||||
|
||||
.delete-area {
|
||||
position: absolute;
|
||||
right: -80px;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 80px;
|
||||
height: 100%;
|
||||
background: #ffe65c53;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
transition: right 0.3s ease;
|
||||
}
|
||||
|
||||
.delete-area-visible {
|
||||
right: 0px;
|
||||
}
|
||||
|
||||
.delete-text {
|
||||
font-size: 12px;
|
||||
font-weight: bold;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.note-content {
|
||||
width: 100%;
|
||||
cursor: pointer;
|
||||
height: 100%;
|
||||
background: var(--background-card);
|
||||
box-sizing: border-box;
|
||||
transition: transform 0.3s ease, background-color 0.2s ease;
|
||||
position: relative;
|
||||
border-bottom: 1px solid var(--border);
|
||||
position: relative;
|
||||
transition: background-color 0.2s ease;
|
||||
}
|
||||
|
||||
.note-content-swiped {
|
||||
transform: translateX(-80px);
|
||||
}
|
||||
|
||||
.note-content-pressed {
|
||||
background: var(--background-secondary);
|
||||
transform: scale(0.99);
|
||||
}
|
||||
|
||||
.note-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 5px 12px 0 52px;
|
||||
position: relative;
|
||||
height: 24px;
|
||||
}
|
||||
|
||||
.note-date {
|
||||
font-size: 10px;
|
||||
color: var(--note-date);
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.star-icon {
|
||||
font-size: 16px;
|
||||
color: var(--note-star);
|
||||
}
|
||||
|
||||
.note-title-container {
|
||||
position: absolute;
|
||||
top: 38.5px;
|
||||
left: 52px;
|
||||
right: 12px;
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
.note-title {
|
||||
font-size: 16.5px;
|
||||
color: var(--note-title);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
line-height: 30px;
|
||||
}
|
||||
</style>
|
||||
<template>
|
||||
<div class="code-fun-flex-col code-fun-justify-start code-fun-relative list-item_7">
|
||||
<div class="code-fun-flex-col section_17">
|
||||
<div class="code-fun-flex-row code-fun-justify-between">
|
||||
<span class="font_2 text_18">750天前2023/9/21下午4:52</span>
|
||||
<div class="code-fun-flex-row group_3">
|
||||
<img class="image_11 image_29" src="/assets/icons/drawable-xxhdpi/icon_top_normal.png" />
|
||||
<img class="image_26 ml-15" src="/assets/icons/drawable-xxhdpi/icon_detail_star_unchecked.png" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="code-fun-flex-row code-fun-justify-between mt-17-5">
|
||||
<span class="font_3 text_19">夜幕中启程</span>
|
||||
<img class="image_28" src="/assets/icons/drawable-xxhdpi/list_item_image_icon.png" />
|
||||
</div>
|
||||
</div>
|
||||
<img class="image_27 pos_18" src="/assets/icons/drawable-xxhdpi/note_item_clip_normal.png" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts"></script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.ml-15 {
|
||||
margin-left: 0.94rem;
|
||||
}
|
||||
.mt-17-5 {
|
||||
margin-top: 1.09rem;
|
||||
}
|
||||
.list-item_7 {
|
||||
height: 3.16rem;
|
||||
.section_17 {
|
||||
margin-left: 0.25rem;
|
||||
padding: 0.44rem 0.69rem 0.88rem 2.69rem;
|
||||
background-color: #00000000;
|
||||
.font_2 {
|
||||
font-size: 0.71rem;
|
||||
line-height: 0.71rem;
|
||||
color: #c2bdb1;
|
||||
}
|
||||
.text_18 {
|
||||
margin-top: 0.061rem;
|
||||
color: #c3beb4;
|
||||
}
|
||||
.group_3 {
|
||||
margin-right: 0.19rem;
|
||||
margin-bottom: 0.063rem;
|
||||
.image_11 {
|
||||
width: 0.63rem;
|
||||
height: 0.63rem;
|
||||
}
|
||||
.image_29 {
|
||||
margin-top: 0.063rem;
|
||||
}
|
||||
.image_26 {
|
||||
width: 0.69rem;
|
||||
height: 0.69rem;
|
||||
}
|
||||
}
|
||||
.font_3 {
|
||||
font-size: 0.88rem;
|
||||
line-height: 0.88rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
.text_19 {
|
||||
margin-bottom: 0.065rem;
|
||||
color: #816d61;
|
||||
font-size: 0.9rem;
|
||||
line-height: 0.9rem;
|
||||
}
|
||||
.image_28 {
|
||||
width: 1.06rem;
|
||||
height: 0.91rem;
|
||||
}
|
||||
}
|
||||
.image_27 {
|
||||
border-radius: 0.024rem 0.26rem 0.25rem 0.094rem;
|
||||
width: 1.56rem;
|
||||
height: 1.03rem;
|
||||
}
|
||||
.pos_18 {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
bottom: 0.5rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
211
src/components/NoteItem_old.vue
Normal file
211
src/components/NoteItem_old.vue
Normal file
@@ -0,0 +1,211 @@
|
||||
<template>
|
||||
<div class="note-item-container">
|
||||
<!-- 左滑删除操作区域 -->
|
||||
<div v-if="onDelete" class="delete-area" :class="{ 'delete-area-visible': isSwiped }">
|
||||
<span class="delete-text">删除</span>
|
||||
</div>
|
||||
|
||||
<!-- 便签内容区域 -->
|
||||
<div
|
||||
class="note-content"
|
||||
:class="{
|
||||
'note-content-swiped': isSwiped,
|
||||
'note-content-pressed': isPressed,
|
||||
}"
|
||||
@click="onPress"
|
||||
@touchstart="handleTouchStart"
|
||||
@touchmove="handleTouchMove"
|
||||
@touchend="handleTouchEnd"
|
||||
@mousedown="handleMouseDown"
|
||||
@mouseup="handleMouseUp"
|
||||
@mouseleave="handleMouseLeave">
|
||||
<div class="note-header">
|
||||
<span class="note-date">
|
||||
{{ date }}
|
||||
</span>
|
||||
<ion-icon v-if="isStarred" :icon="star" class="star-icon"></ion-icon>
|
||||
</div>
|
||||
<div class="note-title-container">
|
||||
<span class="note-title">
|
||||
{{ firstLine || '无内容' }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed } from 'vue'
|
||||
import { star } from 'ionicons/icons'
|
||||
|
||||
const props = defineProps({
|
||||
title: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
content: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
date: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
isStarred: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
onPress: {
|
||||
type: Function,
|
||||
required: true,
|
||||
},
|
||||
onDelete: {
|
||||
type: Function,
|
||||
default: null,
|
||||
},
|
||||
})
|
||||
|
||||
const isSwiped = ref(false)
|
||||
const isPressed = ref(false)
|
||||
const touchStartX = ref(0)
|
||||
const touchEndX = ref(0)
|
||||
|
||||
const firstLine = computed(() => {
|
||||
if (!props.content) return ''
|
||||
return props.content.split('\n')[0]
|
||||
})
|
||||
|
||||
const handleTouchStart = (event) => {
|
||||
touchStartX.value = event.touches[0].clientX
|
||||
isPressed.value = true
|
||||
}
|
||||
|
||||
const handleTouchMove = (event) => {
|
||||
touchEndX.value = event.touches[0].clientX
|
||||
// 如果有滑动,取消按下状态
|
||||
if (Math.abs(touchStartX.value - touchEndX.value) > 5) {
|
||||
isPressed.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const handleTouchEnd = () => {
|
||||
// 重置按下状态
|
||||
isPressed.value = false
|
||||
|
||||
// 计算滑动距离
|
||||
const swipeDistance = touchStartX.value - touchEndX.value
|
||||
|
||||
// 如果滑动距离超过阈值,则显示删除按钮
|
||||
if (swipeDistance > 50) {
|
||||
isSwiped.value = true
|
||||
} else if (swipeDistance < -50) {
|
||||
isSwiped.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const handleMouseDown = () => {
|
||||
isPressed.value = true
|
||||
}
|
||||
|
||||
const handleMouseUp = () => {
|
||||
isPressed.value = false
|
||||
}
|
||||
|
||||
const handleMouseLeave = () => {
|
||||
isPressed.value = false
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.note-item-container {
|
||||
height: 78.33px;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
margin-bottom: 1px;
|
||||
position: relative;
|
||||
background: var(--background-card);
|
||||
}
|
||||
|
||||
.delete-area {
|
||||
position: absolute;
|
||||
right: -80px;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 80px;
|
||||
height: 100%;
|
||||
background: #ffe65c53;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
transition: right 0.3s ease;
|
||||
}
|
||||
|
||||
.delete-area-visible {
|
||||
right: 0px;
|
||||
}
|
||||
|
||||
.delete-text {
|
||||
font-size: 12px;
|
||||
font-weight: bold;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.note-content {
|
||||
width: 100%;
|
||||
cursor: pointer;
|
||||
height: 100%;
|
||||
background: var(--background-card);
|
||||
box-sizing: border-box;
|
||||
transition: transform 0.3s ease, background-color 0.2s ease;
|
||||
position: relative;
|
||||
border-bottom: 1px solid var(--border);
|
||||
position: relative;
|
||||
transition: background-color 0.2s ease;
|
||||
}
|
||||
|
||||
.note-content-swiped {
|
||||
transform: translateX(-80px);
|
||||
}
|
||||
|
||||
.note-content-pressed {
|
||||
background: var(--background-secondary);
|
||||
transform: scale(0.99);
|
||||
}
|
||||
|
||||
.note-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 5px 12px 0 52px;
|
||||
position: relative;
|
||||
height: 24px;
|
||||
}
|
||||
|
||||
.note-date {
|
||||
font-size: 10px;
|
||||
color: var(--note-date);
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.star-icon {
|
||||
font-size: 16px;
|
||||
color: var(--note-star);
|
||||
}
|
||||
|
||||
.note-title-container {
|
||||
position: absolute;
|
||||
top: 38.5px;
|
||||
left: 52px;
|
||||
right: 12px;
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
.note-title {
|
||||
font-size: 16.5px;
|
||||
color: var(--note-title);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
line-height: 30px;
|
||||
}
|
||||
</style>
|
||||
@@ -33,18 +33,11 @@
|
||||
" />
|
||||
</div>
|
||||
|
||||
<div style="padding: 0.8rem 0.5rem">
|
||||
<div style="padding: 0.8rem 0.5rem; margin-top: -2.8rem">
|
||||
<SearchBar v-model="searchQuery" @search="handleSearch" @clear="handleClearSearch" @focus="handleSearchFocus" @blur="handleSearchBlur" />
|
||||
</div>
|
||||
|
||||
<div v-if="filteredAndSortedNotes.length === 0" style="flex: 1; justify-content: center; align-items: center; padding: 16px">
|
||||
<ion-text style="font-size: 18px; font-weight: 600; color: var(--text-tertiary); margin-bottom: 8px"> 未找到便签 </ion-text>
|
||||
<ion-text style="font-size: 14px; color: var(--text-tertiary); text-align: center; line-height: 20px">
|
||||
{{ searchQuery ? '尝试其他搜索词' : '点击 + 按钮创建您的第一条便签' }}
|
||||
</ion-text>
|
||||
</div>
|
||||
<div v-else style="flex: 1">
|
||||
<ion-text style="font-size: 13px; color: var(--text-tertiary); padding-horizontal: 16px; padding-vertical: 8px; display: block"> {{ filteredAndSortedNotes.length }} 条便签 </ion-text>
|
||||
<div style="flex: 1">
|
||||
<div style="border-radius: 6px; overflow: hidden; box-shadow: 0 1px 2px var(--shadow); background-color: var(--background-card); margin: 0 16px">
|
||||
<div v-for="note in filteredAndSortedNotes" :key="note.id">
|
||||
<NoteItem :title="note.title" :content="note.content" :date="formatDate(note.updatedAt)" :isStarred="note.isStarred" :onPress="() => handleNotePress(note.id)" :onDelete="() => handleDeleteNote(note.id)" />
|
||||
@@ -86,7 +79,13 @@ const store = useAppStore()
|
||||
|
||||
// 加载初始数据
|
||||
onMounted(() => {
|
||||
store.loadData()
|
||||
// 检查URL参数是否包含mock数据加载指令
|
||||
const urlParams = new URLSearchParams(window.location.search)
|
||||
if (urlParams.get('mock') === 'true') {
|
||||
store.loadMockData()
|
||||
} else {
|
||||
store.loadData()
|
||||
}
|
||||
})
|
||||
|
||||
const searchQuery = ref('')
|
||||
@@ -239,7 +238,7 @@ const notes = computed(() => store.notes)
|
||||
.container {
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
background: url(assets/icons/drawable-xxhdpi/note_background.png);
|
||||
background: url(/assets/icons/drawable-xxhdpi/note_background.png);
|
||||
background-size: cover;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -26,14 +26,105 @@ export const useAppStore = defineStore('app', {
|
||||
const loadedFolders = await storage.getFolders();
|
||||
const loadedSettings = await storage.getSettings();
|
||||
|
||||
this.notes = loadedNotes;
|
||||
this.folders = loadedFolders;
|
||||
this.settings = loadedSettings;
|
||||
// 如果没有数据,则加载mock数据
|
||||
if (loadedNotes.length === 0 && loadedFolders.length === 0) {
|
||||
this.loadMockData();
|
||||
} else {
|
||||
this.notes = loadedNotes;
|
||||
this.folders = loadedFolders;
|
||||
this.settings = loadedSettings;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error loading data:', error);
|
||||
}
|
||||
},
|
||||
|
||||
// 加载mock数据
|
||||
async loadMockData() {
|
||||
// Mock notes
|
||||
const mockNotes = [
|
||||
{
|
||||
id: '1',
|
||||
title: '欢迎使用锤子便签',
|
||||
content: '这是一个功能强大的便签应用,您可以在这里记录您的想法、待办事项等。',
|
||||
createdAt: new Date().toISOString(),
|
||||
updatedAt: new Date().toISOString(),
|
||||
folderId: null,
|
||||
isStarred: true
|
||||
},
|
||||
{
|
||||
id: '2',
|
||||
title: '待办事项',
|
||||
content: '1. 完成项目报告\n2. 购买 groceries\n3. 预约医生\n4. 给朋友打电话',
|
||||
createdAt: new Date(Date.now() - 86400000).toISOString(), // 昨天
|
||||
updatedAt: new Date(Date.now() - 86400000).toISOString(),
|
||||
folderId: null,
|
||||
isStarred: true
|
||||
},
|
||||
{
|
||||
id: '3',
|
||||
title: '购物清单',
|
||||
content: '苹果\n牛奶\n面包\n鸡蛋\n西红柿\n咖啡',
|
||||
createdAt: new Date(Date.now() - 172800000).toISOString(), // 前天
|
||||
updatedAt: new Date(Date.now() - 172800000).toISOString(),
|
||||
folderId: null,
|
||||
isStarred: false
|
||||
},
|
||||
{
|
||||
id: '4',
|
||||
title: '项目想法',
|
||||
content: '1. 实现云同步功能\n2. 添加深色模式\n3. 支持Markdown语法\n4. 添加标签功能',
|
||||
createdAt: new Date(Date.now() - 259200000).toISOString(), // 3天前
|
||||
updatedAt: new Date(Date.now() - 259200000).toISOString(),
|
||||
folderId: null,
|
||||
isStarred: false
|
||||
},
|
||||
{
|
||||
id: '5',
|
||||
title: '读书笔记',
|
||||
content: '《Vue.js实战》\n- 组件化思想是Vue的核心\n- 理解响应式原理很重要\n- Pinia是Vue 3的推荐状态管理库',
|
||||
createdAt: new Date(Date.now() - 345600000).toISOString(), // 4天前
|
||||
updatedAt: new Date(Date.now() - 345600000).toISOString(),
|
||||
folderId: null,
|
||||
isStarred: false
|
||||
}
|
||||
];
|
||||
|
||||
// Mock folders
|
||||
const mockFolders = [
|
||||
{
|
||||
id: 'folder1',
|
||||
name: '工作',
|
||||
createdAt: new Date().toISOString()
|
||||
},
|
||||
{
|
||||
id: 'folder2',
|
||||
name: '个人',
|
||||
createdAt: new Date().toISOString()
|
||||
},
|
||||
{
|
||||
id: 'folder3',
|
||||
name: '学习',
|
||||
createdAt: new Date().toISOString()
|
||||
}
|
||||
];
|
||||
|
||||
// Mock settings
|
||||
const mockSettings = {
|
||||
cloudSync: false,
|
||||
darkMode: false
|
||||
};
|
||||
|
||||
this.notes = mockNotes;
|
||||
this.folders = mockFolders;
|
||||
this.settings = mockSettings;
|
||||
|
||||
// 保存到localStorage
|
||||
await storage.saveNotes(mockNotes);
|
||||
await storage.saveFolders(mockFolders);
|
||||
await storage.saveSettings(mockSettings);
|
||||
},
|
||||
|
||||
// 保存notes到localStorage
|
||||
async saveNotes() {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user