Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
xxyan0205 committed Aug 3, 2019
2 parents 4b1187d + 4c7d3e3 commit 37b348e
Show file tree
Hide file tree
Showing 11 changed files with 82 additions and 3 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ cache:
branches:
only:
- master
- dev

script:
- npm test
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ title: Change Log
toc: hidden
---

### 2.4.1

`2019-08-03`

- Fix
- Fix the problem that `InputItem` cannot limit the max length of characters when using virtual keyboard input[#524](https://github.com/didi/mand-mobile/issues/524)
- Fix `Amount` with the loss of precision in animation mode

### 2.4.0

`2019-07-29`
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ title: 更新日志
toc: hidden
---

### 2.4.1

`2019-08-03`

- Fix
- 修复`InputItem`使用虚拟键盘输入时无法限制字符长度的问题[#524](https://github.com/didi/mand-mobile/issues/524)
- 修复`Amount`使用动效时数字的精度问题

### 2.4.0

`2019-07-29`
Expand Down
4 changes: 4 additions & 0 deletions components/amount/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ export default {
$_doAnimateDisplay(fromValue = 0, toValue = 0) {
/* istanbul ignore next */
const step = percent => {
if (percent === 1) {
this.formatValue = toValue
return
}
this.formatValue = fromValue + (toValue - fromValue) * percent
}
Expand Down
35 changes: 34 additions & 1 deletion components/amount/test/index.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Amount} from 'mand-mobile'
import {shallowMount} from '@vue/test-utils'
import {shallowMount, mount} from '@vue/test-utils'

describe('Amount - Operation', () => {
let wrapper
Expand All @@ -17,4 +17,37 @@ describe('Amount - Operation', () => {
})
expect(wrapper.vm.isMounted).toBe(true)
})

test('should number animation not lose precision', done => {
wrapper = mount({
template: `
<md-amount
:value="val"
:duration="1000"
transition
ref="amount"
></md-amount>
`,
components: {
[Amount.name]: Amount,
},
data() {
return {
val: 1000,
}
},
})

const instance = wrapper.vm.$refs.amount

setTimeout(() => {
expect(instance.formatValue).toBe(1000)
wrapper.vm.val = 20.66
}, 2000)

setTimeout(() => {
expect(instance.formatValue).toBe(20.66)
done()
}, 4000)
})
})
Binary file modified components/icon/iconfont.woff
Binary file not shown.
3 changes: 3 additions & 0 deletions components/input-item/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,9 @@ export default {
}
},
$_onNumberKeyBoardEnter(val) {
if (this.$_trimValue(this.inputValue).length >= this.inputMaxLength) {
return
}
this.inputValue = this.$_formateValue(this.inputValue + val).value
},
$_onNumberKeyBoardDelete() {
Expand Down
6 changes: 6 additions & 0 deletions components/input-item/test/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ describe('InputItem - Operation', () => {
propsData: {
type: 'money',
isVirtualKeyboard: true,
maxlength: 4,
},
})

Expand All @@ -102,6 +103,11 @@ describe('InputItem - Operation', () => {
keys.at(2).trigger('click')
deleteBtn.trigger('click')
expect(wrapper.vm.inputValue).toBe('2.3')
keys.at(2).trigger('click')
keys.at(2).trigger('click')
keys.at(2).trigger('click')
keys.at(2).trigger('click')
expect(wrapper.vm.inputValue).toBe('2.33')
confirmBtn.trigger('click')
expect(eventStub.calledWith('confirm')).toBe(true)
wrapper.vm.blur()
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "mand-mobile",
"version": "2.4.0",
"version": "2.4.1",
"description": "A Vue.js 2.0 Mobile UI Toolkit",
"homepage": "https://github.com/didi/mand-mobile",
"homepage": "https://didi.github.io/mand-mobile",
"main": "lib/mand-mobile.umd.js",
"style": "lib/mand-mobile.css",
"module": "lib/mand-mobile.esm.js",
Expand Down
10 changes: 10 additions & 0 deletions site/mfe.blog.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ module.exports = {
text: '主题定制',
markdown: resolve('site/docs/theme.md'),
},
{
name: 'faq',
text: '常见问题',
link: 'https://github.com/didi/mand-mobile/wiki/FAQ---%E4%B8%AD%E6%96%87',
},
// {
// name: 'preview',
// text: '组件概览',
Expand Down Expand Up @@ -199,6 +204,11 @@ module.exports = {
text: 'Custom Theme',
markdown: resolve('site/docs/theme.en-US.md'),
},
{
name: 'faq',
text: 'FAQ',
link: 'https://github.com/didi/mand-mobile/wiki/FAQ',
},
// {
// name: 'preview',
// text: 'Component Preview',
Expand Down
6 changes: 6 additions & 0 deletions site/theme/default/components/Menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,27 @@
</div>
<ul class="menu-list-0">
<li class="menu-item-0" v-for="(item0, index0) in menu" :key="index0">
<a :href="item0.link" v-if="item0.link" v-html="item0.text" target="_blank"></a>
<router-link
v-else
:to="`/${lang}/${nav}/${item0.name}`"
:class="{disabled: !item0.src && !item0.markdown}"
v-html="item0.text">
</router-link>
<ul class="menu-list-1" v-if="item0.menu">
<li class="menu-item-1" v-for="(item1, index1) in item0.menu" :key="index1">
<a :href="item1.link" v-if="item1.link" v-html="item1.text" target="_blank"></a>
<router-link
v-else
:to="`/${lang}/${nav}/${item0.name}/${item1.name}`"
:class="{disabled: !item1.src && !item1.markdown}"
v-html="item1.text">
</router-link>
<ul class="menu-list-2" v-if="item1.menu">
<li class="menu-item-2" v-for="(item2, index2) in item1.menu" :key="index2">
<a :href="item2.link" v-if="item2.link" v-html="item2.text" target="_blank"></a>
<router-link
v-else
:to="`/${lang}/${nav}/${item0.name}/${item1.name}/${item2.name}`"
:class="{disabled: !item2.src && !item2.markdown}"
v-html="item2.text">
Expand Down

0 comments on commit 37b348e

Please sign in to comment.