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. 58
      src/components/GiftedDialog.vue

58
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: {
<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() {
this.close();
this.$emit("dialog-result", {
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();
this.$emit("dialog-result", { action: "cancel" });
},
},
};
return result;
}
}
</script>
<style>

Loading…
Cancel
Save