Browse Source

Merge pull request 'First draft of Vue3 version. WIll finish after error-logging merge' (#31) from gifted-dialog-conversion into master

Reviewed-on: https://gitea.anomalistdesign.com/trent_larson/kick-starter-for-time-pwa/pulls/31
pull/34/head
anomalist 1 year ago
parent
commit
49c3971cf2
  1. 98
      src/components/GiftedDialog.vue

98
src/components/GiftedDialog.vue

@ -40,50 +40,60 @@
</div>
</template>
<script>
export default {
props: ["message"],
data() {
return {
giver: null,
description: "",
hours: "0",
visible: false,
};
},
methods: {
open(giver) {
// giver: GiverInputInfo
this.giver = giver;
this.visible = true;
},
close() {
this.visible = false;
},
increment() {
this.hours = `${(parseFloat(this.hours) || 0) + 1}`;
},
decrement() {
this.hours = `${Math.max(0, (parseFloat(this.hours) || 1) - 1)}`;
},
confirm() {
this.close();
this.$emit("dialog-result", {
action: "confirm",
giver: this.giver,
hours: parseFloat(this.hours),
description: this.description,
});
this.description = "";
this.giver = null;
this.hours = "0";
},
cancel() {
this.close();
this.$emit("dialog-result", { action: "cancel" });
},
},
};
<script lang="ts">
import {Vue, Component, Prop, Emit} from "vue-facing-decorator";
@Component
export default class GiftedDialog extends Vue {
@Prop message = "";
giver = null;
description = "";
hours = "0";
visible = false;
open(giver) {
// giver: GiverInputInfo
this.giver = giver;
this.visible = true;
}
close() {
this.visible = false;
}
increment() {
this.hours = `${(parseFloat(this.hours) || 0) + 1}`;
}
decrement() {
this.hours = `${Math.max(0, (parseFloat(this.hours) || 1) - 1)}`;
}
@Emit("dialog-result")
confirm() {
result = {
action: "confirm",
giver: this.giver,
hours: parseFloat(this.hours),
description: this.description,
};
this.close();
this.description = "";
this.giver = null;
this.hours = "0";
return result;
}
@Emit("dialog-result")
cancel() {
result = { action: "cancel" };
this.close();
return result;
}
}
</script>
<style>

Loading…
Cancel
Save