fix date picker initial content
This commit is contained in:
@@ -124,7 +124,10 @@ const computedEnableTime = computed(() => {
|
||||
});
|
||||
|
||||
watch(initialContent, (newContent) => {
|
||||
if (typeof date.value == "undefined") {
|
||||
if (
|
||||
typeof date.value == "undefined" ||
|
||||
(typeof date.value == "string" && date.value.length == 0)
|
||||
) {
|
||||
date.value = newContent === undefined ? "" : newContent;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -162,7 +162,6 @@ import {
|
||||
restParseErrors,
|
||||
} from "../../helpers/validation";
|
||||
import { useRoute } from "vue-router";
|
||||
import { formatAusDateToUniversal } from "../../helpers/common";
|
||||
import { parseISO } from "date-fns";
|
||||
|
||||
const route = useRoute();
|
||||
|
||||
@@ -135,8 +135,11 @@ const formData = reactive({
|
||||
},
|
||||
},
|
||||
publish_at: {
|
||||
value: "",
|
||||
value: null,
|
||||
error: "",
|
||||
rules: {
|
||||
datetime: true,
|
||||
},
|
||||
},
|
||||
hero: {
|
||||
value: "",
|
||||
@@ -200,11 +203,14 @@ const loadData = async () => {
|
||||
throw new Error("The server is currently not available");
|
||||
}
|
||||
|
||||
console.log(res.data.post);
|
||||
formData.title.value = res.data.post.title;
|
||||
formData.slug.value = res.data.post.slug;
|
||||
formData.user_id.value = res.data.post.user_id;
|
||||
formData.content.value = res.data.post.content;
|
||||
formData.publish_at.value = res.data.post.publish_at;
|
||||
formData.publish_at.value = res.data.post.publish_at
|
||||
? new Date(res.data.post.publish_at)
|
||||
: "";
|
||||
formData.content.value = res.data.post.content;
|
||||
formData.hero.value = res.data.post.hero;
|
||||
} catch (err) {
|
||||
|
||||
@@ -68,6 +68,7 @@ const search = ref("");
|
||||
|
||||
const headers = [
|
||||
{ text: "Title", value: "title", sortable: true },
|
||||
{ text: "Published", value: "publish_at", sortable: true },
|
||||
{ text: "Created", value: "created_at", sortable: true },
|
||||
{ text: "Updated", value: "updated_at", sortable: true },
|
||||
{ text: "Actions", value: "actions" },
|
||||
@@ -127,6 +128,9 @@ const loadFromServer = async () => {
|
||||
if (row.updated_at !== "undefined") {
|
||||
row.updated_at = relativeDate(row.updated_at);
|
||||
}
|
||||
if (row.publish_at !== "undefined") {
|
||||
row.publish_at = relativeDate(row.publish_at);
|
||||
}
|
||||
});
|
||||
|
||||
serverItemsLength.value = res.data.total;
|
||||
|
||||
Reference in New Issue
Block a user