|
@@ -2,7 +2,7 @@
|
|
|
<RightFillPano>
|
|
|
<ui-group borderBottom>
|
|
|
<template #header>
|
|
|
- <ui-button @click="editTagging = createTagging()">
|
|
|
+ <ui-button @click="insertTagging">
|
|
|
<ui-icon type="add" />
|
|
|
新增
|
|
|
</ui-button>
|
|
@@ -51,7 +51,7 @@ import { Message } from 'bill/index'
|
|
|
import { RightFillPano } from '@/layout'
|
|
|
import { asyncTimeout, togetherCallback } from '@/utils'
|
|
|
import { useViewStack } from '@/hook'
|
|
|
-import { computed, nextTick, ref, watch } from 'vue';
|
|
|
+import { computed, nextTick, ref, toRaw, watch, watchEffect } from 'vue';
|
|
|
import { sdk } from '@/sdk'
|
|
|
import {
|
|
|
taggings,
|
|
@@ -81,10 +81,22 @@ import {
|
|
|
const keyword = ref('')
|
|
|
const filterTaggings = computed(() => taggings.value.filter(tagging => tagging.title.includes(keyword.value)))
|
|
|
|
|
|
+const insertTagging = () => {
|
|
|
+ editTagging.value = createTagging()
|
|
|
+ insertIng = true
|
|
|
+}
|
|
|
+
|
|
|
const editTagging = ref<Tagging | null>(null)
|
|
|
+let insertIng = false
|
|
|
+watchEffect(() => {
|
|
|
+ if (!editTagging.value) {
|
|
|
+ insertIng = false
|
|
|
+ }
|
|
|
+})
|
|
|
+
|
|
|
const saveHandler = (tagging: Tagging) => {
|
|
|
if (!editTagging.value) return;
|
|
|
- if (isTemploraryID(editTagging.value.id)) {
|
|
|
+ if (insertIng) {
|
|
|
taggings.value.push(tagging)
|
|
|
} else {
|
|
|
Object.assign(editTagging.value, tagging)
|