Skip to content
This repository was archived by the owner on Dec 31, 2024. It is now read-only.

Commit 71cadbf

Browse files
authoredMar 26, 2019
⚡ improvement(number): support data fall through in i18n-n (#545)
1 parent c09dcc1 commit 71cadbf

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed
 

‎examples/number-formatting/index.html

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
<option value="en-US">en-US</option>
1414
<option value="ja-JP">ja-JP</option>
1515
</select>
16-
<p>
17-
{{ $t('money') }}:
18-
<i18n-n :value="money" format="currency">
16+
<div class="view">
17+
<p class="label">{{ $t('money') }}:</p>
18+
<i18n-n :value="money" format="currency" tag="p" class="money">
1919
<template slot="decimal" slot-scope="props"><!-- do not render decimal separator --></template>
2020
<span slot="fraction" slot-scope="props" style="vertical-align: super">{{ props.fraction }}</span>
2121
</i18n-n>
22-
</p>
22+
</div>
2323
</div>
2424
<script>
2525
var messages = {

‎src/components/number.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ export default {
5858
return slot ? slot({ [part.type]: part.value, index, parts }) : part.value
5959
})
6060

61-
return h(props.tag, values)
61+
return h(props.tag, {
62+
attrs: data.attrs,
63+
'class': data['class'],
64+
staticClass: data.staticClass
65+
}, values)
6266
}
6367
}

‎test/e2e/test/number.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module.exports = {
2-
component: function (browser) {
2+
number: function (browser) {
33
browser
44
.url('http://localhost:8080/examples/number/')
55
.waitForElementVisible('#app', 1000)

‎test/e2e/test/number_formatting.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
module.exports = {
2-
component: function (browser) {
2+
'number_formatting': function (browser) {
33
browser
44
.url('http://localhost:8080/examples/number-formatting/')
55
.waitForElementVisible('#app', 1000)
6-
.assert.containsText('p', 'お金: ¥1,000')
6+
.assert.containsText('p.money', '¥1,000')
77
.click('select option[value=en-US]')
8-
.assert.attributeContains('p', 'innerHTML', 'Money: $1,000<span style="vertical-align: super">00</span>')
8+
.assert.attributeContains('p.money', 'innerHTML', '$1,000<span style="vertical-align: super;">00</span>')
99
.end()
1010
}
1111
}

0 commit comments

Comments
 (0)
This repository has been archived.