Pārlūkot izejas kodu

Currency Format

master
Kobus 5 gadus atpakaļ
vecāks
revīzija
79da97396e
2 mainītis faili ar 13 papildinājumiem un 6 dzēšanām
  1. 1
    6
      src/components/timeshare/buy/weekListComponent.vue
  2. 12
    0
      src/main.js

+ 1
- 6
src/components/timeshare/buy/weekListComponent.vue Parādīt failu

1
 <template>
1
 <template>
2
   <div>
2
   <div>
3
-    <button @click="addDummyWeek" class="btn btn-primary">Add Dummy</button>
4
     <table class="table table-bordered">
3
     <table class="table table-bordered">
5
       <thead>
4
       <thead>
6
         <tr>
5
         <tr>
7
           <th>Resort</th>
6
           <th>Resort</th>
8
           <th>Unit Number</th>
7
           <th>Unit Number</th>
9
           <th>Week Number</th>
8
           <th>Week Number</th>
10
-          <th>Module</th>
11
           <th>Bedrooms</th>
9
           <th>Bedrooms</th>
12
-          <th>Season</th>
13
           <th>Price</th>
10
           <th>Price</th>
14
           <th>Status</th>
11
           <th>Status</th>
15
           <th>Interested</th>
12
           <th>Interested</th>
20
           <td>{{item.resort.resortName}}</td>
17
           <td>{{item.resort.resortName}}</td>
21
           <td>{{item.unitNumber}}</td>
18
           <td>{{item.unitNumber}}</td>
22
           <td>{{item.weekNumber}}</td>
19
           <td>{{item.weekNumber}}</td>
23
-          <td>{{item.module}}</td>
24
           <td>{{item.bedrooms}}</td>
20
           <td>{{item.bedrooms}}</td>
25
-          <td>{{item.season}}</td>
26
-          <td>{{item.sellPrice}}</td>
21
+          <td>{{item.sellPrice | toCurrency}}</td>
27
           <td>{{item.status ? item.status.description : ''}}</td>
22
           <td>{{item.status ? item.status.description : ''}}</td>
28
           <td></td>
23
           <td></td>
29
         </tr>
24
         </tr>

+ 12
- 0
src/main.js Parādīt failu

8
 
8
 
9
 Vue.config.productionTip = false;
9
 Vue.config.productionTip = false;
10
 
10
 
11
+Vue.filter('toCurrency', (value) => {
12
+  if (typeof value !== 'number') {
13
+    return value;
14
+  }
15
+  const formatter = new Intl.NumberFormat('en-US', {
16
+    style: 'currency',
17
+    currency: 'ZAR',
18
+    minimumFractionDigits: 2,
19
+  });
20
+  return formatter.format(value);
21
+});
22
+
11
 new Vue({
23
 new Vue({
12
   render: h => h(App),
24
   render: h => h(App),
13
   router,
25
   router,

Notiek ielāde…
Atcelt
Saglabāt