Browse Source

First draft of Vue3 version. WIll finish after error-logging merge

kb/add-usage-guide
Matthew Raymer 1 year ago
parent
commit
4758a740de
  1. 98
      src/components/GiftedDialog.vue

98
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() {
this.visible = false; close() {
}, this.visible = false;
increment() { }
this.hours = `${(parseFloat(this.hours) || 0) + 1}`;
}, increment() {
decrement() { this.hours = `${(parseFloat(this.hours) || 0) + 1}`;
this.hours = `${Math.max(0, (parseFloat(this.hours) || 1) - 1)}`; }
},
confirm() { decrement() {
this.close(); this.hours = `${Math.max(0, (parseFloat(this.hours) || 1) - 1)}`;
this.$emit("dialog-result", { }
action: "confirm",
giver: this.giver, @Emit("dialog-result")
hours: parseFloat(this.hours), confirm() {
description: this.description, result = {
}); action: "confirm",
this.description = ""; giver: this.giver,
this.giver = null; hours: parseFloat(this.hours),
this.hours = "0"; description: this.description,
}, };
cancel() { this.close();
this.close(); this.description = "";
this.$emit("dialog-result", { action: "cancel" }); this.giver = null;
}, this.hours = "0";
},
}; return result;
}
@Emit("dialog-result")
cancel() {
result = { action: "cancel" };
this.close();
return result;
}
}
</script> </script>
<style> <style>

Loading…
Cancel
Save