Skip to content

Commit

Permalink
feat: use sync insteadof local
Browse files Browse the repository at this point in the history
  • Loading branch information
oeyoews committed Mar 23, 2024
1 parent a96b108 commit 9add673
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions entrypoints/popup/Popup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,15 @@ const username = ref('oeyoews')
const isCheckTw5 = ref(false)
chrome.storage.local.get('isCheckTw5', function (result) {
chrome.storage.sync.get('isCheckTw5', function (result) {
isCheckTw5.value = result.isCheckTw5
})
const inputValue = ref()
const dynamicTags = ref()
chrome.storage.local.get(['tags'], function (result) {
chrome.storage.sync.get(['tags'], function (result) {
if (result.tags) {
dynamicTags.value = Object.values(result.tags)
} else {
Expand All @@ -62,15 +61,15 @@ const showInput = () => {
const handleInputConfirm = () => {
if (inputValue.value) {
dynamicTags.value.push(inputValue.value.trim())
chrome.storage.local.set({ tags: toRaw(dynamicTags.value) })
chrome.storage.sync.set({ tags: toRaw(dynamicTags.value) })
}
inputVisible.value = false
inputValue.value = ''
}
const port = ref('')
chrome.storage.local.get(['port'], function (result) {
chrome.storage.sync.get(['port'], function (result) {
port.value = result.port || '8080'
});
Expand Down Expand Up @@ -104,18 +103,18 @@ const status = ref<{
})
watch(isCheckTw5, (newValue, oldValue) => {
chrome.storage.local.set({ isCheckTw5: newValue })
chrome.storage.sync.set({ isCheckTw5: newValue })
if (newValue) {
// ElMessage({
// message: '检测到 TiddlyWiki 5.x',
// type: 'success'
// })
} else {
ElMessage({
message: '关闭 TiddlyWiki 5.x 检测',
type: 'info'
})
// ElMessage({
// message: '关闭 TiddlyWiki 5.x 检测',
// type: 'info'
// })
}
})
Expand Down

0 comments on commit 9add673

Please sign in to comment.