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
kb/add-usage-guide
anomalist 1 year ago
parent
commit
49c3971cf2
  1. 58
      src/components/GiftedDialog.vue

58
src/components/GiftedDialog.vue

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

Loading…
Cancel
Save