mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
Merge branch 'dev' into hotfix/fix-sku-err-toast
This commit is contained in:
commit
1199e3c088
@ -69,6 +69,7 @@ Use `tag` prop to custom button tag
|
|||||||
|-----------|-----------|-----------|-------------|-------------|
|
|-----------|-----------|-----------|-------------|-------------|
|
||||||
| type | Type | `String` | `default` | `primary` `danger` |
|
| type | Type | `String` | `default` | `primary` `danger` |
|
||||||
| size | Size | `String` | `normal` | `large` `small` `mini` |
|
| size | Size | `String` | `normal` | `large` `small` `mini` |
|
||||||
|
| text | Text | `String` | - | - |
|
||||||
| tag | Tag | `String` | `button` | - |
|
| tag | Tag | `String` | `button` | - |
|
||||||
| native-type | Native Type Attribute | `String` | `''` | - |
|
| native-type | Native Type Attribute | `String` | `''` | - |
|
||||||
| disabled | Whether disable button | `Boolean` | `false` | - |
|
| disabled | Whether disable button | `Boolean` | `false` | - |
|
||||||
|
@ -1,5 +1,35 @@
|
|||||||
## Changelog
|
## Changelog
|
||||||
|
|
||||||
|
|
||||||
|
### [0.12.5](https://github.com/youzan/vant/tree/v0.12.5)
|
||||||
|
`2018-01-23`
|
||||||
|
|
||||||
|
**Improvements**
|
||||||
|
|
||||||
|
* Button: add text prop [\#563](https://github.com/youzan/vant/pull/563) [@chenjiahan](https://github.com/chenjiahan)
|
||||||
|
* CouponList: support v-model、exchangeButtonLoading、exchangeMinLength [\#556](https://github.com/youzan/vant/pull/556) [\#566](https://github.com/youzan/vant/pull/566) [@chenjiahan](https://github.com/chenjiahan)
|
||||||
|
* Icon: update share icon [\#562](https://github.com/youzan/vant/pull/562) [@chenjiahan](https://github.com/chenjiahan)
|
||||||
|
* Sku: improve render performance [\#550](https://github.com/youzan/vant/pull/550) [@chenjiahan](https://github.com/chenjiahan)
|
||||||
|
|
||||||
|
**Bug Fixes**
|
||||||
|
* Area: should not display city & county list when not select province [\#560](https://github.com/youzan/vant/pull/560) [@chenjiahan](https://github.com/chenjiahan)
|
||||||
|
* Cell: fix required style [\#553](https://github.com/youzan/vant/pull/553) [@qianzhaoy](https://github.com/qianzhaoy)
|
||||||
|
|
||||||
|
|
||||||
|
### [0.12.4](https://github.com/youzan/vant/tree/v0.12.4)
|
||||||
|
`2018-01-18`
|
||||||
|
|
||||||
|
**Improvements**
|
||||||
|
|
||||||
|
* Picker: add props to custom button text [\#548](https://github.com/youzan/vant/pull/548) [@chenjiahan](https://github.com/chenjiahan)
|
||||||
|
* Toast: add setDefaultOptions method [\#541](https://github.com/youzan/vant/pull/541) [@chenjiahan](https://github.com/chenjiahan)
|
||||||
|
* Dialog: add setDefaultOptions method [\#539](https://github.com/youzan/vant/pull/539) [@chenjiahan](https://github.com/chenjiahan)
|
||||||
|
|
||||||
|
**Bug Fixes**
|
||||||
|
|
||||||
|
* Stepper: not fire event on changing the value prop [\#546](https://github.com/youzan/vant/pull/546) [@chuangbo](https://github.com/chuangbo)
|
||||||
|
* Picker: fix misspelling of visibleItemCount prop [\#549](https://github.com/youzan/vant/pull/549) [@chenjiahan](https://github.com/chenjiahan)
|
||||||
|
|
||||||
### [0.12.3](https://github.com/youzan/vant/tree/v0.12.3)
|
### [0.12.3](https://github.com/youzan/vant/tree/v0.12.3)
|
||||||
|
|
||||||
`2018-01-12`
|
`2018-01-12`
|
||||||
|
@ -79,11 +79,14 @@ export default {
|
|||||||
|
|
||||||
| Attribute | Description | Type | Default | Accepted Values |
|
| Attribute | Description | Type | Default | Accepted Values |
|
||||||
|-----------|-----------|-----------|-------------|-------------|
|
|-----------|-----------|-----------|-------------|-------------|
|
||||||
|
| v-model | Current exchange code | `String` | - | - |
|
||||||
| chosen-coupon | Index of chosen coupon | `Number` | `-1` | - |
|
| chosen-coupon | Index of chosen coupon | `Number` | `-1` | - |
|
||||||
| coupons | Coupon list | `Array` | `[]` | - |
|
| coupons | Coupon list | `Array` | `[]` | - |
|
||||||
| disabled-coupons | Disabled voupon list | `Array` | `[]` | - |
|
| disabled-coupons | Disabled voupon list | `Array` | `[]` | - |
|
||||||
| exchange-button-text | Exchange button text | `String` | `Exchange` | - |
|
| exchange-button-text | Exchange button text | `String` | `Exchange` | - |
|
||||||
|
| exchange-button-loading | Whether to show loading in exchange button | `Boolean` | `false` | - |
|
||||||
| exchange-button-disabled | Whether to disable exchange button | `Boolean` | `false` | - |
|
| exchange-button-disabled | Whether to disable exchange button | `Boolean` | `false` | - |
|
||||||
|
| exchange-min-length | Min length to enable exchange button | `Number` | `1` | - |
|
||||||
| displayed-coupon-index | Index of displayed coupon | `Number` | - | - |
|
| displayed-coupon-index | Index of displayed coupon | `Number` | - | - |
|
||||||
| close-button-text | Close button text | `String` | `Close` | - |
|
| close-button-text | Close button text | `String` | `Close` | - |
|
||||||
| disabled-list-title | Disabled list title | `String` | `Unavailable` | - |
|
| disabled-list-title | Disabled list title | `String` | `Unavailable` | - |
|
||||||
|
@ -73,8 +73,9 @@ Vue.use(Button);
|
|||||||
|-----------|-----------|-----------|-------------|-------------|
|
|-----------|-----------|-----------|-------------|-------------|
|
||||||
| type | 按钮类型 | `String` | `default` | `primary` `danger` |
|
| type | 按钮类型 | `String` | `default` | `primary` `danger` |
|
||||||
| size | 按钮尺寸 | `String` | `normal` | `large` `small` `mini` |
|
| size | 按钮尺寸 | `String` | `normal` | `large` `small` `mini` |
|
||||||
|
| text | 按钮文字 | `String` | - | - |
|
||||||
| tag | 按钮标签 | `String` | `button` | 任意`HTML`标签 |
|
| tag | 按钮标签 | `String` | `button` | 任意`HTML`标签 |
|
||||||
| native-type | 按钮类型(原生) | `String` | `''` | - |
|
| native-type | 按钮类型(原生) | `String` | - | - |
|
||||||
| disabled | 是否禁用 | `Boolean` | `false` | - |
|
| disabled | 是否禁用 | `Boolean` | `false` | - |
|
||||||
| loading | 是否显示为加载状态 | `Boolean` | `false` | - |
|
| loading | 是否显示为加载状态 | `Boolean` | `false` | - |
|
||||||
| block | 是否为块级元素 | `Boolean` | `false` | - |
|
| block | 是否为块级元素 | `Boolean` | `false` | - |
|
||||||
|
@ -1,5 +1,55 @@
|
|||||||
## 更新日志
|
## 更新日志
|
||||||
|
|
||||||
|
## [v0.12.5](https://github.com/youzan/vant/tree/v0.12.5) (2018-01-23)
|
||||||
|
[Full Changelog](https://github.com/youzan/vant/compare/v0.12.4...v0.12.5)
|
||||||
|
|
||||||
|
**Issue**
|
||||||
|
|
||||||
|
- ssr项目使用时css加载错误 [\#561](https://github.com/youzan/vant/issues/561)
|
||||||
|
- css加载报错 [\#559](https://github.com/youzan/vant/issues/559)
|
||||||
|
- tabbar的active手动设置不生效 [\#558](https://github.com/youzan/vant/issues/558)
|
||||||
|
- 页面手动刷新 tabbar 会 回到起始路由页面对应的 active icon [\#557](https://github.com/youzan/vant/issues/557)
|
||||||
|
- 轮播图van-swipe 懒加载图片v-lazy 使用报错Failed to resolve directive: lazy [\#554](https://github.com/youzan/vant/issues/554)
|
||||||
|
- ssr 使用 babel-plugin-import报错 [\#552](https://github.com/youzan/vant/issues/552)
|
||||||
|
- stepper如何放到cell里面? [\#551](https://github.com/youzan/vant/issues/551)
|
||||||
|
- DatetimePicker设置每一列可见元素个数visibile-column-count失效 [\#547](https://github.com/youzan/vant/issues/547)
|
||||||
|
- Toast 和 Dialog 增加全局参数配置 [\#538](https://github.com/youzan/vant/issues/538)
|
||||||
|
- picker 组件文档 [\#537](https://github.com/youzan/vant/issues/537)
|
||||||
|
|
||||||
|
**Improvements**
|
||||||
|
|
||||||
|
- \[Improvement\] CouponList: support v-model & exchangeButtonLoading [\#566](https://github.com/youzan/vant/pull/566) ([chenjiahan](https://github.com/chenjiahan))
|
||||||
|
- \[Improvement\] update dependencies [\#565](https://github.com/youzan/vant/pull/565) ([chenjiahan](https://github.com/chenjiahan))
|
||||||
|
- \[Improvement\] Button: add text prop [\#563](https://github.com/youzan/vant/pull/563) ([chenjiahan](https://github.com/chenjiahan))
|
||||||
|
- \[Improvement\] Icon: update share icon [\#562](https://github.com/youzan/vant/pull/562) ([chenjiahan](https://github.com/chenjiahan))
|
||||||
|
- \[bugfix\] Area: should not display city & county list when not select province [\#560](https://github.com/youzan/vant/pull/560) ([chenjiahan](https://github.com/chenjiahan))
|
||||||
|
- \[Improvement\] CouponList: add exchangeMinLength prop [\#556](https://github.com/youzan/vant/pull/556) ([chenjiahan](https://github.com/chenjiahan))
|
||||||
|
- \[bugfix\] Cell: fix required style [\#553](https://github.com/youzan/vant/pull/553) ([qianzhaoy](https://github.com/qianzhaoy))
|
||||||
|
- \[Improvement\] Sku: improve render performance [\#550](https://github.com/youzan/vant/pull/550) ([chenjiahan](https://github.com/chenjiahan))
|
||||||
|
|
||||||
|
## [v0.12.4](https://github.com/youzan/vant/tree/v0.12.4) (2018-01-18)
|
||||||
|
[Full Changelog](https://github.com/youzan/vant/compare/v0.12.3...v0.12.4)
|
||||||
|
|
||||||
|
**Issue**
|
||||||
|
|
||||||
|
- \[Stepper\]: should not fire the events on changing the value prop [\#545](https://github.com/youzan/vant/issues/545)
|
||||||
|
- 有关vant导入所有组件用法示例异常 [\#543](https://github.com/youzan/vant/issues/543)
|
||||||
|
- 密码输入框组件与数字键盘组件报错 [\#542](https://github.com/youzan/vant/issues/542)
|
||||||
|
- ImagePreview 组件文档 [\#540](https://github.com/youzan/vant/issues/540)
|
||||||
|
- 官网文档 Button组件API "disabled" 拼写错误 [\#536](https://github.com/youzan/vant/issues/536)
|
||||||
|
- TabBar切换颜色没有加深 [\#535](https://github.com/youzan/vant/issues/535)
|
||||||
|
- 问一个swipe的问题?为什么写了img 写上了v-lazy 没效果 [\#534](https://github.com/youzan/vant/issues/534)
|
||||||
|
- checkbox的全选取消的问题 [\#533](https://github.com/youzan/vant/issues/533)
|
||||||
|
|
||||||
|
**Improvements**
|
||||||
|
|
||||||
|
- \[bugfix\] Picker: misspelling of visibleItemCount [\#549](https://github.com/youzan/vant/pull/549) ([chenjiahan](https://github.com/chenjiahan))
|
||||||
|
- \[Improvement\] Picker: add props to custom button text [\#548](https://github.com/youzan/vant/pull/548) ([chenjiahan](https://github.com/chenjiahan))
|
||||||
|
- \[bug fix\] Stepper: not fire event on changing the value prop [\#546](https://github.com/youzan/vant/pull/546) ([chuangbo](https://github.com/chuangbo))
|
||||||
|
- \[Doc\] fix misspelling of NumberKeyboard [\#544](https://github.com/youzan/vant/pull/544) ([chenjiahan](https://github.com/chenjiahan))
|
||||||
|
- \[Improvement\] Toast: add setDefaultOptions method [\#541](https://github.com/youzan/vant/pull/541) ([chenjiahan](https://github.com/chenjiahan))
|
||||||
|
- \[Improvement\] Dialog: add setDefaultOptions method [\#539](https://github.com/youzan/vant/pull/539) ([chenjiahan](https://github.com/chenjiahan))
|
||||||
|
|
||||||
## [v0.12.3](https://github.com/youzan/vant/tree/v0.12.3) (2018-01-12)
|
## [v0.12.3](https://github.com/youzan/vant/tree/v0.12.3) (2018-01-12)
|
||||||
[Full Changelog](https://github.com/youzan/vant/compare/v0.12.2...v0.12.3)
|
[Full Changelog](https://github.com/youzan/vant/compare/v0.12.2...v0.12.3)
|
||||||
|
|
||||||
|
@ -1,5 +1,34 @@
|
|||||||
## 更新日志
|
## 更新日志
|
||||||
|
|
||||||
|
### [0.12.5](https://github.com/youzan/vant/tree/v0.12.5)
|
||||||
|
`2018-01-23`
|
||||||
|
|
||||||
|
**Improvements**
|
||||||
|
|
||||||
|
* Button: 新增 text 属性 [\#563](https://github.com/youzan/vant/pull/563) [@chenjiahan](https://github.com/chenjiahan)
|
||||||
|
* CouponList: 支持 v-model、exchangeButtonLoading、exchangeMinLength [\#556](https://github.com/youzan/vant/pull/556) [\#566](https://github.com/youzan/vant/pull/566) [@chenjiahan](https://github.com/chenjiahan)
|
||||||
|
* Icon: 更新 share 图标 [\#562](https://github.com/youzan/vant/pull/562) [@chenjiahan](https://github.com/chenjiahan)
|
||||||
|
* Sku: 优化渲染性能 [\#550](https://github.com/youzan/vant/pull/550) [@chenjiahan](https://github.com/chenjiahan)
|
||||||
|
|
||||||
|
**Bug Fixes**
|
||||||
|
* Area: 修复未选中省份时市区展示错误的问题 [\#560](https://github.com/youzan/vant/pull/560) [@chenjiahan](https://github.com/chenjiahan)
|
||||||
|
* Cell: 修复 required 样式错误的问题 [\#553](https://github.com/youzan/vant/pull/553) [@qianzhaoy](https://github.com/qianzhaoy)
|
||||||
|
|
||||||
|
|
||||||
|
### [0.12.4](https://github.com/youzan/vant/tree/v0.12.4)
|
||||||
|
`2018-01-18`
|
||||||
|
|
||||||
|
**Improvements**
|
||||||
|
|
||||||
|
* Picker: 新增 confirmButtonText、cancelButtonText 属性 [\#548](https://github.com/youzan/vant/pull/548) [@chenjiahan](https://github.com/chenjiahan)
|
||||||
|
* Toast: 新增 setDefaultOptions 方法 [\#541](https://github.com/youzan/vant/pull/541) [@chenjiahan](https://github.com/chenjiahan)
|
||||||
|
* Dialog: 新增 setDefaultOptions 方法 [\#539](https://github.com/youzan/vant/pull/539) [@chenjiahan](https://github.com/chenjiahan)
|
||||||
|
|
||||||
|
**Bug Fixes**
|
||||||
|
|
||||||
|
* Stepper: 修改 value 值时不触发 change 事件 [\#546](https://github.com/youzan/vant/pull/546) [@chuangbo](https://github.com/chuangbo)
|
||||||
|
* Picker: 修复 visibleItemCount 属性拼写错误 [\#549](https://github.com/youzan/vant/pull/549) [@chenjiahan](https://github.com/chenjiahan)
|
||||||
|
|
||||||
### [0.12.3](https://github.com/youzan/vant/tree/v0.12.3)
|
### [0.12.3](https://github.com/youzan/vant/tree/v0.12.3)
|
||||||
|
|
||||||
`2018-01-12`
|
`2018-01-12`
|
||||||
|
@ -69,7 +69,7 @@ export default {
|
|||||||
|
|
||||||
### CouponCell API
|
### CouponCell API
|
||||||
|
|
||||||
| 参数 | 说明 | 类型 | 默认值 | 必须 |
|
| 参数 | 说明 | 类型 | 默认值 | 可选值 |
|
||||||
|-----------|-----------|-----------|-------------|-------------|
|
|-----------|-----------|-----------|-------------|-------------|
|
||||||
| title | 单元格标题 | `String` | `优惠券码` | - |
|
| title | 单元格标题 | `String` | `优惠券码` | - |
|
||||||
| chosen-coupon | 当前选中优惠券的索引 | `Number` | `-1` | - |
|
| chosen-coupon | 当前选中优惠券的索引 | `Number` | `-1` | - |
|
||||||
@ -78,13 +78,16 @@ export default {
|
|||||||
|
|
||||||
### CouponList API
|
### CouponList API
|
||||||
|
|
||||||
| 参数 | 说明 | 类型 | 默认值 | 必须 |
|
| 参数 | 说明 | 类型 | 默认值 | 可选值 |
|
||||||
|-----------|-----------|-----------|-------------|-------------|
|
|-----------|-----------|-----------|-------------|-------------|
|
||||||
|
| v-model | 当前输入的兑换码 | `String` | - | - |
|
||||||
| chosen-coupon | 当前选中优惠券的索引 | `Number` | `-1` | - |
|
| chosen-coupon | 当前选中优惠券的索引 | `Number` | `-1` | - |
|
||||||
| coupons | 可用优惠券列表 | `Array` | `[]` | - |
|
| coupons | 可用优惠券列表 | `Array` | `[]` | - |
|
||||||
| disabled-doupons | 不可用优惠券列表 | `Array` | `[]` | - |
|
| disabled-doupons | 不可用优惠券列表 | `Array` | `[]` | - |
|
||||||
| exchange-button-text | 兑换按钮文字 | `String` | `兑换` | - |
|
| exchange-button-text | 兑换按钮文字 | `String` | `兑换` | - |
|
||||||
|
| exchange-button-loading | 是否在兑换按钮上显示加载动画 | `Boolean` | `false` | - |
|
||||||
| exchange-button-disabled | 是否禁用兑换按钮 | `Boolean` | `false` | - |
|
| exchange-button-disabled | 是否禁用兑换按钮 | `Boolean` | `false` | - |
|
||||||
|
| exchange-min-length | 兑换码最小长度 | `Number` | `1` | - |
|
||||||
| displayed-coupon-index | 滚动至特定优惠券位置 | `Number` | - | - |
|
| displayed-coupon-index | 滚动至特定优惠券位置 | `Number` | - | - |
|
||||||
| show-close-button | 是否显示列表底部按钮 | `Boolean` | `true` | - |
|
| show-close-button | 是否显示列表底部按钮 | `Boolean` | `true` | - |
|
||||||
| close-button-text | 列表底部按钮文字 | `String` | `不使用优惠` | - |
|
| close-button-text | 列表底部按钮文字 | `String` | `不使用优惠` | - |
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
||||||
<link rel="shortcut icon" href="https://img.yzcdn.cn/zanui/vant/vant-2017-12-18.ico">
|
<link rel="shortcut icon" href="https://img.yzcdn.cn/zanui/vant/vant-2017-12-18.ico">
|
||||||
<title>Vant - 有赞移动端 Vue 组件库</title>
|
<title>Vant - 有赞移动端 Vue 组件库</title>
|
||||||
|
<script>window.Promise || document.write('<script src="//b.yzcdn.cn/huiyi/build/h5/js/pinkie.min.js"><\/script>');</script>
|
||||||
</head>
|
</head>
|
||||||
<body ontouchstart>
|
<body ontouchstart>
|
||||||
|
|
||||||
|
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "vant",
|
"name": "vant",
|
||||||
"version": "0.12.4",
|
"version": "0.12.5",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
24
package.json
24
package.json
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "vant",
|
"name": "vant",
|
||||||
"version": "0.12.4",
|
"version": "0.12.5",
|
||||||
"description": "A Vue.js 2.0 Mobile UI at YouZan",
|
"description": "A Vue.js 2.0 Mobile UI at YouZan",
|
||||||
"main": "lib/vant.js",
|
"main": "lib/vant.js",
|
||||||
"style": "lib/vant-css/index.css",
|
"style": "lib/vant-css/index.css",
|
||||||
@ -50,7 +50,7 @@
|
|||||||
"vue": ">= 2.5.0"
|
"vue": ">= 2.5.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"autoprefixer": "^7.2.4",
|
"autoprefixer": "^7.2.5",
|
||||||
"avoriaz": "2.0.0",
|
"avoriaz": "2.0.0",
|
||||||
"babel-cli": "^6.26.0",
|
"babel-cli": "^6.26.0",
|
||||||
"babel-core": "^6.26.0",
|
"babel-core": "^6.26.0",
|
||||||
@ -63,10 +63,10 @@
|
|||||||
"chai": "^4.1.2",
|
"chai": "^4.1.2",
|
||||||
"codecov": "^3.0.0",
|
"codecov": "^3.0.0",
|
||||||
"cross-env": "^5.1.3",
|
"cross-env": "^5.1.3",
|
||||||
"css-loader": "^0.28.8",
|
"css-loader": "^0.28.9",
|
||||||
"dependency-tree": "^5.12.0",
|
"dependency-tree": "^6.0.0",
|
||||||
"eslint": "^4.15.0",
|
"eslint": "^4.16.0",
|
||||||
"eslint-plugin-vue": "^4.1.0",
|
"eslint-plugin-vue": "^4.2.0",
|
||||||
"extract-text-webpack-plugin": "3.0.2",
|
"extract-text-webpack-plugin": "3.0.2",
|
||||||
"fast-vue-md-loader": "^1.0.3",
|
"fast-vue-md-loader": "^1.0.3",
|
||||||
"friendly-errors-webpack-plugin": "^1.6.1",
|
"friendly-errors-webpack-plugin": "^1.6.1",
|
||||||
@ -89,23 +89,23 @@
|
|||||||
"precss": "2.0.0",
|
"precss": "2.0.0",
|
||||||
"progress-bar-webpack-plugin": "^1.10.0",
|
"progress-bar-webpack-plugin": "^1.10.0",
|
||||||
"rimraf": "^2.5.4",
|
"rimraf": "^2.5.4",
|
||||||
"shelljs": "^0.7.8",
|
"shelljs": "^0.8.1",
|
||||||
"sinon": "^2.4.1",
|
"sinon": "^2.4.1",
|
||||||
"sinon-chai": "^2.12.0",
|
"sinon-chai": "^2.12.0",
|
||||||
"style-loader": "^0.19.1",
|
"style-loader": "^0.19.1",
|
||||||
"uppercamelcase": "^3.0.0",
|
"uppercamelcase": "^3.0.0",
|
||||||
"url-loader": "^0.6.2",
|
"url-loader": "^0.6.2",
|
||||||
"vant-doc": "1.0.1",
|
"vant-doc": "1.0.2",
|
||||||
"vue": "^2.5.13",
|
"vue": "^2.5.13",
|
||||||
"vue-loader": "^13.6.2",
|
"vue-loader": "^13.7.0",
|
||||||
"vue-router": "^3.0.1",
|
"vue-router": "^3.0.1",
|
||||||
"vue-sfc-compiler": "^0.0.7",
|
"vue-sfc-compiler": "^0.0.8",
|
||||||
"vue-style-loader": "^3.0.0",
|
"vue-style-loader": "^3.0.0",
|
||||||
"vue-template-compiler": "^2.5.13",
|
"vue-template-compiler": "^2.5.13",
|
||||||
"vue-template-es2015-compiler": "^1.6.0",
|
"vue-template-es2015-compiler": "^1.6.0",
|
||||||
"webpack": "^3.10.0",
|
"webpack": "^3.10.0",
|
||||||
"webpack-bundle-analyzer": "^2.9.1",
|
"webpack-bundle-analyzer": "^2.9.2",
|
||||||
"webpack-dev-server": "2.9.7",
|
"webpack-dev-server": "2.11.1",
|
||||||
"webpack-merge": "^4.1.1"
|
"webpack-merge": "^4.1.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -94,23 +94,23 @@ export default create({
|
|||||||
|
|
||||||
// 根据省市县类型和对应的`code`获取对应列表
|
// 根据省市县类型和对应的`code`获取对应列表
|
||||||
getList(type, code) {
|
getList(type, code) {
|
||||||
if (!this.listValid) {
|
let result = [];
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
const { areaList } = this;
|
if (this.listValid && (type === 'province' || code)) {
|
||||||
const list =
|
const { areaList } = this;
|
||||||
type === 'province'
|
const list =
|
||||||
? areaList.province_list
|
type === 'province'
|
||||||
: type === 'city' ? areaList.city_list : areaList.county_list;
|
? areaList.province_list
|
||||||
|
: type === 'city' ? areaList.city_list : areaList.county_list;
|
||||||
|
|
||||||
let result = Object.keys(list).map(code => ({
|
result = Object.keys(list).map(code => ({
|
||||||
code,
|
code,
|
||||||
name: list[code]
|
name: list[code]
|
||||||
}));
|
}));
|
||||||
|
|
||||||
if (type !== 'province' && code) {
|
if (type !== 'province' && code) {
|
||||||
result = result.filter(item => item.code.indexOf(code) === 0);
|
result = result.filter(item => item.code.indexOf(code) === 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
result.unshift({
|
result.unshift({
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
:color="type === 'default' ? 'black' : 'white'"
|
:color="type === 'default' ? 'black' : 'white'"
|
||||||
/>
|
/>
|
||||||
<span class="van-button__text">
|
<span class="van-button__text">
|
||||||
<slot />
|
<slot>{{ text }}</slot>
|
||||||
</span>
|
</span>
|
||||||
</component>
|
</component>
|
||||||
</template>
|
</template>
|
||||||
@ -35,6 +35,7 @@ export default create({
|
|||||||
name: 'van-button',
|
name: 'van-button',
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
|
text: String,
|
||||||
block: Boolean,
|
block: Boolean,
|
||||||
loading: Boolean,
|
loading: Boolean,
|
||||||
disabled: Boolean,
|
disabled: Boolean,
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<cell-group class="van-coupon-list__top" v-if="showExchangeBar">
|
<cell-group class="van-coupon-list__top" v-if="showExchangeBar">
|
||||||
<field
|
<field
|
||||||
class="van-coupon-list__filed van-hairline--surround"
|
class="van-coupon-list__filed van-hairline--surround"
|
||||||
v-model="exchangeCode"
|
v-model="currentCode"
|
||||||
:placeholder="inputPlaceholder || $t('placeholder')"
|
:placeholder="inputPlaceholder || $t('placeholder')"
|
||||||
:maxlength="20"
|
:maxlength="20"
|
||||||
/>
|
/>
|
||||||
@ -11,11 +11,11 @@
|
|||||||
size="small"
|
size="small"
|
||||||
type="danger"
|
type="danger"
|
||||||
class="van-coupon-list__exchange"
|
class="van-coupon-list__exchange"
|
||||||
:disabled="exchangeButtonDisabled || !exchangeCode.length"
|
:text="exchangeButtonText || $t('exchange')"
|
||||||
|
:loading="exchangeButtonLoading"
|
||||||
|
:disabled="buttonDisabled"
|
||||||
@click="onClickExchangeButton"
|
@click="onClickExchangeButton"
|
||||||
>
|
/>
|
||||||
{{ exchangeButtonText || $t('exchange') }}
|
|
||||||
</van-button>
|
|
||||||
</cell-group>
|
</cell-group>
|
||||||
<div class="van-coupon-list__list" :class="{ 'van-coupon-list--with-exchange': showExchangeBar }" ref="list">
|
<div class="van-coupon-list__list" :class="{ 'van-coupon-list--with-exchange': showExchangeBar }" ref="list">
|
||||||
<coupon-item
|
<coupon-item
|
||||||
@ -24,7 +24,7 @@
|
|||||||
:key="item.id || item.name"
|
:key="item.id || item.name"
|
||||||
:data="item"
|
:data="item"
|
||||||
:chosen="index === chosenCoupon"
|
:chosen="index === chosenCoupon"
|
||||||
@click.native="onClickCoupon(index)"
|
@click.native="$emit('change', index)"
|
||||||
/>
|
/>
|
||||||
<h3 v-if="disabledCoupons.length">{{ disabledListTitle || $t('disabled') }}</h3>
|
<h3 v-if="disabledCoupons.length">{{ disabledListTitle || $t('disabled') }}</h3>
|
||||||
<coupon-item
|
<coupon-item
|
||||||
@ -40,11 +40,10 @@
|
|||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
v-show="showCloseButton"
|
v-show="showCloseButton"
|
||||||
|
v-text="closeButtonText || $t('close')"
|
||||||
class="van-coupon-list__close van-hairline--top"
|
class="van-coupon-list__close van-hairline--top"
|
||||||
@click="onClickNotUse"
|
@click="$emit('change', -1)"
|
||||||
>
|
/>
|
||||||
{{ closeButtonText || $t('close') }}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -69,11 +68,22 @@ export default create({
|
|||||||
CouponItem
|
CouponItem
|
||||||
},
|
},
|
||||||
|
|
||||||
|
model: {
|
||||||
|
prop: 'code'
|
||||||
|
},
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
|
code: String,
|
||||||
closeButtonText: String,
|
closeButtonText: String,
|
||||||
inputPlaceholder: String,
|
inputPlaceholder: String,
|
||||||
disabledListTitle: String,
|
disabledListTitle: String,
|
||||||
exchangeButtonText: String,
|
exchangeButtonText: String,
|
||||||
|
exchangeButtonLoading: Boolean,
|
||||||
|
exchangeButtonDisabled: Boolean,
|
||||||
|
exchangeMinLength: {
|
||||||
|
type: Number,
|
||||||
|
default: 1
|
||||||
|
},
|
||||||
chosenCoupon: {
|
chosenCoupon: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: -1
|
default: -1
|
||||||
@ -86,10 +96,6 @@ export default create({
|
|||||||
type: Array,
|
type: Array,
|
||||||
default: () => []
|
default: () => []
|
||||||
},
|
},
|
||||||
exchangeButtonDisabled: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false
|
|
||||||
},
|
|
||||||
displayedCouponIndex: {
|
displayedCouponIndex: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: -1
|
default: -1
|
||||||
@ -104,16 +110,34 @@ export default create({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
watch: {
|
data() {
|
||||||
displayedCouponIndex(val) {
|
return {
|
||||||
this.scrollToShowCoupon(val);
|
currentCode: this.code || ''
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
buttonDisabled() {
|
||||||
|
return (
|
||||||
|
!this.exchangeButtonLoading &&
|
||||||
|
(this.exchangeButtonDisabled ||
|
||||||
|
this.currentCode.length < this.exchangeMinLength)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
data() {
|
watch: {
|
||||||
return {
|
code(code) {
|
||||||
exchangeCode: ''
|
this.currentCode = code;
|
||||||
};
|
},
|
||||||
|
|
||||||
|
currentCode(code) {
|
||||||
|
this.$emit('input', code);
|
||||||
|
},
|
||||||
|
|
||||||
|
displayedCouponIndex(val) {
|
||||||
|
this.scrollToShowCoupon(val);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
@ -121,17 +145,16 @@ export default create({
|
|||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
onClickNotUse() {
|
|
||||||
this.$emit('change', -1);
|
|
||||||
},
|
|
||||||
onClickCoupon(index) {
|
|
||||||
this.$emit('change', index);
|
|
||||||
},
|
|
||||||
onClickExchangeButton() {
|
onClickExchangeButton() {
|
||||||
this.$emit('exchange', this.exchangeCode);
|
this.$emit('exchange', this.currentCode);
|
||||||
this.exchangeCode = '';
|
|
||||||
|
// auto clear currentCode when not use v-model
|
||||||
|
if (!this.code) {
|
||||||
|
this.currentCode = '';
|
||||||
|
}
|
||||||
},
|
},
|
||||||
// 滚动到特定优惠券的位置
|
|
||||||
|
// scroll to show specific coupon
|
||||||
scrollToShowCoupon(index) {
|
scrollToShowCoupon(index) {
|
||||||
if (index === -1) {
|
if (index === -1) {
|
||||||
return;
|
return;
|
||||||
|
@ -50,14 +50,11 @@ export default create({
|
|||||||
callback: Function,
|
callback: Function,
|
||||||
confirmButtonText: String,
|
confirmButtonText: String,
|
||||||
cancelButtonText: String,
|
cancelButtonText: String,
|
||||||
|
showCancelButton: Boolean,
|
||||||
showConfirmButton: {
|
showConfirmButton: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true
|
default: true
|
||||||
},
|
},
|
||||||
showCancelButton: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false
|
|
||||||
},
|
|
||||||
overlay: {
|
overlay: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true
|
default: true
|
||||||
|
@ -62,7 +62,7 @@ import TreeSelect from './tree-select';
|
|||||||
import Uploader from './uploader';
|
import Uploader from './uploader';
|
||||||
import Waterfall from './waterfall';
|
import Waterfall from './waterfall';
|
||||||
|
|
||||||
const version = '0.12.4';
|
const version = '0.12.5';
|
||||||
const components = [
|
const components = [
|
||||||
Actionsheet,
|
Actionsheet,
|
||||||
AddressEdit,
|
AddressEdit,
|
||||||
|
@ -3,7 +3,12 @@
|
|||||||
<div class="van-sku-container">
|
<div class="van-sku-container">
|
||||||
<div class="van-sku-layout">
|
<div class="van-sku-layout">
|
||||||
<!-- sku-header -->
|
<!-- sku-header -->
|
||||||
<slot name="sku-header" :skuEventBus="skuEventBus" :selectedSku="selectedSku" :selectedSkuComb="selectedSkuComb">
|
<slot
|
||||||
|
name="sku-header"
|
||||||
|
:sku-event-bus="skuEventBus"
|
||||||
|
:selected-sku="selectedSku"
|
||||||
|
:selected-sku-comb="selectedSkuComb"
|
||||||
|
>
|
||||||
<sku-header
|
<sku-header
|
||||||
:sku-event-bus="skuEventBus"
|
:sku-event-bus="skuEventBus"
|
||||||
:selected-sku="selectedSku"
|
:selected-sku="selectedSku"
|
||||||
@ -14,9 +19,9 @@
|
|||||||
</slot>
|
</slot>
|
||||||
<div class="van-sku-body" :style="bodyStyle">
|
<div class="van-sku-body" :style="bodyStyle">
|
||||||
<!-- sku-body-top -->
|
<!-- sku-body-top -->
|
||||||
<slot name="sku-body-top" :selectedSku="selectedSku" :skuEventBus="skuEventBus" />
|
<slot name="sku-body-top" :selected-sku="selectedSku" :sku-event-bus="skuEventBus" />
|
||||||
<!-- sku-group -->
|
<!-- sku-group -->
|
||||||
<slot name="sku-group" :selectedSku="selectedSku" :skuEventBus="skuEventBus">
|
<slot name="sku-group" :selected-sku="selectedSku" :sku-event-bus="skuEventBus">
|
||||||
<div v-if="hasSku" class="van-sku-group-container van-hairline--bottom">
|
<div v-if="hasSku" class="van-sku-group-container van-hairline--bottom">
|
||||||
<div
|
<div
|
||||||
v-for="(skuTreeItem, index) in skuTree"
|
v-for="(skuTreeItem, index) in skuTree"
|
||||||
@ -40,9 +45,15 @@
|
|||||||
</div>
|
</div>
|
||||||
</slot>
|
</slot>
|
||||||
<!-- extra-sku-group -->
|
<!-- extra-sku-group -->
|
||||||
<slot name="extra-sku-group" :skuEventBus="skuEventBus"/>
|
<slot name="extra-sku-group" :sku-event-bus="skuEventBus"/>
|
||||||
<!-- sku-stepper -->
|
<!-- sku-stepper -->
|
||||||
<slot name="sku-stepper" :skuEventBus="skuEventBus" :selectedSku="selectedSku" :selectedSkuComb="selectedSkuComb" :selectedNum="selectedNum">
|
<slot
|
||||||
|
name="sku-stepper"
|
||||||
|
:sku-event-bus="skuEventBus"
|
||||||
|
:selected-sku="selectedSku"
|
||||||
|
:selected-sku-comb="selectedSkuComb"
|
||||||
|
:selected-num="selectedNum"
|
||||||
|
>
|
||||||
<sku-stepper
|
<sku-stepper
|
||||||
ref="skuStepper"
|
ref="skuStepper"
|
||||||
:sku-event-bus="skuEventBus"
|
:sku-event-bus="skuEventBus"
|
||||||
@ -68,7 +79,7 @@
|
|||||||
</slot>
|
</slot>
|
||||||
</div>
|
</div>
|
||||||
<!-- sku-actions -->
|
<!-- sku-actions -->
|
||||||
<slot name="sku-actions" :skuEventBus="skuEventBus">
|
<slot name="sku-actions" :sku-event-bus="skuEventBus">
|
||||||
<sku-actions
|
<sku-actions
|
||||||
:sku-event-bus="skuEventBus"
|
:sku-event-bus="skuEventBus"
|
||||||
:buy-text="buyText"
|
:buy-text="buyText"
|
||||||
@ -83,21 +94,21 @@
|
|||||||
<script>
|
<script>
|
||||||
/* eslint-disable camelcase */
|
/* eslint-disable camelcase */
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import Popup from '../../popup';
|
import Popup from '../popup';
|
||||||
import Toast from '../../toast';
|
import Toast from '../toast';
|
||||||
import SkuHeader from '../components/SkuHeader';
|
import SkuHeader from './components/SkuHeader';
|
||||||
import SkuRow from '../components/SkuRow';
|
import SkuRow from './components/SkuRow';
|
||||||
import SkuRowItem from '../components/SkuRowItem';
|
import SkuRowItem from './components/SkuRowItem';
|
||||||
import SkuStepper from '../components/SkuStepper';
|
import SkuStepper from './components/SkuStepper';
|
||||||
import SkuMessages from '../components/SkuMessages';
|
import SkuMessages from './components/SkuMessages';
|
||||||
import SkuActions from '../components/SkuActions';
|
import SkuActions from './components/SkuActions';
|
||||||
import {
|
import {
|
||||||
isAllSelected,
|
isAllSelected,
|
||||||
getSkuComb,
|
getSkuComb,
|
||||||
getSelectedSkuValues
|
getSelectedSkuValues
|
||||||
} from '../utils/skuHelper';
|
} from './utils/skuHelper';
|
||||||
import { LIMIT_TYPE } from '../constants';
|
import { LIMIT_TYPE } from './constants';
|
||||||
import { create } from '../../utils';
|
import { create } from '../utils';
|
||||||
|
|
||||||
const { QUOTA_LIMIT } = LIMIT_TYPE;
|
const { QUOTA_LIMIT } = LIMIT_TYPE;
|
||||||
|
|
||||||
@ -115,13 +126,20 @@ export default create({
|
|||||||
},
|
},
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
|
sku: Object,
|
||||||
goods: Object,
|
goods: Object,
|
||||||
|
value: Boolean,
|
||||||
|
buyText: String,
|
||||||
goodsId: [Number, String],
|
goodsId: [Number, String],
|
||||||
|
stepperTitle: String,
|
||||||
|
hideStock: Boolean,
|
||||||
|
resetStepperOnHide: Boolean,
|
||||||
|
resetSelectedSkuOnHide: Boolean,
|
||||||
|
disableStepperInput: Boolean,
|
||||||
initialSku: {
|
initialSku: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => ({})
|
default: () => ({})
|
||||||
},
|
},
|
||||||
sku: Object,
|
|
||||||
quota: {
|
quota: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 0
|
default: 0
|
||||||
@ -130,25 +148,18 @@ export default create({
|
|||||||
type: Number,
|
type: Number,
|
||||||
default: 0
|
default: 0
|
||||||
},
|
},
|
||||||
hideStock: Boolean,
|
|
||||||
showAddCartBtn: {
|
showAddCartBtn: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true
|
default: true
|
||||||
},
|
},
|
||||||
buyText: String,
|
|
||||||
stepperTitle: String,
|
|
||||||
bodyOffsetTop: {
|
bodyOffsetTop: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 200
|
default: 200
|
||||||
},
|
},
|
||||||
resetStepperOnHide: Boolean,
|
|
||||||
resetSelectedSkuOnHide: Boolean,
|
|
||||||
disableStepperInput: Boolean,
|
|
||||||
messagePlaceholderMap: {
|
messagePlaceholderMap: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => ({})
|
default: () => ({})
|
||||||
},
|
}
|
||||||
value: Boolean
|
|
||||||
},
|
},
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
@ -205,19 +216,19 @@ export default create({
|
|||||||
maxHeight: maxHeight + 'px'
|
maxHeight: maxHeight + 'px'
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
isSkuCombSelected() {
|
isSkuCombSelected() {
|
||||||
return isAllSelected(this.sku.tree, this.selectedSku);
|
return isAllSelected(this.sku.tree, this.selectedSku);
|
||||||
},
|
},
|
||||||
// sku数据不存在时不渲染模板
|
|
||||||
isSkuEmpty() {
|
isSkuEmpty() {
|
||||||
for (var key in this.sku) {
|
return Object.keys(this.sku).length === 0;
|
||||||
if (Object.prototype.hasOwnProperty.call(this.sku, key)) return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
hasSku() {
|
hasSku() {
|
||||||
return !this.sku.none_sku;
|
return !this.sku.none_sku;
|
||||||
},
|
},
|
||||||
|
|
||||||
selectedSkuComb() {
|
selectedSkuComb() {
|
||||||
if (!this.hasSku) {
|
if (!this.hasSku) {
|
||||||
return {
|
return {
|
||||||
@ -230,13 +241,14 @@ export default create({
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|
||||||
skuTree() {
|
skuTree() {
|
||||||
return this.sku.tree || [];
|
return this.sku.tree || [];
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
created() {
|
created() {
|
||||||
var skuEventBus = new Vue();
|
const skuEventBus = new Vue();
|
||||||
this.skuEventBus = skuEventBus;
|
this.skuEventBus = skuEventBus;
|
||||||
|
|
||||||
skuEventBus.$on('sku:close', this.handleCloseClicked);
|
skuEventBus.$on('sku:close', this.handleCloseClicked);
|
||||||
@ -263,19 +275,23 @@ export default create({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
getSkuMessages() {
|
getSkuMessages() {
|
||||||
return this.$refs.skuMessages ? this.$refs.skuMessages.getMessages() : {};
|
return this.$refs.skuMessages ? this.$refs.skuMessages.getMessages() : {};
|
||||||
},
|
},
|
||||||
|
|
||||||
getSkuCartMessages() {
|
getSkuCartMessages() {
|
||||||
return this.$refs.skuMessages
|
return this.$refs.skuMessages
|
||||||
? this.$refs.skuMessages.getCartMessages()
|
? this.$refs.skuMessages.getCartMessages()
|
||||||
: {};
|
: {};
|
||||||
},
|
},
|
||||||
|
|
||||||
validateSkuMessages() {
|
validateSkuMessages() {
|
||||||
return this.$refs.skuMessages
|
return this.$refs.skuMessages
|
||||||
? this.$refs.skuMessages.validateMessages()
|
? this.$refs.skuMessages.validateMessages()
|
||||||
: '';
|
: '';
|
||||||
},
|
},
|
||||||
|
|
||||||
validateSku() {
|
validateSku() {
|
||||||
if (this.selectedNum === 0) {
|
if (this.selectedNum === 0) {
|
||||||
return this.$t('unavailable');
|
return this.$t('unavailable');
|
||||||
@ -289,9 +305,11 @@ export default create({
|
|||||||
return this.$t('spec');
|
return this.$t('spec');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
handleCloseClicked() {
|
handleCloseClicked() {
|
||||||
this.show = false;
|
this.show = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
handleSkuSelected(skuValue) {
|
handleSkuSelected(skuValue) {
|
||||||
// 点击已选中的sku时则取消选中
|
// 点击已选中的sku时则取消选中
|
||||||
this.selectedSku =
|
this.selectedSku =
|
||||||
@ -305,9 +323,11 @@ export default create({
|
|||||||
selectedSkuComb: this.selectedSkuComb
|
selectedSkuComb: this.selectedSkuComb
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
handleNumChange(num) {
|
handleNumChange(num) {
|
||||||
this.selectedNum = num;
|
this.selectedNum = num;
|
||||||
},
|
},
|
||||||
|
|
||||||
handleOverLimit({ action, limitType, quota, quotaUsed }) {
|
handleOverLimit({ action, limitType, quota, quotaUsed }) {
|
||||||
if (action === 'minus') {
|
if (action === 'minus') {
|
||||||
Toast(this.$t('least'));
|
Toast(this.$t('least'));
|
||||||
@ -321,12 +341,15 @@ export default create({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
handleAddCartClicked() {
|
handleAddCartClicked() {
|
||||||
this.handleBuyOrAddCart('add-cart');
|
this.handleBuyOrAddCart('add-cart');
|
||||||
},
|
},
|
||||||
|
|
||||||
handleBuyClicked() {
|
handleBuyClicked() {
|
||||||
this.handleBuyOrAddCart('buy-clicked');
|
this.handleBuyOrAddCart('buy-clicked');
|
||||||
},
|
},
|
||||||
|
|
||||||
handleBuyOrAddCart(type) {
|
handleBuyOrAddCart(type) {
|
||||||
const error = this.validateSku();
|
const error = this.validateSku();
|
||||||
if (error) {
|
if (error) {
|
@ -1,7 +1,17 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="van-sku-actions">
|
<div class="van-sku-actions">
|
||||||
<van-button v-if="showAddCartBtn" bottom-action @click="onAddCartClicked">{{ $t('cart') }}</van-button>
|
<van-button
|
||||||
<van-button type="primary" bottom-action @click="onBuyClicked">{{ buyText || $t('buy') }}</van-button>
|
v-if="showAddCartBtn"
|
||||||
|
bottom-action
|
||||||
|
:text="$t('cart')"
|
||||||
|
@click="skuEventBus.$emit('sku:addCart')"
|
||||||
|
/>
|
||||||
|
<van-button
|
||||||
|
type="primary"
|
||||||
|
bottom-action
|
||||||
|
:text="buyText || $t('buy')"
|
||||||
|
@click="skuEventBus.$emit('sku:buy')"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -20,15 +30,6 @@ export default create({
|
|||||||
buyText: String,
|
buyText: String,
|
||||||
skuEventBus: Object,
|
skuEventBus: Object,
|
||||||
showAddCartBtn: Boolean
|
showAddCartBtn: Boolean
|
||||||
},
|
|
||||||
|
|
||||||
methods: {
|
|
||||||
onAddCartClicked() {
|
|
||||||
this.skuEventBus.$emit('sku:addCart');
|
|
||||||
},
|
|
||||||
onBuyClicked() {
|
|
||||||
this.skuEventBus.$emit('sku:buy');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="van-sku-header van-hairline--bottom">
|
<div class="van-sku-header van-hairline--bottom">
|
||||||
<div class="van-sku-header__img-wrap">
|
<div class="van-sku-header__img-wrap">
|
||||||
<img class="van-sku__goods-img" :src="goodsImg">
|
<img class="van-sku__goods-img" :src="goodsImg" >
|
||||||
</div>
|
</div>
|
||||||
<div class="van-sku-header__goods-info">
|
<div class="van-sku-header__goods-info">
|
||||||
<div class="van-sku__goods-name">{{ goods.title }}</div>
|
<div class="van-sku__goods-name">{{ goods.title }}</div>
|
||||||
<div class="van-sku__goods-price"><span class="van-sku__price-symbol">¥</span><span class="van-sku__price-num">{{ price }}</span></div>
|
<div class="van-sku__goods-price"><span class="van-sku__price-symbol">¥</span><span class="van-sku__price-num">{{ price }}</span></div>
|
||||||
<span class="van-sku__close-icon" @click="onCloseClicked" />
|
<span class="van-sku__close-icon" @click="skuEventBus.$emit('sku:close')" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -26,9 +26,6 @@ export default create({
|
|||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
skuTree() {
|
|
||||||
return this.sku.tree;
|
|
||||||
},
|
|
||||||
goodsImg() {
|
goodsImg() {
|
||||||
const s1Id = this.selectedSku.s1;
|
const s1Id = this.selectedSku.s1;
|
||||||
const skuImg = this.getSkuImg(s1Id);
|
const skuImg = this.getSkuImg(s1Id);
|
||||||
@ -45,14 +42,11 @@ export default create({
|
|||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
onCloseClicked() {
|
|
||||||
this.skuEventBus.$emit('sku:close');
|
|
||||||
},
|
|
||||||
getSkuImg(id) {
|
getSkuImg(id) {
|
||||||
if (!id) return;
|
if (!id) return;
|
||||||
|
|
||||||
// 目前skuImg都挂载在skuTree中s1那类sku上
|
// 目前skuImg都挂载在skuTree中s1那类sku上
|
||||||
const treeItem = this.skuTree.filter(treeItem => treeItem.k_s === 's1')[0] || {};
|
const treeItem = this.sku.tree.filter(treeItem => treeItem.k_s === 's1')[0] || {};
|
||||||
|
|
||||||
if (!treeItem.v) {
|
if (!treeItem.v) {
|
||||||
return;
|
return;
|
||||||
|
@ -1,26 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<cell-group class="van-sku-messages">
|
<cell-group class="van-sku-messages">
|
||||||
<template v-for="(message, index) in internalMessages">
|
<field
|
||||||
<template v-if="message.type === 'image'" />
|
v-for="(message, index) in internalMessages"
|
||||||
<field
|
v-model="messageValues[index]"
|
||||||
v-else-if="message.multiple == '1'"
|
:key="`${goodsId}-${index}`"
|
||||||
:key="`${goodsId}-${index}`"
|
:required="message.required == '1'"
|
||||||
:required="message.required == '1'"
|
:label="message.name"
|
||||||
:label="message.name"
|
:placeholder="getPlaceholder(message)"
|
||||||
:placeholder="getPlaceholder('textarea')"
|
:type="getType(message)"
|
||||||
type="textarea"
|
/>
|
||||||
v-model="messageValues[index]"
|
|
||||||
/>
|
|
||||||
<field
|
|
||||||
v-else
|
|
||||||
:key="`${goodsId}-${index}`"
|
|
||||||
:required="message.required == '1'"
|
|
||||||
:label="message.name"
|
|
||||||
:placeholder="getPlaceholder(message.type)"
|
|
||||||
:type="getType(message)"
|
|
||||||
v-model="messageValues[index]"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
</cell-group>
|
</cell-group>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -47,26 +35,23 @@ export default create({
|
|||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
internalMessages() {
|
internalMessages() {
|
||||||
if (Object.prototype.toString.call(this.messages) === '[object Array]') {
|
return Array.isArray(this.messages) ? this.messages.filter(message => message.type !== 'image') : [];
|
||||||
return this.messages;
|
|
||||||
}
|
|
||||||
return [];
|
|
||||||
},
|
},
|
||||||
|
|
||||||
messageValues() {
|
messageValues() {
|
||||||
const messageValues = [];
|
return this.internalMessages.map(() => '');
|
||||||
this.internalMessages.forEach((message, index) => {
|
|
||||||
messageValues[index] = '';
|
|
||||||
});
|
|
||||||
|
|
||||||
return messageValues;
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
getType({ type, datetime }) {
|
getType(message) {
|
||||||
if (type === 'id_no') return 'text';
|
if (+message.multiple === 1) {
|
||||||
return datetime > 0 ? 'datetime-local' : type;
|
return 'textarea';
|
||||||
|
}
|
||||||
|
if (message.type === 'id_no') {
|
||||||
|
return 'text';
|
||||||
|
}
|
||||||
|
return message.datetime > 0 ? 'datetime-local' : message.type;
|
||||||
},
|
},
|
||||||
|
|
||||||
getMessages() {
|
getMessages() {
|
||||||
@ -96,8 +81,9 @@ export default create({
|
|||||||
return messages;
|
return messages;
|
||||||
},
|
},
|
||||||
|
|
||||||
getPlaceholder(key) {
|
getPlaceholder(message) {
|
||||||
return this.messagePlaceholderMap[key] || this.$t(`placeholder.${key}`);
|
const type = +message.multiple === 1 ? 'textarea' : message.type;
|
||||||
|
return this.messagePlaceholderMap[type] || this.$t(`placeholder.${type}`);
|
||||||
},
|
},
|
||||||
|
|
||||||
validateMessages() {
|
validateMessages() {
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<span
|
<span
|
||||||
v-if="isChoosable"
|
|
||||||
@click="onSkuSelected"
|
|
||||||
class="van-sku-row__item"
|
class="van-sku-row__item"
|
||||||
:class="{ 'van-sku-row__item--active': isChoosed }">
|
:class="{
|
||||||
|
'van-sku-row__item--active': isChoosed,
|
||||||
|
'van-sku-row__item--disabled': !isChoosable
|
||||||
|
}"
|
||||||
|
@click="onSkuSelected"
|
||||||
|
>
|
||||||
{{ skuValue.name }}
|
{{ skuValue.name }}
|
||||||
</span>
|
</span>
|
||||||
<span v-else class="van-sku-row__item van-sku-row__item--disabled">{{ skuValue.name }}</span>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@ -25,6 +27,7 @@ export default {
|
|||||||
isChoosed() {
|
isChoosed() {
|
||||||
return this.skuValue.id === this.selectedSku[this.skuKeyStr];
|
return this.skuValue.id === this.selectedSku[this.skuKeyStr];
|
||||||
},
|
},
|
||||||
|
|
||||||
isChoosable() {
|
isChoosable() {
|
||||||
const matchedSku = Object.assign({}, this.selectedSku, {
|
const matchedSku = Object.assign({}, this.selectedSku, {
|
||||||
[this.skuKeyStr]: this.skuValue.id
|
[this.skuKeyStr]: this.skuValue.id
|
||||||
@ -44,7 +47,12 @@ export default {
|
|||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
onSkuSelected() {
|
onSkuSelected() {
|
||||||
this.skuEventBus.$emit('sku:select', Object.assign({}, this.skuValue, { skuKeyStr: this.skuKeyStr }));
|
if (this.isChoosable) {
|
||||||
|
this.skuEventBus.$emit('sku:select', {
|
||||||
|
...this.skuValue,
|
||||||
|
skuKeyStr: this.skuKeyStr
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
:min="1"
|
:min="1"
|
||||||
:max="stepperLimit"
|
:max="stepperLimit"
|
||||||
:disable-input="disableStepperInput"
|
:disable-input="disableStepperInput"
|
||||||
@overlimit="handleOverLimit"
|
@overlimit="onOverLimit"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="!hideStock" class="van-sku__stock">{{ $t('remain', stock) }}</div>
|
<div v-if="!hideStock" class="van-sku__stock">{{ $t('remain', stock) }}</div>
|
||||||
@ -39,14 +39,8 @@ export default create({
|
|||||||
stepperTitle: String,
|
stepperTitle: String,
|
||||||
quota: Number,
|
quota: Number,
|
||||||
quotaUsed: Number,
|
quotaUsed: Number,
|
||||||
hideStock: {
|
hideStock: Boolean,
|
||||||
type: Boolean,
|
disableStepperInput: Boolean
|
||||||
default: false
|
|
||||||
},
|
|
||||||
disableStepperInput: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
@ -97,7 +91,8 @@ export default create({
|
|||||||
setCurrentNum(num) {
|
setCurrentNum(num) {
|
||||||
this.currentNum = num;
|
this.currentNum = num;
|
||||||
},
|
},
|
||||||
handleOverLimit(action) {
|
|
||||||
|
onOverLimit(action) {
|
||||||
this.skuEventBus.$emit('sku:overLimit', {
|
this.skuEventBus.$emit('sku:overLimit', {
|
||||||
action,
|
action,
|
||||||
limitType: this.limitType,
|
limitType: this.limitType,
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import Sku from './Sku';
|
||||||
import SkuActions from './components/SkuActions';
|
import SkuActions from './components/SkuActions';
|
||||||
import SkuHeader from './components/SkuHeader';
|
import SkuHeader from './components/SkuHeader';
|
||||||
import SkuMessages from './components/SkuMessages';
|
import SkuMessages from './components/SkuMessages';
|
||||||
@ -5,14 +6,13 @@ import SkuStepper from './components/SkuStepper';
|
|||||||
import SkuRow from './components/SkuRow';
|
import SkuRow from './components/SkuRow';
|
||||||
import SkuRowItem from './components/SkuRowItem';
|
import SkuRowItem from './components/SkuRowItem';
|
||||||
import skuHelper from './utils/skuHelper';
|
import skuHelper from './utils/skuHelper';
|
||||||
import SkuContainer from './containers/SkuContainer';
|
|
||||||
|
|
||||||
SkuContainer.SkuActions = SkuActions;
|
Sku.SkuActions = SkuActions;
|
||||||
SkuContainer.SkuHeader = SkuHeader;
|
Sku.SkuHeader = SkuHeader;
|
||||||
SkuContainer.SkuMessages = SkuMessages;
|
Sku.SkuMessages = SkuMessages;
|
||||||
SkuContainer.SkuStepper = SkuStepper;
|
Sku.SkuStepper = SkuStepper;
|
||||||
SkuContainer.SkuRow = SkuRow;
|
Sku.SkuRow = SkuRow;
|
||||||
SkuContainer.SkuRowItem = SkuRowItem;
|
Sku.SkuRowItem = SkuRowItem;
|
||||||
SkuContainer.skuHelper = skuHelper;
|
Sku.skuHelper = skuHelper;
|
||||||
|
|
||||||
export default SkuContainer;
|
export default Sku;
|
||||||
|
Binary file not shown.
2
packages/vant-css/package-lock.json
generated
2
packages/vant-css/package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "vant-css",
|
"name": "vant-css",
|
||||||
"version": "0.12.4",
|
"version": "0.12.5",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "vant-css",
|
"name": "vant-css",
|
||||||
"version": "0.12.4",
|
"version": "0.12.5",
|
||||||
"description": "vant css.",
|
"description": "vant css.",
|
||||||
"main": "lib/index.css",
|
"main": "lib/index.css",
|
||||||
"style": "lib/index.css",
|
"style": "lib/index.css",
|
||||||
|
@ -72,7 +72,7 @@
|
|||||||
&::before {
|
&::before {
|
||||||
content: '*';
|
content: '*';
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: -7px;
|
left: 7px;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
color: $red;
|
color: $red;
|
||||||
}
|
}
|
||||||
|
@ -2,5 +2,5 @@
|
|||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
font-family: 'vant-icon';
|
font-family: 'vant-icon';
|
||||||
src: url('./vant-icon-120564.ttf') format('truetype');
|
src: url('./vant-icon-dc7d92.ttf') format('truetype');
|
||||||
}
|
}
|
@ -4,7 +4,7 @@
|
|||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
font-family: 'vant-icon';
|
font-family: 'vant-icon';
|
||||||
src: url('https://b.yzcdn.cn/zanui/icon/vant-icon-120564.ttf') format('truetype');
|
src: url('https://b.yzcdn.cn/zanui/icon/vant-icon-dc7d92.ttf') format('truetype');
|
||||||
}
|
}
|
||||||
|
|
||||||
.van-icon {
|
.van-icon {
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
line-height: 1.2;
|
line-height: 1.2;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
|
word-break: break-all;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user