From d1bc9711ddc4ea08d2af04bb31e35f2785ab9317 Mon Sep 17 00:00:00 2001 From: "Joe L. Wroten" Date: Sun, 1 Nov 2015 23:21:51 -0600 Subject: [PATCH] Hooked up roman computed property to stubbed function --- README.md | 4 +++- app.js | 20 ++++++++++++++++++++ index.html | 2 +- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 798a6df..6f51217 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ -# roman-numeral-calculator +# Roman Numeral Calculator Whole number calculator that also displays the results in Roman Numerals. +Utilizes Vue and Bootstrap Material Design. + --- ## Getting Started diff --git a/app.js b/app.js index 236e7e5..e0d47a9 100644 --- a/app.js +++ b/app.js @@ -1,4 +1,7 @@ +/** + * Vue Application Code + */ var App = new Vue({ el: '#calculator', // Context for 'data' usage data: { @@ -6,6 +9,11 @@ var App = new Vue({ previousResult: NaN, calculation: '' // String that'll hold our calculation, such as '6+4/2*2' }, + computed: { + resultRoman: function() { + return this.previousResult ? intToRoman(this.previousResult) : ''; + } + }, methods: { // Resets all of our values clear: function() { @@ -43,6 +51,18 @@ var App = new Vue({ } }); +/** + * Converts Integer to Roman Numerals + * @param {[number]} n [whole number to be converted] + * @return {[string]} [roman numeral conversion of provided whole number] + */ +function intToRoman(n) { + return n + 'TODO'; +} + +/** + * Page Load Initializers and Bindings + */ $(document).ready(function() { // This command is used to initialize some elements and make them work properly $.material.init(); diff --git a/index.html b/index.html index 6dc47db..c569237 100644 --- a/index.html +++ b/index.html @@ -34,7 +34,7 @@ Roman Numerals

{{ result }}

-

IV

+

{{ resultRoman }}