|
@@ -31,11 +31,12 @@ import { Component, Prop, Vue, Watch } from "vue-property-decorator";
|
|
|
export default class packing extends Vue {
|
|
|
form = {
|
|
|
userName: (this as any).$store.getters.userInfo.userName,
|
|
|
- content: "",
|
|
|
- createTime: "",
|
|
|
+ content: '',
|
|
|
+ createTime: '',
|
|
|
};
|
|
|
index = 0;
|
|
|
data: Array<any> = [];
|
|
|
+ data1: Array<any> = [];
|
|
|
saveLog() {
|
|
|
const now = new Date();
|
|
|
this.form.createTime = now.toLocaleString();
|
|
@@ -47,12 +48,25 @@ export default class packing extends Vue {
|
|
|
});
|
|
|
// const aa=this.form
|
|
|
this.index++;
|
|
|
- console.log("this.index========", this.index);
|
|
|
- // if()
|
|
|
- let from = JSON.stringify(this.form);
|
|
|
- this.data.push(JSON.parse(from));
|
|
|
- localStorage.setItem('logLsit', JSON.stringify(this.data));
|
|
|
- console.log("提交的数据========", this.data);
|
|
|
+
|
|
|
+ const datas: string | null = localStorage.getItem("logLsit");
|
|
|
+ console.log("datas========", datas);
|
|
|
+ let data1:any=[]
|
|
|
+ if (datas) {
|
|
|
+ let from = JSON.stringify(this.form);
|
|
|
+ // this.data1.push(JSON.parse(from));
|
|
|
+ // let from = JSON.stringify(this.form);
|
|
|
+ data1.push(JSON.parse(from));
|
|
|
+ let datacun = JSON.parse(datas);
|
|
|
+ this.data = data1.concat(datacun);
|
|
|
+ localStorage.setItem("logLsit", JSON.stringify(this.data));
|
|
|
+ console.log("提交的数据1========", this.data);
|
|
|
+ } else {
|
|
|
+ let from = JSON.stringify(this.form);
|
|
|
+ this.data.push(JSON.parse(from));
|
|
|
+ localStorage.setItem("logLsit", JSON.stringify(this.data));
|
|
|
+ console.log("提交的数据2========", this.data);
|
|
|
+ }
|
|
|
} else {
|
|
|
this.$message({
|
|
|
message: "输入内容不能为空!",
|