├── .gitignore
├── README.md
├── babel.config.js
├── package-lock.json
├── package.json
├── postcss.config.js
├── public
└── index.html
├── src
├── App.vue
├── api
│ └── index.js
├── components
│ ├── PlayList.vue
│ ├── SongFooter.vue
│ └── SongSheet.vue
├── config
│ └── index.js
├── main.js
├── manifest.json
├── pages.json
├── pages
│ ├── Hot
│ │ └── index.vue
│ ├── PersonalizedList
│ │ └── index.vue
│ ├── Recommend
│ │ └── index.vue
│ ├── Search
│ │ └── index.vue
│ ├── Song
│ │ └── index.vue
│ ├── SongList
│ │ └── index.vue
│ └── index
│ │ └── index.vue
├── static
│ ├── defaultMusicAvatar.jpg
│ ├── headset.png
│ ├── pause-item.png
│ ├── pause_icon.png
│ ├── play-cell.png
│ ├── play-list.png
│ ├── play_btn_next.png
│ ├── play_btn_pause.png
│ ├── play_btn_play.png
│ ├── play_btn_prev.png
│ ├── play_icn_loop.png
│ ├── play_icn_one.png
│ ├── play_icn_shuffle.png
│ ├── play_icn_src.png
│ ├── play_icn_src_footer.png
│ └── play_icon.png
├── store
│ ├── actions.js
│ ├── constants.js
│ ├── index.js
│ ├── mutations.js
│ └── state.js
├── uni.scss
├── utils
│ └── index.js
└── wxcomponents
│ └── vant-weapp
│ ├── action-sheet
│ ├── index.js
│ ├── index.json
│ ├── index.vue
│ ├── index.wxml
│ └── index.wxss
│ ├── area
│ ├── index.js
│ ├── index.json
│ ├── index.vue
│ ├── index.wxml
│ └── index.wxss
│ ├── badge-group
│ ├── index.js
│ ├── index.json
│ ├── index.vue
│ ├── index.wxml
│ └── index.wxss
│ ├── badge
│ ├── index.js
│ ├── index.json
│ ├── index.vue
│ ├── index.wxml
│ └── index.wxss
│ ├── button
│ ├── index.js
│ ├── index.json
│ ├── index.vue
│ ├── index.wxml
│ └── index.wxss
│ ├── card
│ ├── index.js
│ ├── index.json
│ ├── index.vue
│ ├── index.wxml
│ └── index.wxss
│ ├── cell-group
│ ├── index.js
│ ├── index.json
│ ├── index.vue
│ ├── index.wxml
│ └── index.wxss
│ ├── cell
│ ├── index.js
│ ├── index.json
│ ├── index.vue
│ ├── index.wxml
│ └── index.wxss
│ ├── checkbox-group
│ ├── index.js
│ ├── index.json
│ ├── index.vue
│ ├── index.wxml
│ └── index.wxss
│ ├── checkbox
│ ├── index.js
│ ├── index.json
│ ├── index.vue
│ ├── index.wxml
│ └── index.wxss
│ ├── col
│ ├── index.js
│ ├── index.json
│ ├── index.vue
│ ├── index.wxml
│ └── index.wxss
│ ├── collapse-item
│ ├── index.js
│ ├── index.json
│ ├── index.vue
│ ├── index.wxml
│ └── index.wxss
│ ├── collapse
│ ├── index.js
│ ├── index.json
│ ├── index.vue
│ └── index.wxml
│ ├── common
│ ├── color.js
│ ├── component.js
│ ├── index.css
│ ├── index.wxss
│ ├── style
│ │ ├── clearfix.css
│ │ ├── clearfix.wxss
│ │ ├── ellipsis.css
│ │ ├── ellipsis.wxss
│ │ ├── hairline.css
│ │ ├── hairline.wxss
│ │ ├── mixins
│ │ │ ├── clearfix.css
│ │ │ ├── clearfix.wxss
│ │ │ ├── ellipsis.css
│ │ │ ├── ellipsis.wxss
│ │ │ ├── hairline.css
│ │ │ └── hairline.wxss
│ │ ├── var.css
│ │ └── var.wxss
│ └── utils.js
│ ├── datetime-picker
│ ├── index.js
│ ├── index.json
│ ├── index.vue
│ ├── index.wxml
│ └── index.wxss
│ ├── dialog
│ ├── dialog.js
│ ├── index.js
│ ├── index.json
│ ├── index.vue
│ ├── index.wxml
│ └── index.wxss
│ ├── field
│ ├── index.js
│ ├── index.json
│ ├── index.vue
│ ├── index.wxml
│ └── index.wxss
│ ├── goods-action-button
│ ├── index.js
│ ├── index.json
│ ├── index.vue
│ ├── index.wxml
│ └── index.wxss
│ ├── goods-action-icon
│ ├── index.js
│ ├── index.json
│ ├── index.vue
│ ├── index.wxml
│ └── index.wxss
│ ├── goods-action
│ ├── index.js
│ ├── index.json
│ ├── index.vue
│ ├── index.wxml
│ └── index.wxss
│ ├── icon
│ ├── index.js
│ ├── index.json
│ ├── index.vue
│ ├── index.wxml
│ └── index.wxss
│ ├── info
│ ├── index.js
│ ├── index.json
│ ├── index.vue
│ ├── index.wxml
│ └── index.wxss
│ ├── loading
│ ├── index.js
│ ├── index.json
│ ├── index.vue
│ ├── index.wxml
│ └── index.wxss
│ ├── mixins
│ ├── basic.js
│ ├── button.js
│ ├── iphonex.js
│ ├── link.js
│ ├── observer
│ │ ├── behavior.js
│ │ ├── index.js
│ │ └── props.js
│ ├── open-type.js
│ ├── touch.js
│ └── transition.js
│ ├── nav-bar
│ ├── index.js
│ ├── index.json
│ ├── index.vue
│ ├── index.wxml
│ └── index.wxss
│ ├── notice-bar
│ ├── index.js
│ ├── index.json
│ ├── index.vue
│ ├── index.wxml
│ └── index.wxss
│ ├── notify
│ ├── index.js
│ ├── index.json
│ ├── index.vue
│ ├── index.wxml
│ ├── index.wxss
│ └── notify.js
│ ├── overlay
│ ├── index.js
│ ├── index.json
│ ├── index.vue
│ ├── index.wxml
│ └── index.wxss
│ ├── panel
│ ├── index.js
│ ├── index.json
│ ├── index.vue
│ ├── index.wxml
│ └── index.wxss
│ ├── picker-column
│ ├── index-getOptionText.wxs
│ ├── index.js
│ ├── index.json
│ ├── index.vue
│ ├── index.wxml
│ └── index.wxss
│ ├── picker
│ ├── index-isSimple.wxs
│ ├── index.js
│ ├── index.json
│ ├── index.vue
│ ├── index.wxml
│ └── index.wxss
│ ├── popup
│ ├── index.js
│ ├── index.json
│ ├── index.vue
│ ├── index.wxml
│ └── index.wxss
│ ├── progress
│ ├── index.js
│ ├── index.json
│ ├── index.vue
│ ├── index.wxml
│ └── index.wxss
│ ├── radio-group
│ ├── index.js
│ ├── index.json
│ ├── index.vue
│ ├── index.wxml
│ └── index.wxss
│ ├── radio
│ ├── index.js
│ ├── index.json
│ ├── index.vue
│ ├── index.wxml
│ └── index.wxss
│ ├── rate
│ ├── index.js
│ ├── index.json
│ ├── index.vue
│ ├── index.wxml
│ └── index.wxss
│ ├── row
│ ├── index.js
│ ├── index.json
│ ├── index.vue
│ ├── index.wxml
│ └── index.wxss
│ ├── search
│ ├── index.js
│ ├── index.json
│ ├── index.vue
│ ├── index.wxml
│ └── index.wxss
│ ├── slider
│ ├── index.js
│ ├── index.json
│ ├── index.vue
│ ├── index.wxml
│ └── index.wxss
│ ├── stepper
│ ├── index.js
│ ├── index.json
│ ├── index.vue
│ ├── index.wxml
│ └── index.wxss
│ ├── steps
│ ├── index.js
│ ├── index.json
│ ├── index.vue
│ ├── index.wxml
│ └── index.wxss
│ ├── submit-bar
│ ├── index.js
│ ├── index.json
│ ├── index.vue
│ ├── index.wxml
│ └── index.wxss
│ ├── swipe-cell
│ ├── index.js
│ ├── index.json
│ ├── index.vue
│ ├── index.wxml
│ └── index.wxss
│ ├── switch-cell
│ ├── index.js
│ ├── index.json
│ ├── index.vue
│ ├── index.wxml
│ └── index.wxss
│ ├── switch
│ ├── index.js
│ ├── index.json
│ ├── index.vue
│ ├── index.wxml
│ └── index.wxss
│ ├── tab
│ ├── index.js
│ ├── index.json
│ ├── index.vue
│ ├── index.wxml
│ └── index.wxss
│ ├── tabbar-item
│ ├── index.js
│ ├── index.json
│ ├── index.vue
│ ├── index.wxml
│ └── index.wxss
│ ├── tabbar
│ ├── index.js
│ ├── index.json
│ ├── index.vue
│ ├── index.wxml
│ └── index.wxss
│ ├── tabs
│ ├── index.js
│ ├── index.json
│ ├── index.vue
│ ├── index.wxml
│ └── index.wxss
│ ├── tag
│ ├── index.js
│ ├── index.json
│ ├── index.vue
│ ├── index.wxml
│ └── index.wxss
│ ├── toast
│ ├── index.js
│ ├── index.json
│ ├── index.vue
│ ├── index.wxml
│ ├── index.wxss
│ └── toast.js
│ ├── transition
│ ├── index.js
│ ├── index.json
│ ├── index.vue
│ ├── index.wxml
│ └── index.wxss
│ ├── tree-select
│ ├── index.js
│ ├── index.json
│ ├── index.vue
│ ├── index.wxml
│ └── index.wxss
│ └── wxs
│ ├── array.wxs
│ ├── bem.wxs
│ ├── memoize.wxs
│ ├── object.wxs
│ └── utils.wxs
└── tsconfig.json
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules/
3 | unpackage/
4 | dist/
5 |
6 | # local env files
7 | .env.local
8 | .env.*.local
9 |
10 | # Log files
11 | npm-debug.log*
12 | yarn-debug.log*
13 | yarn-error.log*
14 |
15 | # Editor directories and files
16 | .project
17 | .idea
18 | .vscode
19 | *.suo
20 | *.ntvs*
21 | *.njsproj
22 | *.sln
23 | *.sw*
24 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # uni-app-music 实现网易云音乐小程序版本
2 |
3 | 使用[uni-app](https://uniapp.dcloud.io/)快速开发微信小程序,数据来源使用网上开源的[网易云音乐 NodeJS 版 API](https://binaryify.github.io/NeteaseCloudMusicApi/#/)
4 |
5 | ## 页面效果
6 |
7 | 

8 |
9 | 

10 |
11 | 
12 |
13 | ## 项目的运行
14 |
15 | **1. 接口的运行**
16 |
17 | ```sh
18 | # 下载源码
19 | git clone https://github.com/Binaryify/NeteaseCloudMusicApi.git
20 | # 切换到目录下
21 | cd NeteaseCloudMusicApi
22 | # 安装依赖
23 | cnpm install
24 | # 运行
25 | npm start
26 | ```
27 |
28 | **2. 项目的运行**
29 |
30 | ```sh
31 | # 下载源码
32 | git clone https://github.com/CalmHarbin/uni-app-music.git
33 | # 切换到目录下
34 | cd uni-app-music
35 | # 安装依赖
36 | cnpm install
37 | # 运行
38 | npm start
39 | # 使用微信开发者工具打开dist目录即可(请勾上微信开发者工具的 不校验合法域名... 这一项)
40 | ```
41 |
42 | [Taro 版本点这里](https://github.com/CalmHarbin/Taro-)
43 |
44 | 欢迎 star
45 |
--------------------------------------------------------------------------------
/babel.config.js:
--------------------------------------------------------------------------------
1 | const plugins = []
2 |
3 | if (process.env.UNI_OPT_TREESHAKINGNG) {
4 | plugins.push(require('@dcloudio/vue-cli-plugin-uni-optimize/packages/babel-plugin-uni-api/index.js'))
5 | }
6 |
7 | if (process.env.UNI_PLATFORM === 'app-plus' && process.env.UNI_USING_V8) {
8 | const path = require('path')
9 |
10 | const isWin = /^win/.test(process.platform)
11 |
12 | const normalizePath = path => (isWin ? path.replace(/\\/g, '/') : path)
13 |
14 | const input = normalizePath(process.env.UNI_INPUT_DIR)
15 | try {
16 | plugins.push([
17 | require('@dcloudio/vue-cli-plugin-hbuilderx/packages/babel-plugin-console'),
18 | {
19 | file (file) {
20 | file = normalizePath(file)
21 | if (file.indexOf(input) === 0) {
22 | return path.relative(input, file)
23 | }
24 | return false
25 | }
26 | }
27 | ])
28 | } catch (e) {}
29 | }
30 |
31 | process.UNI_LIBRARIES = process.UNI_LIBRARIES || ['@dcloudio/uni-ui']
32 | process.UNI_LIBRARIES.forEach(libraryName => {
33 | plugins.push([
34 | 'import',
35 | {
36 | 'libraryName': libraryName,
37 | 'customName': (name) => {
38 | return `${libraryName}/lib/${name}/${name}`
39 | }
40 | }
41 | ])
42 | })
43 | module.exports = {
44 | presets: [
45 | [
46 | '@vue/app',
47 | {
48 | modules: 'commonjs',
49 | useBuiltIns: process.env.UNI_PLATFORM === 'h5' ? 'usage' : 'entry'
50 | }
51 | ]
52 | ],
53 | plugins
54 | }
55 |
--------------------------------------------------------------------------------
/postcss.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | parser: require('postcss-comment'),
3 | plugins: [
4 | require('postcss-import'),
5 | require('autoprefixer')({
6 | remove: process.env.UNI_PLATFORM !== 'h5'
7 | }),
8 | require('@dcloudio/vue-cli-plugin-uni/packages/postcss')
9 | ]
10 | }
11 |
--------------------------------------------------------------------------------
/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | <%= htmlWebpackPlugin.options.title %>
9 |
10 |
17 |
18 |
19 |
20 |
21 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/src/api/index.js:
--------------------------------------------------------------------------------
1 | import config from '../config/index';
2 |
3 | function Api(path, data = {}) {
4 | return new Promise((resolve, reject) => {
5 | uni.request({
6 | url: config.serverUrl + path,
7 | data: data,
8 | header: {
9 | 'content-type': 'application/json'
10 | },
11 | success: res => {
12 | if (res.statusCode >= 200 && res.statusCode <= 300) {
13 | resolve(res.data);
14 | } else {
15 | if (res.errMsg) {
16 | uni.showToast({
17 | title: res.errMsg,
18 | icon: 'none',
19 | duration: 1000
20 | });
21 | } else {
22 | uni.showToast({
23 | title: '出错了',
24 | icon: 'none',
25 | duration: 1000
26 | });
27 | uni.hideLoading();
28 | }
29 | }
30 | },
31 | fail: err => {
32 | uni.showToast({
33 | title: err.errMsg,
34 | icon: 'none',
35 | duration: 1000
36 | });
37 | uni.hideLoading();
38 | reject(err);
39 | }
40 | });
41 | });
42 | }
43 | //首页轮播图
44 | const getBanner = (data = {}) => new Api('/banner', data);
45 | //推荐歌单
46 | const getPersonalized = (data = {}) => new Api('/personalized', data);
47 | //歌单详情
48 | const getSongList = (data = {}) => new Api('/playlist/detail', data);
49 | //歌曲详情
50 | const getSong = (data = {}) => new Api('/song/url', data);
51 | //获取歌词
52 | const getLyric = (data = {}) => new Api('/lyric', data);
53 | //搜索
54 | const search = (data = {}) => new Api('/search', data);
55 | //热搜
56 | const searchHot = (data = {}) => new Api('/search/hot', data);
57 | //所有榜单--这个用歌单详情获取数据
58 | const toplist = (data = {}) => new Api('/toplist', data);
59 | //获取榜单---1热歌榜,
60 | const getHot = (data = {}) => new Api('/top/list', data);
61 |
62 | export {
63 | getBanner,
64 | getPersonalized,
65 | getSongList,
66 | getSong,
67 | getLyric,
68 | search,
69 | searchHot,
70 | toplist,
71 | getHot
72 | };
73 |
--------------------------------------------------------------------------------
/src/components/SongSheet.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {{name}}
5 |
6 |
7 |
8 |
9 | {{(playCount | 0) > 10000 ? (playCount / 10000 | 0) + '万' : (playCount | 0)}}
10 |
11 |
12 |
13 |
14 |
15 |
33 |
34 |
74 |
--------------------------------------------------------------------------------
/src/config/index.js:
--------------------------------------------------------------------------------
1 | export default {
2 | // serverUrl: 'https://music.befirer.com'
3 | // serverUrl: 'http://localhost:3000'
4 | serverUrl: 'http://192.168.0.120:3000' //手机扫码体验请把地址改为局域网ip
5 | };
6 |
--------------------------------------------------------------------------------
/src/main.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import App from './App'
3 | import utils from './utils/index'
4 | import store from './store/index.js'
5 | //原型上绑定配置文件
6 | import config from './config/index'
7 | Vue.prototype.$config = config
8 | Vue.prototype.$store = store
9 |
10 | Vue.config.productionTip = false
11 | Vue.use(utils)
12 |
13 | App.mpType = 'app'
14 |
15 | const app = new Vue({
16 | store,
17 | ...App
18 | })
19 | app.$mount()
20 |
--------------------------------------------------------------------------------
/src/pages.json:
--------------------------------------------------------------------------------
1 | {
2 | "pages": [
3 | //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
4 | {
5 | "path": "pages/index/index",
6 | "style": {
7 | "usingComponents": {
8 | "van-tab": "/wxcomponents/vant-weapp/tab/index",
9 | "van-tabs": "/wxcomponents/vant-weapp/tabs/index"
10 | }
11 | }
12 | },
13 | {
14 | "path": "pages/PersonalizedList/index",
15 | "style": {
16 | "usingComponents": {
17 | "van-icon": "/wxcomponents/vant-weapp/icon/index"
18 | }
19 | }
20 | },
21 | {
22 | "path": "pages/SongList/index",
23 | "style": {
24 | "navigationBarTitleText": "歌单"
25 | }
26 | },
27 | {
28 | "path": "pages/Song/index"
29 | }
30 | ],
31 | "globalStyle": {
32 | "navigationBarTextStyle": "white",
33 | "navigationBarTitleText": "音乐达人范",
34 | "navigationBarBackgroundColor": "#31c27c",
35 | "backgroundColor": "#F8F8F8"
36 | }
37 | }
--------------------------------------------------------------------------------
/src/pages/index/index.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
59 |
60 |
65 |
--------------------------------------------------------------------------------
/src/static/defaultMusicAvatar.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CalmHarbin/uni-app-music/da507dcbf07668830f566599d77daa90068d406f/src/static/defaultMusicAvatar.jpg
--------------------------------------------------------------------------------
/src/static/headset.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CalmHarbin/uni-app-music/da507dcbf07668830f566599d77daa90068d406f/src/static/headset.png
--------------------------------------------------------------------------------
/src/static/pause-item.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CalmHarbin/uni-app-music/da507dcbf07668830f566599d77daa90068d406f/src/static/pause-item.png
--------------------------------------------------------------------------------
/src/static/pause_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CalmHarbin/uni-app-music/da507dcbf07668830f566599d77daa90068d406f/src/static/pause_icon.png
--------------------------------------------------------------------------------
/src/static/play-cell.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CalmHarbin/uni-app-music/da507dcbf07668830f566599d77daa90068d406f/src/static/play-cell.png
--------------------------------------------------------------------------------
/src/static/play-list.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CalmHarbin/uni-app-music/da507dcbf07668830f566599d77daa90068d406f/src/static/play-list.png
--------------------------------------------------------------------------------
/src/static/play_btn_next.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CalmHarbin/uni-app-music/da507dcbf07668830f566599d77daa90068d406f/src/static/play_btn_next.png
--------------------------------------------------------------------------------
/src/static/play_btn_pause.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CalmHarbin/uni-app-music/da507dcbf07668830f566599d77daa90068d406f/src/static/play_btn_pause.png
--------------------------------------------------------------------------------
/src/static/play_btn_play.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CalmHarbin/uni-app-music/da507dcbf07668830f566599d77daa90068d406f/src/static/play_btn_play.png
--------------------------------------------------------------------------------
/src/static/play_btn_prev.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CalmHarbin/uni-app-music/da507dcbf07668830f566599d77daa90068d406f/src/static/play_btn_prev.png
--------------------------------------------------------------------------------
/src/static/play_icn_loop.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CalmHarbin/uni-app-music/da507dcbf07668830f566599d77daa90068d406f/src/static/play_icn_loop.png
--------------------------------------------------------------------------------
/src/static/play_icn_one.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CalmHarbin/uni-app-music/da507dcbf07668830f566599d77daa90068d406f/src/static/play_icn_one.png
--------------------------------------------------------------------------------
/src/static/play_icn_shuffle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CalmHarbin/uni-app-music/da507dcbf07668830f566599d77daa90068d406f/src/static/play_icn_shuffle.png
--------------------------------------------------------------------------------
/src/static/play_icn_src.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CalmHarbin/uni-app-music/da507dcbf07668830f566599d77daa90068d406f/src/static/play_icn_src.png
--------------------------------------------------------------------------------
/src/static/play_icn_src_footer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CalmHarbin/uni-app-music/da507dcbf07668830f566599d77daa90068d406f/src/static/play_icn_src_footer.png
--------------------------------------------------------------------------------
/src/static/play_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CalmHarbin/uni-app-music/da507dcbf07668830f566599d77daa90068d406f/src/static/play_icon.png
--------------------------------------------------------------------------------
/src/store/actions.js:
--------------------------------------------------------------------------------
1 | import { UPDATELYRIC, UPDATE, SETGLOBALDATA, PREVSONG, NEXTSONG } from './constants.js'
2 | import { getSong, getLyric } from '../api/index'
3 |
4 | const actions = {
5 | updateLyric({ commit }, payload) {
6 | let { id } = payload
7 | getLyric({ id: id }).then(res => {
8 | let LyricList =
9 | res.lrc &&
10 | res.lrc.lyric.split('\n').map(item => {
11 | let arr = item.split(']')
12 | let time = arr[0].substr(1)
13 |
14 | return {
15 | time: (time.split(':')[0] * 60 + time.split(':')[1] * 1) | 0,
16 | Text: arr[1]
17 | }
18 | })
19 | commit(UPDATELYRIC, {
20 | LyricList: LyricList.filter(item => item.Text), //过滤掉空歌词
21 | callback: payload.callback
22 | })
23 | })
24 | },
25 | update({ commit }, payload) {
26 | let { item } = payload
27 | getSong({ id: item.id }).then(res => {
28 | if (!res.data[0].url) {
29 | console.log('该首歌曲无法播放')
30 | uni.showModal({
31 | title: '抱歉',
32 | content: '该首歌曲无法播放'
33 | })
34 | }
35 | commit(UPDATE, {
36 | src: res.data[0].url,
37 | coverImgUrl: item.al.picUrl,
38 | singer: item.ar
39 | .map(i => {
40 | return i.name
41 | })
42 | .join(' / '),
43 | title: item.name,
44 | id: item.id,
45 | _name: item.name,
46 | _singer: item.ar
47 | .map(i => {
48 | return i.name
49 | })
50 | .join(' / '),
51 | _picUrl: item.al.picUrl,
52 | song: item,
53 | callback: payload.callback
54 | })
55 | })
56 | },
57 | setGlobalData({ commit }, payload) {
58 | commit(SETGLOBALDATA, payload)
59 | },
60 | prev({ commit }, payload) {
61 | commit(PREVSONG, payload)
62 | },
63 | next({ commit }, payload) {
64 | commit(NEXTSONG, payload)
65 | }
66 | }
67 |
68 | export default actions
69 |
--------------------------------------------------------------------------------
/src/store/constants.js:
--------------------------------------------------------------------------------
1 | export const UPDATELYRIC = 'UPDATELYRIC' //更新歌词
2 | export const UPDATE = 'UPDATE' //更新歌曲
3 | export const PREVSONG = 'PREVSONG' //上一首
4 | export const NEXTSONG = 'NEXTSONG' //下一首
5 | export const SETGLOBALDATA = 'SETGLOBALDATA' //设置redux
6 |
--------------------------------------------------------------------------------
/src/store/index.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import Vuex from 'vuex'
3 | import createLogger from 'vuex/dist/logger'
4 | import state from './state.js'
5 | import mutations from './mutations.js'
6 | import action from './actions.js'
7 |
8 | Vue.use(Vuex)
9 |
10 | const debug = process.env.NODE_ENV !== 'production'
11 |
12 | const store = new Vuex.Store({
13 | state: state,
14 | mutations: mutations,
15 | actions: action,
16 | strict: debug,
17 | plugins: debug ? [createLogger()] : []
18 | })
19 |
20 | export default store
21 |
--------------------------------------------------------------------------------
/src/store/mutations.js:
--------------------------------------------------------------------------------
1 | import { UPDATELYRIC, UPDATE, SETGLOBALDATA, PREVSONG, NEXTSONG } from './constants.js'
2 |
3 | const mutations = {
4 | [UPDATELYRIC](state, payload) {
5 | //更新歌词
6 | state.audio.LyricList = payload.LyricList
7 | console.log('更新歌词', payload.LyricList)
8 | payload.callback && payload.callback()
9 | },
10 | [UPDATE](state, payload) {
11 | let { src, coverImgUrl, singer, title, id, _name, _singer, _picUrl, song } = payload
12 |
13 | state.audio.src = src
14 | state.audio.coverImgUrl = coverImgUrl
15 | state.audio.singer = singer
16 | state.audio.title = title
17 | state.audio.id = id
18 | state.audio._name = _name
19 | state.audio._singer = _singer
20 | state.audio._picUrl = _picUrl
21 | state.song = song
22 | state.song.src = src
23 |
24 | payload.callback && payload.callback()
25 | },
26 | [SETGLOBALDATA](state, payload) {
27 | let { key, value } = payload
28 | state[key] = value
29 | },
30 | [PREVSONG](state, payload) {
31 | for (let [index, item] of state.songList.entries()) {
32 | if (item.id === state.song.id) {
33 | if (index === 0) {
34 | uni.showToast({
35 | title: '没有了 o(╥﹏╥)o ',
36 | icon: 'none',
37 | duration: 1000
38 | })
39 | return
40 | }
41 | payload.callback(state.songList[index - 1])
42 | }
43 | }
44 | },
45 | [NEXTSONG](state, payload) {
46 | for (let [index, item] of state.songList.entries()) {
47 | if (item.id === state.song.id) {
48 | if (index === state.songList.length - 1) {
49 | uni.showToast({
50 | title: '没有了 o(╥﹏╥)o ',
51 | icon: 'none',
52 | duration: 1000
53 | })
54 | return
55 | }
56 | payload.callback(state.songList[index + 1])
57 | return
58 | }
59 | }
60 | }
61 | }
62 |
63 | export default mutations
64 |
--------------------------------------------------------------------------------
/src/store/state.js:
--------------------------------------------------------------------------------
1 | const state = {
2 | song: null, //当前播放歌曲数据
3 | // song: {
4 | // al: {
5 | // picUrl: 'http://p1.music.126.net/gk7CUPP62r9bidqVJwgNhQ==/109951163375219616.jpg', //图片
6 | // name: 'PIT' //名字
7 | // },
8 | // id: null, //id
9 | // src: '', //地址
10 | // _singer: '' //歌手
11 | // }, //当前播放歌曲数据
12 | audio: null,
13 | mode: 1, //当前播放模式,1-单曲循环,2-顺序播放,3-随机播放
14 | songList: [] //播放列表
15 | }
16 |
17 | export default state
18 |
--------------------------------------------------------------------------------
/src/uni.scss:
--------------------------------------------------------------------------------
1 | /**
2 | * 这里是uni-app内置的常用样式变量
3 | *
4 | * uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
5 | * 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
6 | *
7 | */
8 |
9 | /**
10 | * 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
11 | *
12 | * 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
13 | */
14 |
15 | /* 颜色变量 */
16 |
17 | /* 行为相关颜色 */
18 | $uni-color-primary: #007aff;
19 | $uni-color-success: #4cd964;
20 | $uni-color-warning: #f0ad4e;
21 | $uni-color-error: #dd524d;
22 |
23 | /* 文字基本颜色 */
24 | $uni-text-color:#333;//基本色
25 | $uni-text-color-inverse:#fff;//反色
26 | $uni-text-color-grey:#999;//辅助灰色,如加载更多的提示信息
27 | $uni-text-color-placeholder: #808080;
28 | $uni-text-color-disable:#c0c0c0;
29 |
30 | /* 背景颜色 */
31 | $uni-bg-color:#ffffff;
32 | $uni-bg-color-grey:#f8f8f8;
33 | $uni-bg-color-hover:#f1f1f1;//点击状态颜色
34 | $uni-bg-color-mask:rgba(0, 0, 0, 0.4);//遮罩颜色
35 |
36 | /* 边框颜色 */
37 | $uni-border-color:#c8c7cc;
38 |
39 | /* 尺寸变量 */
40 |
41 | /* 文字尺寸 */
42 | $uni-font-size-sm:24upx;
43 | $uni-font-size-base:28upx;
44 | $uni-font-size-lg:32upx;
45 |
46 | /* 图片尺寸 */
47 | $uni-img-size-sm:40upx;
48 | $uni-img-size-base:52upx;
49 | $uni-img-size-lg:80upx;
50 |
51 | /* Border Radius */
52 | $uni-border-radius-sm: 4upx;
53 | $uni-border-radius-base: 6upx;
54 | $uni-border-radius-lg: 12upx;
55 | $uni-border-radius-circle: 50%;
56 |
57 | /* 水平间距 */
58 | $uni-spacing-row-sm: 10px;
59 | $uni-spacing-row-base: 20upx;
60 | $uni-spacing-row-lg: 30upx;
61 |
62 | /* 垂直间距 */
63 | $uni-spacing-col-sm: 8upx;
64 | $uni-spacing-col-base: 16upx;
65 | $uni-spacing-col-lg: 24upx;
66 |
67 | /* 透明度 */
68 | $uni-opacity-disabled: 0.3; // 组件禁用态的透明度
69 |
70 | /* 文章场景相关 */
71 | $uni-color-title: #2C405A; // 文章标题颜色
72 | $uni-font-size-title:40upx;
73 | $uni-color-subtitle: #555555; // 二级标题颜色
74 | $uni-font-size-subtitle:36upx;
75 | $uni-color-paragraph: #3F536E; // 文章段落颜色
76 | $uni-font-size-paragraph:30upx;
--------------------------------------------------------------------------------
/src/utils/index.js:
--------------------------------------------------------------------------------
1 | const utils = {}
2 | // eslint-disable-next-line no-unused-vars
3 | utils.install = function(Vue, options) {
4 | /*
5 | * 时间格式化
6 | * @method GetDateTime
7 | * @param {Object} dateObj 时间对象 new Date()
8 | * @param {string} format 格式 例如 'Y-m-d h:i:s'
9 | * @return {string}
10 | */
11 | (Vue.prototype.$GetDateTime = function(dateObj, format) {
12 | if (dateObj) {
13 | if (typeof dateObj === 'string') {
14 | let tempIndex = dateObj.lastIndexOf('.')
15 | if (tempIndex > -1) {
16 | dateObj = dateObj.substring(0, tempIndex)
17 | }
18 |
19 | dateObj = dateObj.replace('T', ' ').replace(/-/g, '/')
20 | }
21 | let date = new Date(dateObj)
22 |
23 | let obj = {
24 | y: date.getFullYear(),
25 | m: date.getMonth() + 1,
26 | d: date.getDate(),
27 | h: date.getHours(),
28 | min: date.getMinutes(),
29 | s: date.getSeconds()
30 | }
31 | for (const key in obj) {
32 | if (obj.hasOwnProperty(key)) {
33 | let element = obj[key]
34 | obj[key] = element < 10 ? '0' + element : element
35 | }
36 | }
37 | if (format) {
38 | return format
39 | .replace('Y', obj.y)
40 | .replace('m', obj.m)
41 | .replace('d', obj.d)
42 | .replace('h', obj.h)
43 | .replace('i', obj.min)
44 | .replace('s', obj.s)
45 | }
46 |
47 | return (
48 | obj.y +
49 | '-' +
50 | obj.m +
51 | '-' +
52 | obj.d +
53 | ' ' +
54 | obj.h +
55 | ':' +
56 | obj.min +
57 | ':' +
58 | obj.s
59 | ) //返回时间格式
60 | } else return ''
61 | })
62 | }
63 | export default utils
64 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/action-sheet/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | import { iphonex } from '../mixins/iphonex';
3 | VantComponent({
4 | mixins: [iphonex],
5 | props: {
6 | show: Boolean,
7 | title: String,
8 | cancelText: String,
9 | zIndex: {
10 | type: Number,
11 | value: 100
12 | },
13 | actions: {
14 | type: Array,
15 | value: []
16 | },
17 | overlay: {
18 | type: Boolean,
19 | value: true
20 | },
21 | closeOnClickOverlay: {
22 | type: Boolean,
23 | value: true
24 | }
25 | },
26 | methods: {
27 | onSelect: function onSelect(event) {
28 | var index = event.currentTarget.dataset.index;
29 | var item = this.data.actions[index];
30 |
31 | if (item && !item.disabled && !item.loading) {
32 | this.$emit('select', item);
33 | }
34 | },
35 | onCancel: function onCancel() {
36 | this.$emit('cancel');
37 | },
38 | onClose: function onClose() {
39 | this.$emit('close');
40 | }
41 | }
42 | });
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/action-sheet/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-icon": "../icon/index",
5 | "van-popup": "../popup/index",
6 | "van-loading": "../loading/index"
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/action-sheet/index.wxml:
--------------------------------------------------------------------------------
1 |
11 |
19 |
20 |
21 |
35 |
36 |
41 | {{ cancelText }}
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/action-sheet/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-action-sheet{max-height:90%!important;color:#333}.van-action-sheet__cancel,.van-action-sheet__item{height:50px;font-size:16px;line-height:50px;text-align:center;background-color:#fff}.van-action-sheet__cancel:active,.van-action-sheet__item:active{background-color:#e8e8e8}.van-action-sheet__cancel{height:60px}.van-action-sheet__cancel::before{display:block;content:' ';height:10px;background-color:#f8f8f8}.van-action-sheet__item--disabled{color:#c9c9c9}.van-action-sheet__item--disabled:active{background-color:#fff}.van-action-sheet__subname{margin-left:5px;font-size:12px;color:#7d7e80}.van-action-sheet__header{font-size:16px;font-weight:500;line-height:44px;text-align:center}.van-action-sheet__close{position:absolute!important;top:0;right:0;padding:0 15px;font-size:18px!important;line-height:inherit!important;color:#999}
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/area/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-picker": "../picker/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/area/index.wxml:
--------------------------------------------------------------------------------
1 |
17 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/area/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/badge-group/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | import { isNumber } from '../common/utils';
3 | VantComponent({
4 | relation: {
5 | name: 'badge',
6 | type: 'descendant',
7 | linked: function linked(target) {
8 | this.badges.push(target);
9 | this.setActive();
10 | },
11 | unlinked: function unlinked(target) {
12 | this.badges = this.badges.filter(function (item) {
13 | return item !== target;
14 | });
15 | this.setActive();
16 | }
17 | },
18 | props: {
19 | active: {
20 | type: Number,
21 | value: 0
22 | }
23 | },
24 | watch: {
25 | active: 'setActive'
26 | },
27 | beforeCreate: function beforeCreate() {
28 | this.badges = [];
29 | this.currentActive = -1;
30 | },
31 | methods: {
32 | setActive: function setActive(badge) {
33 | var active = this.data.active;
34 | var badges = this.badges;
35 |
36 | if (badge && !isNumber(badge)) {
37 | active = badges.indexOf(badge);
38 | }
39 |
40 | if (active === this.currentActive) {
41 | return;
42 | }
43 |
44 | if (this.currentActive !== -1 && badges[this.currentActive]) {
45 | this.$emit('change', active);
46 | badges[this.currentActive].setActive(false);
47 | }
48 |
49 | if (badges[active]) {
50 | badges[active].setActive(true);
51 | this.currentActive = active;
52 | }
53 | }
54 | }
55 | });
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/badge-group/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/badge-group/index.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
67 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/badge-group/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/badge-group/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-badge-group{width:85px}
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/badge/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | VantComponent({
3 | relation: {
4 | type: 'ancestor',
5 | name: 'badge-group'
6 | },
7 | props: {
8 | info: null,
9 | title: String
10 | },
11 | methods: {
12 | onClick: function onClick() {
13 | var group = this.getRelationNodes('../badge-group/index')[0];
14 |
15 | if (group) {
16 | group.setActive(this);
17 | }
18 | },
19 | setActive: function setActive(active) {
20 | this.set({
21 | active: active
22 | });
23 | }
24 | }
25 | });
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/badge/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-info": "../info/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/badge/index.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {{ title }}
6 |
7 |
8 |
9 |
10 |
42 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/badge/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 | {{ title }}
9 |
10 |
11 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/badge/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-badge{display:block;overflow:hidden;font-size:14px;line-height:1.4;-webkit-user-select:none;user-select:none;color:#7d7e80;word-break:break-all;box-sizing:border-box;padding:20px 12px 20px 9px;background-color:#f8f8f8;border-left:3px solid transparent}.van-badge:active{background-color:#e8e8e8}.van-badge::after{border-bottom-width:1px}.van-badge--active{font-weight:700;color:#333;border-color:#f44}.van-badge--active::after{border-right-width:1px}.van-badge--active,.van-badge--active:active{background-color:#fff}.van-badge__text{position:relative}
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/button/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | import { button } from '../mixins/button';
3 | import { openType } from '../mixins/open-type';
4 | VantComponent({
5 | classes: ['loading-class'],
6 | mixins: [button, openType],
7 | props: {
8 | plain: Boolean,
9 | block: Boolean,
10 | round: Boolean,
11 | square: Boolean,
12 | loading: Boolean,
13 | disabled: Boolean,
14 | type: {
15 | type: String,
16 | value: 'default'
17 | },
18 | size: {
19 | type: String,
20 | value: 'normal'
21 | }
22 | },
23 | methods: {
24 | onClick: function onClick() {
25 | if (!this.data.disabled && !this.data.loading) {
26 | this.$emit('click');
27 | }
28 | }
29 | }
30 | });
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/button/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-loading": "../loading/index"
5 | }
6 | }
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/button/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
29 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/button/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-button{position:relative;padding:0;display:inline-block;height:44px;line-height:42px;border-radius:2px;box-sizing:border-box;font-size:16px;text-align:center;vertical-align:middle;-webkit-appearance:none;-webkit-text-size-adjust:100%}.van-button::after{content:" ";position:absolute;top:50%;left:50%;opacity:0;width:100%;height:100%;border:inherit;border-color:#000;background-color:#000;border-radius:inherit;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}.van-button:active::after{opacity:.15}.van-button--unclickable::after{display:none}.van-button--default{color:#333;background-color:#fff;border:1px solid #eee}.van-button--primary{color:#fff;background-color:#4b0;border:1px solid #4b0}.van-button--danger{color:#fff;background-color:#f44;border:1px solid #f44}.van-button--warning{color:#fff;background-color:#ff976a;border:1px solid #ff976a}.van-button--plain{background-color:#fff}.van-button--plain.van-button--primary{color:#4b0}.van-button--plain.van-button--danger{color:#f44}.van-button--plain.van-button--warning{color:#ff976a}.van-button--large{width:100%;height:50px;line-height:48px}.van-button--normal{padding:0 15px;font-size:14px}.van-button--small{height:30px;padding:0 8px;min-width:60px;font-size:12px;line-height:28px}.van-button--mini{display:inline-block;width:50px;height:22px;line-height:20px;font-size:10px}.van-button--mini+.van-button--mini{margin-left:5px}.van-button--block{width:100%;display:block}.van-button--round{border-radius:10em}.van-button--square{border-radius:0}.van-button--disabled{opacity:.5}
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/card/index.js:
--------------------------------------------------------------------------------
1 | import { link } from '../mixins/link';
2 | import { VantComponent } from '../common/component';
3 | VantComponent({
4 | classes: ['num-class', 'desc-class', 'thumb-class', 'title-class', 'price-class', 'origin-price-class'],
5 | mixins: [link],
6 | props: {
7 | tag: String,
8 | num: String,
9 | desc: String,
10 | thumb: String,
11 | title: String,
12 | price: String,
13 | centered: Boolean,
14 | lazyLoad: Boolean,
15 | thumbLink: String,
16 | originPrice: String,
17 | thumbMode: {
18 | type: String,
19 | value: 'aspectFit'
20 | },
21 | currency: {
22 | type: String,
23 | value: '¥'
24 | }
25 | },
26 | methods: {
27 | onClickThumb: function onClickThumb() {
28 | this.jumpLink('thumbLink');
29 | }
30 | }
31 | });
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/card/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-tag": "../tag/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/card/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
38 |
39 |
42 |
43 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/card/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-card{position:relative;padding:5px 15px;font-size:12px;color:#333;box-sizing:border-box;background-color:#fafafa}.van-card--center{-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center}.van-card__header{display:-webkit-flex;display:flex}.van-card__thumb{position:relative;width:90px;height:90px;margin-right:10px;-webkit-flex:none;flex:none}.van-card__thumb:empty{display:none}.van-card__img{width:100%;height:100%}.van-card__content{position:relative;-webkit-flex:1;flex:1;height:90px;min-width:0}.van-card__desc,.van-card__title{word-break:break-all}.van-card__title{max-height:32px;line-height:16px;font-weight:700}.van-card__desc{max-height:20px;line-height:20px;color:#7d7e80}.van-card__bottom{position:absolute;bottom:0;left:0;width:100%;line-height:18px}.van-card__price{display:inline-block;font-weight:700;color:#f44}.van-card__origin-price{display:inline-block;margin-left:5px;font-size:10px;color:#7d7e80;text-decoration:line-through}.van-card__num{float:right}.van-card__tag{position:absolute;top:2px;left:0}.van-card__footer{width:100%;text-align:right;-webkit-flex:none;flex:none}
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/cell-group/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | VantComponent({
3 | props: {
4 | border: {
5 | type: Boolean,
6 | value: true
7 | }
8 | }
9 | });
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/cell-group/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/cell-group/index.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
21 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/cell-group/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/cell-group/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/cell/index.js:
--------------------------------------------------------------------------------
1 | import { link } from '../mixins/link';
2 | import { VantComponent } from '../common/component';
3 | VantComponent({
4 | classes: ['title-class', 'label-class', 'value-class', 'right-icon-class'],
5 | mixins: [link],
6 | props: {
7 | title: null,
8 | value: null,
9 | icon: String,
10 | size: String,
11 | label: String,
12 | center: Boolean,
13 | isLink: Boolean,
14 | required: Boolean,
15 | clickable: Boolean,
16 | titleWidth: String,
17 | customStyle: String,
18 | arrowDirection: String,
19 | border: {
20 | type: Boolean,
21 | value: true
22 | }
23 | },
24 | methods: {
25 | onClick: function onClick(event) {
26 | this.$emit('click', event.detail);
27 | this.jumpLink();
28 | }
29 | }
30 | });
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/cell/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-icon": "../icon/index"
5 | }
6 | }
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/cell/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
14 |
15 |
16 |
20 |
21 | {{ title }}
22 | {{ label }}
23 |
24 |
25 |
26 |
27 |
28 | {{ value }}
29 |
30 |
31 |
32 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/cell/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-cell{width:100%;display:-webkit-flex;display:flex;padding:10px 15px;box-sizing:border-box;line-height:24px;position:relative;background-color:#fff;color:#333;font-size:14px}.van-cell::after{content:' ';position:absolute;pointer-events:none;box-sizing:border-box;-webkit-transform-origin:center;transform-origin:center;top:auto;left:15px;right:0;bottom:0;-webkit-transform:scaleY(.5);transform:scaleY(.5);border-bottom:1px solid #eee}.van-cell--borderless::after{display:none}.van-cell-group{background-color:#fff}.van-cell__label{color:#999;font-size:12px;margin-top:3px;line-height:18px}.van-cell__title,.van-cell__value{-webkit-flex:1;flex:1}.van-cell__title:empty,.van-cell__value:empty{display:none}.van-cell__value{color:#999;overflow:hidden;text-align:right;vertical-align:middle}.van-cell__left-icon-wrap,.van-cell__right-icon-wrap{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;height:24px;font-size:16px}.van-cell__left-icon-wrap{margin-right:5px}.van-cell__right-icon-wrap{margin-left:5px;color:#999}.van-cell__left-icon{line-height:24px;vertical-align:middle}.van-cell__right-icon{line-height:24px}.van-cell--clickable:active{background-color:#e8e8e8}.van-cell--required{overflow:visible}.van-cell--required::before{content:'*';position:absolute;left:7px;font-size:14px;color:#f44}.van-cell--center{-webkit-align-items:center;align-items:center}.van-cell--large{padding-top:12px;padding-bottom:12px}.van-cell--large .van-cell__title{font-size:16px}.van-cell--large .van-cell__label{font-size:14px}
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/checkbox-group/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | VantComponent({
3 | field: true,
4 | relation: {
5 | name: 'checkbox',
6 | type: 'descendant',
7 | linked: function linked(target) {
8 | var _this$data = this.data,
9 | value = _this$data.value,
10 | disabled = _this$data.disabled;
11 | target.set({
12 | value: value.indexOf(target.data.name) !== -1,
13 | disabled: disabled || target.data.disabled
14 | });
15 | }
16 | },
17 | props: {
18 | max: Number,
19 | value: Array,
20 | disabled: Boolean
21 | },
22 | watch: {
23 | value: function value(_value) {
24 | var children = this.getRelationNodes('../checkbox/index');
25 | children.forEach(function (child) {
26 | child.set({
27 | value: _value.indexOf(child.data.name) !== -1
28 | });
29 | });
30 | },
31 | disabled: function disabled(_disabled) {
32 | var children = this.getRelationNodes('../checkbox/index');
33 | children.forEach(function (child) {
34 | child.set({
35 | disabled: _disabled || child.data.disabled
36 | });
37 | });
38 | }
39 | }
40 | });
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/checkbox-group/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-icon": "../icon/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/checkbox-group/index.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
52 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/checkbox-group/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/checkbox-group/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/checkbox/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | VantComponent({
3 | field: true,
4 | relation: {
5 | name: 'checkbox-group',
6 | type: 'ancestor'
7 | },
8 | classes: ['icon-class', 'label-class'],
9 | props: {
10 | value: null,
11 | disabled: Boolean,
12 | useIconSlot: Boolean,
13 | checkedColor: String,
14 | labelPosition: String,
15 | labelDisabled: Boolean,
16 | shape: {
17 | type: String,
18 | value: 'round'
19 | }
20 | },
21 | methods: {
22 | emitChange: function emitChange(value) {
23 | var parent = this.getRelationNodes('../checkbox-group/index')[0];
24 |
25 | if (parent) {
26 | this.setParentValue(parent, value);
27 | } else {
28 | this.$emit('input', value);
29 | this.$emit('change', value);
30 | }
31 | },
32 | toggle: function toggle() {
33 | if (!this.data.disabled) {
34 | this.emitChange(!this.data.value);
35 | }
36 | },
37 | onClickLabel: function onClickLabel() {
38 | if (!this.data.disabled && !this.data.labelDisabled) {
39 | this.emitChange(!this.data.value);
40 | }
41 | },
42 | setParentValue: function setParentValue(parent, value) {
43 | var parentValue = parent.data.value.slice();
44 | var name = this.data.name;
45 |
46 | if (value) {
47 | if (parent.data.max && parentValue.length >= parent.data.max) {
48 | return;
49 | }
50 | /* istanbul ignore else */
51 |
52 |
53 | if (parentValue.indexOf(name) === -1) {
54 | parentValue.push(name);
55 | parent.$emit('input', parentValue);
56 | parent.$emit('change', parentValue);
57 | }
58 | } else {
59 | var index = parentValue.indexOf(name);
60 | /* istanbul ignore else */
61 |
62 | if (index !== -1) {
63 | parentValue.splice(index, 1);
64 | parent.$emit('input', parentValue);
65 | parent.$emit('change', parentValue);
66 | }
67 | }
68 | }
69 | }
70 | });
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/checkbox/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-icon": "../icon/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/checkbox/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/checkbox/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-checkbox{overflow:hidden;-webkit-user-select:none;user-select:none}.van-checkbox__icon-wrap,.van-checkbox__label{display:inline-block;line-height:20px;vertical-align:middle}.van-checkbox__icon{display:block;font-size:14px;width:20px;height:20px;color:transparent;text-align:center;box-sizing:border-box;border:1px solid #e5e5e5;transition:.2s}.van-checkbox__icon--round{border-radius:100%}.van-checkbox__icon--checked{color:#fff;border-color:#1989fa;background-color:#1989fa}.van-checkbox__icon--disabled{border-color:#c9c9c9;background-color:#eee}.van-checkbox__icon--disabled.van-checkbox__icon--checked{color:#c9c9c9}.van-checkbox__label{color:#333;margin-left:10px}.van-checkbox__label--left{float:left;margin:0 10px 0 0}.van-checkbox__label--disabled{color:#c9c9c9}.van-checkbox__label:empty{margin:0}
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/col/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | VantComponent({
3 | relation: {
4 | name: 'row',
5 | type: 'ancestor'
6 | },
7 | props: {
8 | span: Number,
9 | offset: Number
10 | },
11 | data: {
12 | style: ''
13 | },
14 | methods: {
15 | setGutter: function setGutter(gutter) {
16 | var padding = gutter / 2 + "px";
17 | var style = gutter ? "padding-left: " + padding + "; padding-right: " + padding + ";" : '';
18 |
19 | if (style !== this.data.style) {
20 | this.set({
21 | style: style
22 | });
23 | }
24 | }
25 | }
26 | });
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/col/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/col/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/col/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-col{float:left;box-sizing:border-box}.van-col--1{width:4.16666667%}.van-col--offset-1{margin-left:4.16666667%}.van-col--2{width:8.33333333%}.van-col--offset-2{margin-left:8.33333333%}.van-col--3{width:12.5%}.van-col--offset-3{margin-left:12.5%}.van-col--4{width:16.66666667%}.van-col--offset-4{margin-left:16.66666667%}.van-col--5{width:20.83333333%}.van-col--offset-5{margin-left:20.83333333%}.van-col--6{width:25%}.van-col--offset-6{margin-left:25%}.van-col--7{width:29.16666667%}.van-col--offset-7{margin-left:29.16666667%}.van-col--8{width:33.33333333%}.van-col--offset-8{margin-left:33.33333333%}.van-col--9{width:37.5%}.van-col--offset-9{margin-left:37.5%}.van-col--10{width:41.66666667%}.van-col--offset-10{margin-left:41.66666667%}.van-col--11{width:45.83333333%}.van-col--offset-11{margin-left:45.83333333%}.van-col--12{width:50%}.van-col--offset-12{margin-left:50%}.van-col--13{width:54.16666667%}.van-col--offset-13{margin-left:54.16666667%}.van-col--14{width:58.33333333%}.van-col--offset-14{margin-left:58.33333333%}.van-col--15{width:62.5%}.van-col--offset-15{margin-left:62.5%}.van-col--16{width:66.66666667%}.van-col--offset-16{margin-left:66.66666667%}.van-col--17{width:70.83333333%}.van-col--offset-17{margin-left:70.83333333%}.van-col--18{width:75%}.van-col--offset-18{margin-left:75%}.van-col--19{width:79.16666667%}.van-col--offset-19{margin-left:79.16666667%}.van-col--20{width:83.33333333%}.van-col--offset-20{margin-left:83.33333333%}.van-col--21{width:87.5%}.van-col--offset-21{margin-left:87.5%}.van-col--22{width:91.66666667%}.van-col--offset-22{margin-left:91.66666667%}.van-col--23{width:95.83333333%}.van-col--offset-23{margin-left:95.83333333%}.van-col--24{width:100%}.van-col--offset-24{margin-left:100%}
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/collapse-item/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-cell": "../cell/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/collapse-item/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
16 |
20 |
24 |
25 |
29 |
30 |
36 |
39 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/collapse-item/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-collapse-item__title .van-cell__right-icon{-webkit-transform:rotate(90deg);transform:rotate(90deg);transition:.3s}.van-collapse-item__title--expanded .van-cell__right-icon{-webkit-transform:rotate(-90deg);transform:rotate(-90deg)}.van-collapse-item__title--disabled .van-cell,.van-collapse-item__title--disabled .van-cell__right-icon{color:#c9c9c9!important}.van-collapse-item__title--disabled .van-cell:active{background-color:#fff!important}.van-collapse-item__wrapper{overflow:hidden}.van-collapse-item__content{color:#999;padding:15px;font-size:13px;line-height:1.5;background-color:#fff}
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/collapse/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | VantComponent({
3 | relation: {
4 | name: 'collapse-item',
5 | type: 'descendant',
6 | linked: function linked(child) {
7 | this.set({
8 | items: [].concat(this.data.items, [child])
9 | }, function () {
10 | child.updateExpanded();
11 | });
12 | }
13 | },
14 | props: {
15 | accordion: Boolean,
16 | value: null
17 | },
18 | data: {
19 | items: []
20 | },
21 | watch: {
22 | value: function value() {
23 | this.data.items.forEach(function (child) {
24 | child.updateExpanded();
25 | });
26 | },
27 | accordion: function accordion() {
28 | this.data.items.forEach(function (child) {
29 | child.updateExpanded();
30 | });
31 | }
32 | },
33 | methods: {
34 | switch: function _switch(name, expanded) {
35 | var _this$data = this.data,
36 | accordion = _this$data.accordion,
37 | value = _this$data.value;
38 |
39 | if (!accordion) {
40 | name = expanded ? value.concat(name) : value.filter(function (activeName) {
41 | return activeName !== name;
42 | });
43 | } else {
44 | name = expanded ? name : '';
45 | }
46 |
47 | this.$emit('change', name);
48 | this.$emit('input', name);
49 | }
50 | }
51 | });
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/collapse/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/collapse/index.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
63 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/collapse/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/common/color.js:
--------------------------------------------------------------------------------
1 | export var RED = '#f44';
2 | export var BLUE = '#1989fa';
3 | export var GREEN = '#4b0';
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/common/component.js:
--------------------------------------------------------------------------------
1 | import { basic } from '../mixins/basic';
2 | import { observe } from '../mixins/observer/index';
3 |
4 | function mapKeys(source, target, map) {
5 | Object.keys(map).forEach(function (key) {
6 | if (source[key]) {
7 | target[map[key]] = source[key];
8 | }
9 | });
10 | }
11 |
12 | function VantComponent(vantOptions) {
13 | if (vantOptions === void 0) {
14 | vantOptions = {};
15 | }
16 |
17 | var options = {};
18 | mapKeys(vantOptions, options, {
19 | data: 'data',
20 | props: 'properties',
21 | mixins: 'behaviors',
22 | methods: 'methods',
23 | beforeCreate: 'created',
24 | created: 'attached',
25 | mounted: 'ready',
26 | relations: 'relations',
27 | destroyed: 'detached',
28 | classes: 'externalClasses'
29 | });
30 | var _vantOptions = vantOptions,
31 | relation = _vantOptions.relation;
32 |
33 | if (relation) {
34 | options.relations = Object.assign(options.relations || {}, {
35 | ["../" + relation.name + "/index"]: relation
36 | });
37 | } // add default externalClasses
38 |
39 |
40 | options.externalClasses = options.externalClasses || [];
41 | options.externalClasses.push('custom-class'); // add default behaviors
42 |
43 | options.behaviors = options.behaviors || [];
44 | options.behaviors.push(basic); // map field to form-field behavior
45 |
46 | if (vantOptions.field) {
47 | options.behaviors.push('wx://form-field');
48 | } // add default options
49 |
50 |
51 | options.options = {
52 | multipleSlots: true,
53 | addGlobalClass: true
54 | };
55 | observe(vantOptions, options);
56 | Component(options);
57 | }
58 |
59 | export { VantComponent };
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/common/index.css:
--------------------------------------------------------------------------------
1 | .van-ellipsis{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.van-multi-ellipsis--l2{overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}.van-multi-ellipsis--l3{overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical}.van-clearfix::after{content:'';display:table;clear:both}.van-hairline,.van-hairline--bottom,.van-hairline--left,.van-hairline--right,.van-hairline--surround,.van-hairline--top,.van-hairline--top-bottom{position:relative}.van-hairline--bottom::after,.van-hairline--left::after,.van-hairline--right::after,.van-hairline--surround::after,.van-hairline--top-bottom::after,.van-hairline--top::after,.van-hairline::after{content:' ';position:absolute;pointer-events:none;box-sizing:border-box;-webkit-transform-origin:center;transform-origin:center;top:-50%;left:-50%;right:-50%;bottom:-50%;-webkit-transform:scale(.5);transform:scale(.5);border:0 solid #eee}.van-hairline--top::after{border-top-width:1px}.van-hairline--left::after{border-left-width:1px}.van-hairline--right::after{border-right-width:1px}.van-hairline--bottom::after{border-bottom-width:1px}.van-hairline--top-bottom::after{border-width:1px 0}.van-hairline--surround::after{border-width:1px}
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/common/index.wxss:
--------------------------------------------------------------------------------
1 | .van-ellipsis{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.van-multi-ellipsis--l2{overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}.van-multi-ellipsis--l3{overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical}.van-clearfix::after{content:'';display:table;clear:both}.van-hairline,.van-hairline--bottom,.van-hairline--left,.van-hairline--right,.van-hairline--surround,.van-hairline--top,.van-hairline--top-bottom{position:relative}.van-hairline--bottom::after,.van-hairline--left::after,.van-hairline--right::after,.van-hairline--surround::after,.van-hairline--top-bottom::after,.van-hairline--top::after,.van-hairline::after{content:' ';position:absolute;pointer-events:none;box-sizing:border-box;-webkit-transform-origin:center;transform-origin:center;top:-50%;left:-50%;right:-50%;bottom:-50%;-webkit-transform:scale(.5);transform:scale(.5);border:0 solid #eee}.van-hairline--top::after{border-top-width:1px}.van-hairline--left::after{border-left-width:1px}.van-hairline--right::after{border-right-width:1px}.van-hairline--bottom::after{border-bottom-width:1px}.van-hairline--top-bottom::after{border-width:1px 0}.van-hairline--surround::after{border-width:1px}
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/common/style/clearfix.css:
--------------------------------------------------------------------------------
1 | .van-clearfix::after{content:'';display:table;clear:both}
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/common/style/clearfix.wxss:
--------------------------------------------------------------------------------
1 | .van-clearfix::after{content:'';display:table;clear:both}
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/common/style/ellipsis.css:
--------------------------------------------------------------------------------
1 | .van-ellipsis{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.van-multi-ellipsis--l2{overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}.van-multi-ellipsis--l3{overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical}
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/common/style/ellipsis.wxss:
--------------------------------------------------------------------------------
1 | .van-ellipsis{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.van-multi-ellipsis--l2{overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}.van-multi-ellipsis--l3{overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical}
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/common/style/hairline.css:
--------------------------------------------------------------------------------
1 | .van-hairline,.van-hairline--bottom,.van-hairline--left,.van-hairline--right,.van-hairline--surround,.van-hairline--top,.van-hairline--top-bottom{position:relative}.van-hairline--bottom::after,.van-hairline--left::after,.van-hairline--right::after,.van-hairline--surround::after,.van-hairline--top-bottom::after,.van-hairline--top::after,.van-hairline::after{content:' ';position:absolute;pointer-events:none;box-sizing:border-box;-webkit-transform-origin:center;transform-origin:center;top:-50%;left:-50%;right:-50%;bottom:-50%;-webkit-transform:scale(.5);transform:scale(.5);border:0 solid #eee}.van-hairline--top::after{border-top-width:1px}.van-hairline--left::after{border-left-width:1px}.van-hairline--right::after{border-right-width:1px}.van-hairline--bottom::after{border-bottom-width:1px}.van-hairline--top-bottom::after{border-width:1px 0}.van-hairline--surround::after{border-width:1px}
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/common/style/hairline.wxss:
--------------------------------------------------------------------------------
1 | .van-hairline,.van-hairline--bottom,.van-hairline--left,.van-hairline--right,.van-hairline--surround,.van-hairline--top,.van-hairline--top-bottom{position:relative}.van-hairline--bottom::after,.van-hairline--left::after,.van-hairline--right::after,.van-hairline--surround::after,.van-hairline--top-bottom::after,.van-hairline--top::after,.van-hairline::after{content:' ';position:absolute;pointer-events:none;box-sizing:border-box;-webkit-transform-origin:center;transform-origin:center;top:-50%;left:-50%;right:-50%;bottom:-50%;-webkit-transform:scale(.5);transform:scale(.5);border:0 solid #eee}.van-hairline--top::after{border-top-width:1px}.van-hairline--left::after{border-left-width:1px}.van-hairline--right::after{border-right-width:1px}.van-hairline--bottom::after{border-bottom-width:1px}.van-hairline--top-bottom::after{border-width:1px 0}.van-hairline--surround::after{border-width:1px}
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/common/style/mixins/clearfix.css:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CalmHarbin/uni-app-music/da507dcbf07668830f566599d77daa90068d406f/src/wxcomponents/vant-weapp/common/style/mixins/clearfix.css
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/common/style/mixins/clearfix.wxss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CalmHarbin/uni-app-music/da507dcbf07668830f566599d77daa90068d406f/src/wxcomponents/vant-weapp/common/style/mixins/clearfix.wxss
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/common/style/mixins/ellipsis.css:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CalmHarbin/uni-app-music/da507dcbf07668830f566599d77daa90068d406f/src/wxcomponents/vant-weapp/common/style/mixins/ellipsis.css
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/common/style/mixins/ellipsis.wxss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CalmHarbin/uni-app-music/da507dcbf07668830f566599d77daa90068d406f/src/wxcomponents/vant-weapp/common/style/mixins/ellipsis.wxss
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/common/style/mixins/hairline.css:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CalmHarbin/uni-app-music/da507dcbf07668830f566599d77daa90068d406f/src/wxcomponents/vant-weapp/common/style/mixins/hairline.css
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/common/style/mixins/hairline.wxss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CalmHarbin/uni-app-music/da507dcbf07668830f566599d77daa90068d406f/src/wxcomponents/vant-weapp/common/style/mixins/hairline.wxss
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/common/style/var.css:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CalmHarbin/uni-app-music/da507dcbf07668830f566599d77daa90068d406f/src/wxcomponents/vant-weapp/common/style/var.css
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/common/style/var.wxss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CalmHarbin/uni-app-music/da507dcbf07668830f566599d77daa90068d406f/src/wxcomponents/vant-weapp/common/style/var.wxss
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/common/utils.js:
--------------------------------------------------------------------------------
1 | function isDef(value) {
2 | return value !== undefined && value !== null;
3 | }
4 |
5 | function isObj(x) {
6 | var type = typeof x;
7 | return x !== null && (type === 'object' || type === 'function');
8 | }
9 |
10 | function isNumber(value) {
11 | return /^\d+$/.test(value);
12 | }
13 |
14 | function range(num, min, max) {
15 | return Math.min(Math.max(num, min), max);
16 | }
17 |
18 | export { isObj, isDef, isNumber, range };
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/datetime-picker/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-picker": "../picker/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/datetime-picker/index.wxml:
--------------------------------------------------------------------------------
1 |
14 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/datetime-picker/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-picker{-webkit-text-size-adjust:100%;position:relative;overflow:hidden;background-color:#fff;-webkit-user-select:none;user-select:none}.van-picker__toolbar{display:-webkit-flex;display:flex;-webkit-justify-content:space-between;justify-content:space-between;height:44px;line-height:44px}.van-picker__cancel,.van-picker__confirm{color:#1989fa;padding:0 15px;font-size:14px}.van-picker__cancel:active,.van-picker__confirm:active{background-color:#e8e8e8}.van-picker__title{max-width:50%;font-size:16px;font-weight:500;text-align:center}.van-picker__columns{position:relative}.van-picker__loading{display:-webkit-flex;display:flex;z-index:4;position:absolute;top:0;right:0;bottom:0;left:0;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;background-color:rgba(255,255,255,.9)}.van-picker-column{-webkit-flex:1;flex:1;overflow:hidden;font-size:16px;text-align:center}.van-picker-column__item{padding:0 5px;color:#999}.van-picker-column__item--selected{font-weight:500;color:#333}.van-picker-column__item--disabled{opacity:.3}
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/dialog/dialog.js:
--------------------------------------------------------------------------------
1 | function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2 |
3 | var queue = [];
4 |
5 | function getContext() {
6 | var pages = getCurrentPages();
7 | return pages[pages.length - 1];
8 | }
9 |
10 | var Dialog = function Dialog(options) {
11 | options = _extends({}, Dialog.currentOptions, options);
12 | return new Promise(function (resolve, reject) {
13 | var context = options.context || getContext();
14 | var dialog = context.selectComponent(options.selector);
15 | delete options.selector;
16 |
17 | if (dialog) {
18 | dialog.set(_extends({
19 | onCancel: reject,
20 | onConfirm: resolve
21 | }, options));
22 | queue.push(dialog);
23 | } else {
24 | console.warn('未找到 van-dialog 节点,请确认 selector 及 context 是否正确');
25 | }
26 | });
27 | };
28 |
29 | Dialog.defaultOptions = {
30 | show: true,
31 | title: '',
32 | message: '',
33 | zIndex: 100,
34 | overlay: true,
35 | asyncClose: false,
36 | messageAlign: '',
37 | transition: 'scale',
38 | selector: '#van-dialog',
39 | confirmButtonText: '确认',
40 | cancelButtonText: '取消',
41 | showConfirmButton: true,
42 | showCancelButton: false,
43 | closeOnClickOverlay: false,
44 | confirmButtonOpenType: ''
45 | };
46 | Dialog.alert = Dialog;
47 |
48 | Dialog.confirm = function (options) {
49 | return Dialog(_extends({
50 | showCancelButton: true
51 | }, options));
52 | };
53 |
54 | Dialog.close = function () {
55 | queue.forEach(function (dialog) {
56 | dialog.close();
57 | });
58 | queue = [];
59 | };
60 |
61 | Dialog.stopLoading = function () {
62 | queue.forEach(function (dialog) {
63 | dialog.stopLoading();
64 | });
65 | };
66 |
67 | Dialog.setDefaultOptions = function (options) {
68 | Object.assign(Dialog.currentOptions, options);
69 | };
70 |
71 | Dialog.resetDefaultOptions = function () {
72 | Dialog.currentOptions = _extends({}, Dialog.defaultOptions);
73 | };
74 |
75 | Dialog.resetDefaultOptions();
76 | export default Dialog;
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/dialog/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-popup": "../popup/index",
5 | "van-button": "../button/index"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/dialog/index.wxml:
--------------------------------------------------------------------------------
1 |
10 |
16 |
17 |
18 |
22 | {{ message }}
23 |
24 |
25 |
53 |
54 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/dialog/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-dialog{width:85%;font-size:16px;overflow:hidden;border-radius:4px;background-color:#fff}.van-dialog__header{font-weight:500;padding-top:25px;text-align:center}.van-dialog__header--isolated{padding:25px 0}.van-dialog__message{padding:25px;font-size:14px;line-height:1.5;max-height:60vh;overflow-y:auto;text-align:center;-webkit-overflow-scrolling:touch}.van-dialog__message--has-title{padding-top:12px;color:#7d7e80}.van-dialog__message--left{text-align:left}.van-dialog__message--right{text-align:right}.van-dialog__footer{display:-webkit-flex;display:flex}.van-dialog__button{-webkit-flex:1;flex:1}.van-dialog__cancel,.van-dialog__confirm{border:0!important}.van-dialog__confirm,.van-dialog__confirm:active{color:#1989fa!important}.van-dialog-bounce-enter{opacity:0;-webkit-transform:translate3d(-50%,-50%,0) scale(.7);transform:translate3d(-50%,-50%,0) scale(.7)}.van-dialog-bounce-leave-active{opacity:0;-webkit-transform:translate3d(-50%,-50%,0) scale(.9);transform:translate3d(-50%,-50%,0) scale(.9)}
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/field/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-cell": "../cell/index",
5 | "van-icon": "../icon/index"
6 | }
7 | }
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/field/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-field__body{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center}.van-field__body--textarea{min-height:24px}.van-field__input{border:0;margin:0;padding:0;width:100%;height:24px;resize:none;display:block;text-align:left;min-height:24px;color:#333;line-height:inherit;box-sizing:border-box;background-color:transparent}.van-field__input--disabled{opacity:1;color:#999;background-color:transparent}.van-field__input--center{text-align:center}.van-field__input--right{text-align:right}.van-field__input--error{color:#f44}.van-field__placeholder{color:#999}.van-field__clear-root{height:24px}.van-field__button,.van-field__clear,.van-field__icon-container{-webkit-flex-shrink:0;flex-shrink:0}.van-field__clear,.van-field__icon-container{padding:0 10px;line-height:inherit;margin-right:-10px;vertical-align:middle}.van-field__clear{color:#c9c9c9}.van-field__icon-container{color:#999}.van-field__icon{display:block!important}.van-field__button{padding-left:10px}.van-field__error-message{color:#f44;font-size:12px;text-align:left}
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/goods-action-button/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | import { link } from '../mixins/link';
3 | import { button } from '../mixins/button';
4 | import { openType } from '../mixins/open-type';
5 | VantComponent({
6 | mixins: [link, button, openType],
7 | props: {
8 | text: String,
9 | loading: Boolean,
10 | disabled: Boolean,
11 | type: {
12 | type: String,
13 | value: 'danger'
14 | }
15 | },
16 | methods: {
17 | onClick: function onClick(event) {
18 | this.$emit('click', event.detail);
19 | this.jumpLink();
20 | }
21 | }
22 | });
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/goods-action-button/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-button": "../button/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/goods-action-button/index.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 | {{ text }}
4 |
5 |
6 |
7 |
36 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/goods-action-button/index.wxml:
--------------------------------------------------------------------------------
1 |
24 | {{ text }}
25 |
26 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/goods-action-button/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';:host{-webkit-flex:1;flex:1}
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/goods-action-icon/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | import { link } from '../mixins/link';
3 | import { button } from '../mixins/button';
4 | import { openType } from '../mixins/open-type';
5 | VantComponent({
6 | mixins: [link, button, openType],
7 | props: {
8 | text: String,
9 | info: String,
10 | icon: String
11 | },
12 | methods: {
13 | onClick: function onClick(event) {
14 | this.$emit('click', event.detail);
15 | this.jumpLink();
16 | }
17 | }
18 | });
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/goods-action-icon/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-icon": "../icon/index",
5 | "van-button": "../button/index"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/goods-action-icon/index.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {{ text }}
6 |
7 |
8 |
9 |
10 |
36 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/goods-action-icon/index.wxml:
--------------------------------------------------------------------------------
1 |
23 |
24 |
30 | {{ text }}
31 |
32 |
33 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/goods-action-icon/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-goods-action-icon{width:50px!important;border:none!important}.van-goods-action-icon__content{height:100%;display:-webkit-flex;display:flex;line-height:1;font-size:10px;color:#7d7e80;-webkit-flex-direction:column;flex-direction:column;-webkit-justify-content:center;justify-content:center}.van-goods-action-icon__icon{margin-bottom:4px}
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/goods-action/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | import { iphonex } from '../mixins/iphonex';
3 | VantComponent({
4 | mixins: [iphonex]
5 | });
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/goods-action/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/goods-action/index.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
17 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/goods-action/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/goods-action/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-goods-action{position:fixed;right:0;bottom:0;left:0;display:-webkit-flex;display:flex;background-color:#fff}.van-goods-action--safe{padding-bottom:34px}
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/icon/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | VantComponent({
3 | props: {
4 | info: null,
5 | name: String,
6 | size: String,
7 | color: String,
8 | customStyle: String,
9 | classPrefix: {
10 | type: String,
11 | value: 'van-icon'
12 | }
13 | },
14 | methods: {
15 | onClick: function onClick() {
16 | this.$emit('click');
17 | }
18 | }
19 | });
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/icon/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-info": "../info/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/icon/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
12 |
16 |
17 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/info/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | VantComponent({
3 | props: {
4 | info: null,
5 | customStyle: String
6 | }
7 | });
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/info/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/info/index.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 | {{ info }}
4 |
5 |
6 |
7 |
19 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/info/index.wxml:
--------------------------------------------------------------------------------
1 |
6 | {{ info }}
7 |
8 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/info/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-info{position:absolute;right:0;top:-8px;color:#fff;font-size:12px;font-weight:500;font-family:PingFang SC,Helvetica Neue,Arial,sans-serif;text-align:center;box-sizing:border-box;padding:0 3px;min-width:16px;line-height:14px;border:1px solid #fff;border-radius:16px;background-color:#f44;-webkit-transform:translateX(50%);transform:translateX(50%);-webkit-transform-origin:100%;transform-origin:100%}
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/loading/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | VantComponent({
3 | props: {
4 | size: {
5 | type: String,
6 | value: '30px'
7 | },
8 | type: {
9 | type: String,
10 | value: 'circular'
11 | },
12 | color: {
13 | type: String,
14 | value: '#c9c9c9'
15 | }
16 | }
17 | });
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/loading/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/loading/index.wxml:
--------------------------------------------------------------------------------
1 |
5 |
9 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/loading/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-loading{z-index:0;line-height:0;position:relative;display:inline-block;vertical-align:middle}.van-loading__spinner{z-index:-1;width:100%;height:100%;position:relative;display:inline-block;box-sizing:border-box;-webkit-animation:van-rotate .8s linear infinite;animation:van-rotate .8s linear infinite}.van-loading__spinner--spinner{-webkit-animation-timing-function:steps(12);animation-timing-function:steps(12)}.van-loading__spinner--circular{border:1px solid;border-radius:100%;border-color:transparent;border-top-color:currentColor}.van-loading__dot{top:0;left:0;width:100%;height:100%;position:absolute}.van-loading__dot::before{width:2px;height:25%;content:' ';display:block;margin:0 auto;border-radius:40%;background-color:currentColor}.van-loading__dot:nth-of-type(1){opacity:1;-webkit-transform:rotate(30deg);transform:rotate(30deg)}.van-loading__dot:nth-of-type(2){opacity:.9375;-webkit-transform:rotate(60deg);transform:rotate(60deg)}.van-loading__dot:nth-of-type(3){opacity:.875;-webkit-transform:rotate(90deg);transform:rotate(90deg)}.van-loading__dot:nth-of-type(4){opacity:.8125;-webkit-transform:rotate(120deg);transform:rotate(120deg)}.van-loading__dot:nth-of-type(5){opacity:.75;-webkit-transform:rotate(150deg);transform:rotate(150deg)}.van-loading__dot:nth-of-type(6){opacity:.6875;-webkit-transform:rotate(180deg);transform:rotate(180deg)}.van-loading__dot:nth-of-type(7){opacity:.625;-webkit-transform:rotate(210deg);transform:rotate(210deg)}.van-loading__dot:nth-of-type(8){opacity:.5625;-webkit-transform:rotate(240deg);transform:rotate(240deg)}.van-loading__dot:nth-of-type(9){opacity:.5;-webkit-transform:rotate(270deg);transform:rotate(270deg)}.van-loading__dot:nth-of-type(10){opacity:.4375;-webkit-transform:rotate(300deg);transform:rotate(300deg)}.van-loading__dot:nth-of-type(11){opacity:.375;-webkit-transform:rotate(330deg);transform:rotate(330deg)}.van-loading__dot:nth-of-type(12){opacity:.3125;-webkit-transform:rotate(360deg);transform:rotate(360deg)}@-webkit-keyframes van-rotate{from{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes van-rotate{from{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/mixins/basic.js:
--------------------------------------------------------------------------------
1 | export var basic = Behavior({
2 | methods: {
3 | $emit: function $emit() {
4 | this.triggerEvent.apply(this, arguments);
5 | },
6 | getRect: function getRect(selector, all) {
7 | var _this = this;
8 |
9 | return new Promise(function (resolve) {
10 | wx.createSelectorQuery().in(_this)[all ? 'selectAll' : 'select'](selector).boundingClientRect(function (rect) {
11 | if (all && Array.isArray(rect) && rect.length) {
12 | resolve(rect);
13 | }
14 |
15 | if (!all && rect) {
16 | resolve(rect);
17 | }
18 | }).exec();
19 | });
20 | }
21 | }
22 | });
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/mixins/button.js:
--------------------------------------------------------------------------------
1 | export var button = Behavior({
2 | properties: {
3 | id: String,
4 | sessionFrom: String,
5 | appParameter: String,
6 | sendMessageImg: String,
7 | sendMessagePath: String,
8 | showMessageCard: String,
9 | sendMessageTitle: String,
10 | lang: {
11 | type: String,
12 | value: 'en'
13 | }
14 | }
15 | });
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/mixins/iphonex.js:
--------------------------------------------------------------------------------
1 | var isIPhoneX = null;
2 |
3 | function getIsIPhoneX() {
4 | return new Promise(function (resolve, reject) {
5 | if (isIPhoneX !== null) {
6 | resolve(isIPhoneX);
7 | } else {
8 | wx.getSystemInfo({
9 | success: function success(_ref) {
10 | var model = _ref.model,
11 | screenHeight = _ref.screenHeight;
12 | var iphoneX = /iphone x/i.test(model);
13 | var iphoneNew = /iPhone11/i.test(model) && screenHeight === 812;
14 | isIPhoneX = iphoneX || iphoneNew;
15 | resolve(isIPhoneX);
16 | },
17 | fail: reject
18 | });
19 | }
20 | });
21 | }
22 |
23 | export var iphonex = Behavior({
24 | properties: {
25 | safeAreaInsetBottom: {
26 | type: Boolean,
27 | value: true
28 | }
29 | },
30 | created: function created() {
31 | var _this = this;
32 |
33 | getIsIPhoneX().then(function (isIPhoneX) {
34 | _this.set({
35 | isIPhoneX: isIPhoneX
36 | });
37 | });
38 | }
39 | });
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/mixins/link.js:
--------------------------------------------------------------------------------
1 | export var link = Behavior({
2 | properties: {
3 | url: String,
4 | linkType: {
5 | type: String,
6 | value: 'navigateTo'
7 | }
8 | },
9 | methods: {
10 | jumpLink: function jumpLink(urlKey) {
11 | if (urlKey === void 0) {
12 | urlKey = 'url';
13 | }
14 |
15 | var url = this.data[urlKey];
16 |
17 | if (url) {
18 | wx[this.data.linkType]({
19 | url: url
20 | });
21 | }
22 | }
23 | }
24 | });
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/mixins/observer/behavior.js:
--------------------------------------------------------------------------------
1 | export var behavior = Behavior({
2 | created: function created() {
3 | var _this = this;
4 |
5 | if (!this.$options) {
6 | return;
7 | }
8 |
9 | var cache = {};
10 |
11 | var _this$$options = this.$options(),
12 | computed = _this$$options.computed;
13 |
14 | var keys = Object.keys(computed);
15 |
16 | this.calcComputed = function () {
17 | var needUpdate = {};
18 | keys.forEach(function (key) {
19 | var value = computed[key].call(_this);
20 |
21 | if (cache[key] !== value) {
22 | cache[key] = needUpdate[key] = value;
23 | }
24 | });
25 | return needUpdate;
26 | };
27 | },
28 | attached: function attached() {
29 | this.set();
30 | },
31 | methods: {
32 | // set data and set computed data
33 | set: function set(data, callback) {
34 | if (data) {
35 | this.setData(data, callback);
36 | }
37 |
38 | if (this.calcComputed) {
39 | this.setData(this.calcComputed());
40 | }
41 | }
42 | }
43 | });
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/mixins/observer/index.js:
--------------------------------------------------------------------------------
1 | import { behavior } from './behavior';
2 | import { observeProps } from './props';
3 | export function observe(vantOptions, options) {
4 | var watch = vantOptions.watch,
5 | computed = vantOptions.computed;
6 | options.behaviors.push(behavior);
7 |
8 | if (watch) {
9 | var props = options.properties || {};
10 | Object.keys(watch).forEach(function (key) {
11 | if (key in props) {
12 | var prop = props[key];
13 |
14 | if (prop === null || !('type' in prop)) {
15 | prop = {
16 | type: prop
17 | };
18 | }
19 |
20 | prop.observer = watch[key];
21 | props[key] = prop;
22 | }
23 | });
24 | options.properties = props;
25 | }
26 |
27 | if (computed) {
28 | options.methods = options.methods || {};
29 |
30 | options.methods.$options = function () {
31 | return vantOptions;
32 | };
33 |
34 | if (options.properties) {
35 | observeProps(options.properties);
36 | }
37 | }
38 | }
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/mixins/observer/props.js:
--------------------------------------------------------------------------------
1 | export function observeProps(props) {
2 | if (!props) {
3 | return;
4 | }
5 |
6 | Object.keys(props).forEach(function (key) {
7 | var prop = props[key];
8 |
9 | if (prop === null || !('type' in prop)) {
10 | prop = {
11 | type: prop
12 | };
13 | }
14 |
15 | var _prop = prop,
16 | observer = _prop.observer;
17 |
18 | prop.observer = function () {
19 | if (observer) {
20 | if (typeof observer === 'string') {
21 | observer = this[observer];
22 | }
23 |
24 | observer.apply(this, arguments);
25 | }
26 |
27 | this.set();
28 | };
29 |
30 | props[key] = prop;
31 | });
32 | }
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/mixins/open-type.js:
--------------------------------------------------------------------------------
1 | export var openType = Behavior({
2 | properties: {
3 | openType: String
4 | },
5 | methods: {
6 | bindGetUserInfo: function bindGetUserInfo(event) {
7 | this.$emit('getuserinfo', event.detail);
8 | },
9 | bindContact: function bindContact(event) {
10 | this.$emit('contact', event.detail);
11 | },
12 | bindGetPhoneNumber: function bindGetPhoneNumber(event) {
13 | this.$emit('getphonenumber', event.detail);
14 | },
15 | bindOpenSetting: function bindOpenSetting(event) {
16 | this.$emit('opensetting', event.detail);
17 | },
18 | bindError: function bindError(event) {
19 | this.$emit('error', event.detail);
20 | }
21 | }
22 | });
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/mixins/touch.js:
--------------------------------------------------------------------------------
1 | export var touch = Behavior({
2 | methods: {
3 | touchStart: function touchStart(event) {
4 | this.direction = '';
5 | this.deltaX = 0;
6 | this.deltaY = 0;
7 | this.offsetX = 0;
8 | this.offsetY = 0;
9 | this.startX = event.touches[0].clientX;
10 | this.startY = event.touches[0].clientY;
11 | },
12 | touchMove: function touchMove(event) {
13 | var touch = event.touches[0];
14 | this.deltaX = touch.clientX - this.startX;
15 | this.deltaY = touch.clientY - this.startY;
16 | this.offsetX = Math.abs(this.deltaX);
17 | this.offsetY = Math.abs(this.deltaY);
18 | this.direction = this.offsetX > this.offsetY ? 'horizontal' : this.offsetX < this.offsetY ? 'vertical' : '';
19 | }
20 | }
21 | });
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/mixins/transition.js:
--------------------------------------------------------------------------------
1 | export var transition = function transition(showDefaultValue) {
2 | return Behavior({
3 | properties: {
4 | customStyle: String,
5 | show: {
6 | type: Boolean,
7 | value: showDefaultValue,
8 | observer: 'observeShow'
9 | },
10 | duration: {
11 | type: Number,
12 | value: 300
13 | }
14 | },
15 | data: {
16 | type: '',
17 | inited: false,
18 | display: false,
19 | supportAnimation: true
20 | },
21 | attached: function attached() {
22 | if (this.data.show) {
23 | this.show();
24 | }
25 |
26 | this.detectSupport();
27 | },
28 | methods: {
29 | detectSupport: function detectSupport() {
30 | var _this = this;
31 |
32 | wx.getSystemInfo({
33 | success: function success(info) {
34 | if (info && info.system && info.system.indexOf('iOS 8') === 0) {
35 | _this.set({
36 | supportAnimation: false
37 | });
38 | }
39 | }
40 | });
41 | },
42 | observeShow: function observeShow(value) {
43 | if (value) {
44 | this.show();
45 | } else {
46 | if (this.data.supportAnimation) {
47 | this.set({
48 | type: 'leave'
49 | });
50 | } else {
51 | this.set({
52 | display: false
53 | });
54 | }
55 | }
56 | },
57 | show: function show() {
58 | this.set({
59 | inited: true,
60 | display: true,
61 | type: 'enter'
62 | });
63 | },
64 | onAnimationEnd: function onAnimationEnd() {
65 | if (!this.data.show) {
66 | this.set({
67 | display: false
68 | });
69 | }
70 | }
71 | }
72 | });
73 | };
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/nav-bar/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | VantComponent({
3 | classes: ['title-class'],
4 | props: {
5 | title: String,
6 | fixed: Boolean,
7 | leftText: String,
8 | rightText: String,
9 | leftArrow: Boolean,
10 | border: {
11 | type: Boolean,
12 | value: true
13 | },
14 | zIndex: {
15 | type: Number,
16 | value: 1
17 | }
18 | },
19 | methods: {
20 | onClickLeft: function onClickLeft() {
21 | this.$emit('click-left');
22 | },
23 | onClickRight: function onClickRight() {
24 | this.$emit('click-right');
25 | }
26 | }
27 | });
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/nav-bar/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-icon": "../icon/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/nav-bar/index.wxml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
13 | {{ leftText }}
14 |
15 |
16 |
17 |
18 | {{ title }}
19 |
20 |
21 |
22 | {{ rightText }}
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/nav-bar/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-nav-bar{height:46px;position:relative;-webkit-user-select:none;user-select:none;text-align:center;line-height:46px;background-color:#fff}.van-nav-bar__arrow{color:#1989fa;vertical-align:middle}.van-nav-bar__arrow+.van-nav-bar__text{margin-left:-20px;padding-left:25px}.van-nav-bar--fixed{top:0;left:0;width:100%;position:fixed}.van-nav-bar__title{margin:0 auto;max-width:60%;font-size:16px;font-weight:500}.van-nav-bar__left,.van-nav-bar__right{bottom:0;font-size:14px;position:absolute}.van-nav-bar__left{left:15px}.van-nav-bar__right{right:15px}.van-nav-bar__text{color:#1989fa;margin:0 -15px;padding:0 15px;display:inline-block;vertical-align:middle}.van-nav-bar__text:active{background-color:#e8e8e8}
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/notice-bar/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-icon": "../icon/index"
5 | }
6 | }
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/notice-bar/index.wxml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
12 | {{ text }}
13 |
14 |
15 |
16 |
17 |
23 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/notice-bar/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-notice-bar{display:-webkit-flex;display:flex;height:40px;padding:0 15px;font-size:14px;line-height:24px;-webkit-align-items:center;align-items:center}.van-notice-bar--within-icon{position:relative;padding-right:40px}.van-notice-bar__left-icon{height:18px;min-width:20px;box-sizing:border-box}.van-notice-bar__left-icon>image{width:16px;height:16px}.van-notice-bar__right-icon{position:absolute;top:10px;right:15px;font-size:16px}.van-notice-bar__content-wrap{-webkit-flex:1;flex:1;height:24px;overflow:hidden;position:relative}.van-notice-bar__content{position:absolute;white-space:nowrap}.van-notice-bar__content.van-ellipsis{max-width:100%}
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/notify/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | import { RED } from '../common/color';
3 | VantComponent({
4 | props: {
5 | text: String,
6 | color: {
7 | type: String,
8 | value: '#fff'
9 | },
10 | backgroundColor: {
11 | type: String,
12 | value: RED
13 | },
14 | duration: {
15 | type: Number,
16 | value: 3000
17 | }
18 | },
19 | methods: {
20 | show: function show() {
21 | var _this = this;
22 |
23 | var duration = this.data.duration;
24 | clearTimeout(this.timer);
25 | this.set({
26 | show: true
27 | });
28 |
29 | if (duration > 0 && duration !== Infinity) {
30 | this.timer = setTimeout(function () {
31 | _this.hide();
32 | }, duration);
33 | }
34 | },
35 | hide: function hide() {
36 | clearTimeout(this.timer);
37 | this.set({
38 | show: false
39 | });
40 | }
41 | }
42 | });
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/notify/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-transition": "../transition/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/notify/index.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 | {{ text }}
4 |
5 |
6 |
7 |
56 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/notify/index.wxml:
--------------------------------------------------------------------------------
1 |
7 | {{ text }}
8 |
9 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/notify/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-notify{z-index:110;position:fixed;top:0;width:100%;text-align:center;box-sizing:border-box;padding:6px 15px;font-size:14px;line-height:20px}
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/notify/notify.js:
--------------------------------------------------------------------------------
1 | import { isObj } from '../common/utils';
2 | var defaultOptions = {
3 | selector: '#van-notify',
4 | duration: 3000
5 | };
6 |
7 | function parseOptions(text) {
8 | return isObj(text) ? text : {
9 | text: text
10 | };
11 | }
12 |
13 | function getContext() {
14 | var pages = getCurrentPages();
15 | return pages[pages.length - 1];
16 | }
17 |
18 | export default function Notify(options) {
19 | if (options === void 0) {
20 | options = {};
21 | }
22 |
23 | options = Object.assign({}, defaultOptions, parseOptions(options));
24 | var context = options.context || getContext();
25 | var notify = context.selectComponent(options.selector);
26 | delete options.selector;
27 |
28 | if (notify) {
29 | notify.set(options);
30 | notify.showNotify();
31 | } else {
32 | console.warn('未找到 van-notify 节点,请确认 selector 及 context 是否正确');
33 | }
34 | }
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/overlay/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | VantComponent({
3 | props: {
4 | show: Boolean,
5 | mask: Boolean,
6 | customStyle: String,
7 | zIndex: {
8 | type: Number,
9 | value: 1
10 | }
11 | },
12 | methods: {
13 | onClick: function onClick() {
14 | this.$emit('click');
15 | },
16 | // for prevent touchmove
17 | noop: function noop() {}
18 | }
19 | });
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/overlay/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-transition": "../transition/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/overlay/index.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
31 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/overlay/index.wxml:
--------------------------------------------------------------------------------
1 |
8 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/overlay/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-overlay{position:fixed;top:0;left:0;right:0;bottom:0}
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/panel/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | VantComponent({
3 | classes: ['header-class', 'footer-class'],
4 | props: {
5 | desc: String,
6 | title: String,
7 | status: String,
8 | useFooterSlot: Boolean
9 | }
10 | });
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/panel/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-cell": "../cell/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/panel/index.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
13 |
14 |
15 |
16 |
33 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/panel/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
19 |
20 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/panel/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-panel{background:#fff}.van-panel__header-value{color:#f44}.van-panel__footer{padding:10px 15px}
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/picker-column/index-getOptionText.wxs:
--------------------------------------------------------------------------------
1 |
2 | function isObj(x) {
3 | var type = typeof x;
4 | return x !== null && (type === 'object' || type === 'function');
5 | }
6 |
7 | module.exports = function (option, valueKey) {
8 | return isObj(option) && option[valueKey] ? option[valueKey] : option;
9 | }
10 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/picker-column/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/picker-column/index.wxml:
--------------------------------------------------------------------------------
1 |
9 |
10 | {{ getOptionText(option, valueKey) }}
19 |
20 |
21 |
22 |
23 | function isObj(x) {
24 | var type = typeof x;
25 | return x !== null && (type === 'object' || type === 'function');
26 | }
27 |
28 | module.exports = function (option, valueKey) {
29 | return isObj(option) && option[valueKey] ? option[valueKey] : option;
30 | }
31 |
32 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/picker-column/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-picker-column{overflow:hidden;font-size:16px;text-align:center}.van-picker-column__item{padding:0 5px;color:#999}.van-picker-column__item--selected{font-weight:500;color:#333}.van-picker-column__item--disabled{opacity:.3}
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/picker/index-isSimple.wxs:
--------------------------------------------------------------------------------
1 |
2 | function isSimple(columns) {
3 | return columns.length && !columns[0].values;
4 | }
5 | module.exports = isSimple;
6 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/picker/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "picker-column": "../picker-column/index",
5 | "loading": "../loading/index"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/picker/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 | {{ cancelButtonText || '取消' }}
8 |
9 | {{ title }}
10 |
11 | {{ confirmButtonText || '确认' }}
12 |
13 |
14 |
15 |
16 |
17 |
22 |
36 |
40 |
41 |
42 |
43 |
44 | function isSimple(columns) {
45 | return columns.length && !columns[0].values;
46 | }
47 | module.exports = isSimple;
48 |
49 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/picker/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-picker{position:relative;overflow:hidden;-webkit-text-size-adjust:100%;background-color:#fff;-webkit-user-select:none;user-select:none}.van-picker__toolbar{display:-webkit-flex;display:flex;height:44px;line-height:44px;-webkit-justify-content:space-between;justify-content:space-between}.van-picker__cancel,.van-picker__confirm{padding:0 15px;font-size:14px;color:#1989fa}.van-picker__cancel:active,.van-picker__confirm:active{background-color:#e8e8e8}.van-picker__title{max-width:50%;font-size:16px;font-weight:500;text-align:center}.van-picker__columns{position:relative;display:-webkit-flex;display:flex}.van-picker__column{-webkit-flex:1 1;flex:1 1;width:0}.van-picker__loading{position:absolute;top:0;right:0;bottom:0;left:0;z-index:4;display:-webkit-flex;display:flex;background-color:rgba(255,255,255,.9);-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center}.van-picker__frame,.van-picker__loading .van-loading{position:absolute;top:50%;left:0;z-index:1;width:100%;pointer-events:none;-webkit-transform:translateY(-50%);transform:translateY(-50%)}
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/popup/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | import { transition } from '../mixins/transition';
3 | import { iphonex } from '../mixins/iphonex';
4 | VantComponent({
5 | mixins: [transition(false), iphonex],
6 | props: {
7 | transition: String,
8 | customStyle: String,
9 | overlayStyle: String,
10 | zIndex: {
11 | type: Number,
12 | value: 100
13 | },
14 | overlay: {
15 | type: Boolean,
16 | value: true
17 | },
18 | closeOnClickOverlay: {
19 | type: Boolean,
20 | value: true
21 | },
22 | position: {
23 | type: String,
24 | value: 'center'
25 | }
26 | },
27 | methods: {
28 | onClickOverlay: function onClickOverlay() {
29 | this.$emit('click-overlay');
30 |
31 | if (this.data.closeOnClickOverlay) {
32 | this.$emit('close');
33 | }
34 | }
35 | }
36 | });
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/popup/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-overlay": "../overlay/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/popup/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
11 |
19 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/progress/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | import { BLUE } from '../common/color';
3 | VantComponent({
4 | props: {
5 | inactive: Boolean,
6 | percentage: Number,
7 | pivotText: String,
8 | pivotColor: String,
9 | showPivot: {
10 | type: Boolean,
11 | value: true
12 | },
13 | color: {
14 | type: String,
15 | value: BLUE
16 | },
17 | textColor: {
18 | type: String,
19 | value: '#fff'
20 | }
21 | },
22 | data: {
23 | pivotWidth: 0,
24 | progressWidth: 0
25 | },
26 | watch: {
27 | pivotText: 'getWidth',
28 | showPivot: 'getWidth'
29 | },
30 | computed: {
31 | portionStyle: function portionStyle() {
32 | var width = (this.data.progressWidth - this.data.pivotWidth) * this.data.percentage / 100 + 'px';
33 | var background = this.getCurrentColor();
34 | return "width: " + width + "; background: " + background + "; ";
35 | },
36 | pivotStyle: function pivotStyle() {
37 | var color = this.data.textColor;
38 | var background = this.data.pivotColor || this.getCurrentColor();
39 | return "color: " + color + "; background: " + background;
40 | },
41 | text: function text() {
42 | return this.data.pivotText || this.data.percentage + '%';
43 | }
44 | },
45 | mounted: function mounted() {
46 | this.getWidth();
47 | },
48 | methods: {
49 | getCurrentColor: function getCurrentColor() {
50 | return this.data.inactive ? '#cacaca' : this.data.color;
51 | },
52 | getWidth: function getWidth() {
53 | var _this = this;
54 |
55 | this.getRect('.van-progress').then(function (rect) {
56 | _this.set({
57 | progressWidth: rect.width
58 | });
59 | });
60 | this.getRect('.van-progress__pivot').then(function (rect) {
61 | _this.set({
62 | pivotWidth: rect.width || 0
63 | });
64 | });
65 | }
66 | }
67 | });
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/progress/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/progress/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
11 | {{ text }}
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/progress/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-progress{height:4px;position:relative;border-radius:4px;background:#e5e5e5}.van-progress__portion{left:0;height:100%;position:absolute;border-radius:inherit}.van-progress__portion--with-pivot{border-top-right-radius:0;border-bottom-right-radius:0}.van-progress__pivot{top:50%;right:0;min-width:2em;padding:0 5px;font-size:10px;position:absolute;line-height:1.6;text-align:center;border-radius:1em;word-break:keep-all;box-sizing:border-box;background-color:#e5e5e5;-webkit-transform:translate(100%,-50%);transform:translate(100%,-50%)}
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/radio-group/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | VantComponent({
3 | field: true,
4 | relation: {
5 | name: 'radio',
6 | type: 'descendant',
7 | linked: function linked(target) {
8 | var _this$data = this.data,
9 | value = _this$data.value,
10 | disabled = _this$data.disabled;
11 | target.set({
12 | value: value,
13 | disabled: disabled || target.data.disabled
14 | });
15 | }
16 | },
17 | props: {
18 | value: null,
19 | disabled: Boolean
20 | },
21 | watch: {
22 | value: function value(_value) {
23 | var children = this.getRelationNodes('../radio/index');
24 | children.forEach(function (child) {
25 | child.set({
26 | value: _value
27 | });
28 | });
29 | },
30 | disabled: function disabled(_disabled) {
31 | var children = this.getRelationNodes('../radio/index');
32 | children.forEach(function (child) {
33 | child.set({
34 | disabled: _disabled || child.data.disabled
35 | });
36 | });
37 | }
38 | }
39 | });
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/radio-group/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-icon": "../icon/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/radio-group/index.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
51 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/radio-group/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/radio-group/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/radio/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | VantComponent({
3 | field: true,
4 | relation: {
5 | name: 'radio-group',
6 | type: 'ancestor'
7 | },
8 | classes: ['icon-class', 'label-class'],
9 | props: {
10 | name: null,
11 | value: null,
12 | disabled: Boolean,
13 | labelDisabled: Boolean,
14 | labelPosition: String,
15 | checkedColor: String
16 | },
17 | methods: {
18 | emitChange: function emitChange(value) {
19 | var instance = this.getRelationNodes('../radio-group/index')[0] || this;
20 | instance.$emit('input', value);
21 | instance.$emit('change', value);
22 | },
23 | onChange: function onChange(event) {
24 | this.emitChange(event.detail.value);
25 | },
26 | onClickLabel: function onClickLabel() {
27 | if (!this.data.disabled && !this.data.labelDisabled) {
28 | this.emitChange(this.data.name);
29 | }
30 | }
31 | }
32 | });
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/radio/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-icon": "../icon/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/radio/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
12 |
13 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/radio/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-radio{overflow:hidden;line-height:1;-webkit-user-select:none;user-select:none}.van-radio__input,.van-radio__label{display:inline-block;vertical-align:middle}.van-radio__input{position:relative;font-size:20px}.van-radio__control{z-index:1;position:absolute;top:0;left:0;width:100%;height:100%;margin:0;opacity:0}.van-radio__label{margin-left:10px;color:#333;font-size:16px;line-height:20px}.van-radio__label--left{margin:0 10px 0 0;float:left}.van-radio__label:empty{margin:0}.van-radio__icon{pointer-events:none;display:block;line-height:0}.van-radio__icon--disabled{color:#e5e5e5}.van-radio__icon--checked{color:#1989fa}.van-radio__icon--check{color:#999}
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/rate/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-icon": "../icon/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/rate/index.wxml:
--------------------------------------------------------------------------------
1 |
5 |
16 |
17 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/rate/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-rate{-webkit-user-select:none;user-select:none}.van-rate__item{width:1em;padding:0 2px;box-sizing:content-box}
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/row/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | VantComponent({
3 | relation: {
4 | name: 'col',
5 | type: 'descendant',
6 | linked: function linked(target) {
7 | if (this.data.gutter) {
8 | target.setGutter(this.data.gutter);
9 | }
10 | }
11 | },
12 | props: {
13 | gutter: Number
14 | },
15 | watch: {
16 | gutter: 'setGutter'
17 | },
18 | mounted: function mounted() {
19 | if (this.data.gutter) {
20 | this.setGutter();
21 | }
22 | },
23 | methods: {
24 | setGutter: function setGutter() {
25 | var _this = this;
26 |
27 | var gutter = this.data.gutter;
28 | var margin = "-" + Number(gutter) / 2 + "px";
29 | var style = gutter ? "margin-right: " + margin + "; margin-left: " + margin + ";" : '';
30 | this.set({
31 | style: style
32 | });
33 | this.getRelationNodes('../col/index').forEach(function (col) {
34 | col.setGutter(_this.data.gutter);
35 | });
36 | }
37 | }
38 | });
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/row/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/row/index.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
50 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/row/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/row/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-row::after{content:"";display:table;clear:both}
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/search/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | VantComponent({
3 | field: true,
4 | classes: ['field-class', 'input-class', 'cancel-class'],
5 | props: {
6 | focus: Boolean,
7 | error: Boolean,
8 | disabled: Boolean,
9 | readonly: Boolean,
10 | inputAlign: String,
11 | showAction: Boolean,
12 | useActionSlot: Boolean,
13 | placeholder: String,
14 | placeholderStyle: String,
15 | background: {
16 | type: String,
17 | value: '#f2f2f2'
18 | },
19 | maxlength: {
20 | type: Number,
21 | value: -1
22 | }
23 | },
24 | methods: {
25 | onChange: function onChange(event) {
26 | this.set({
27 | value: event.detail
28 | });
29 | this.$emit('change', event.detail);
30 | },
31 | onCancel: function onCancel() {
32 | this.set({
33 | value: ''
34 | });
35 | this.$emit('cancel');
36 | this.$emit('change', '');
37 | },
38 | onSearch: function onSearch() {
39 | this.$emit('search', this.data.value);
40 | },
41 | onFocus: function onFocus() {
42 | this.$emit('focus');
43 | },
44 | onBlur: function onBlur() {
45 | this.$emit('blur');
46 | },
47 | onClear: function onClear() {
48 | this.$emit('clear');
49 | }
50 | }
51 | });
52 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/search/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-icon": "../icon/index",
5 | "van-field": "../field/index"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/search/index.wxml:
--------------------------------------------------------------------------------
1 |
5 |
29 |
30 |
31 | 取消
32 |
33 |
34 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/search/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-search{display:-webkit-flex;display:flex;padding:7px 15px;-webkit-align-items:center;align-items:center;box-sizing:border-box}.van-search__field{overflow:hidden;border-radius:4px;-webkit-flex:1;flex:1}.van-search__field__left-icon{color:#999}.van-search--show-action{padding-right:0}.van-search input::-webkit-search-cancel-button,.van-search input::-webkit-search-decoration,.van-search input::-webkit-search-results-button,.van-search input::-webkit-search-results-decoration{display:none}.van-search__action{padding:0 10px;font-size:14px;line-height:30px;color:#7d7e80}.van-search__action:active{background-color:#e8e8e8}
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/slider/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/slider/index.wxml:
--------------------------------------------------------------------------------
1 |
6 |
10 |
17 |
21 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/slider/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-slider{position:relative;border-radius:999px;background-color:#e5e5e5}.van-slider__bar{position:relative;border-radius:inherit;background-color:#1989fa}.van-slider__button{width:20px;height:20px;border-radius:50%;background-color:#fff;box-shadow:0 1px 2px rgba(0,0,0,.5)}.van-slider__button-wrapper{position:absolute;top:50%;right:0;-webkit-transform:translate3d(50%,-50%,0);transform:translate3d(50%,-50%,0)}.van-slider__button-wrapper::after{content:'';position:absolute;width:200%;height:200%;top:-50%;left:-50%}.van-slider--disabled{opacity:.3}
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/stepper/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/stepper/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
16 |
17 |
21 |
22 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/stepper/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-stepper{font-size:0}.van-stepper__input-wrapper,.van-stepper__minus,.van-stepper__plus{display:inline-block;vertical-align:middle;background-color:#fff}.van-stepper__minus,.van-stepper__plus{position:relative;width:40px;height:30px;padding:5px;border:1px solid #eee;box-sizing:border-box}.van-stepper__minus::before,.van-stepper__plus::before{width:9px;height:1px}.van-stepper__minus::after,.van-stepper__plus::after{width:1px;height:9px}.van-stepper__minus::after,.van-stepper__minus::before,.van-stepper__plus::after,.van-stepper__plus::before{position:absolute;top:0;right:0;bottom:0;left:0;margin:auto;background-color:#7d7e80;content:''}.van-stepper__minus:active,.van-stepper__plus:active{background-color:#e8e8e8}.van-stepper__minus--disabled,.van-stepper__plus--disabled{background-color:#f8f8f8}.van-stepper__minus--disabled::after,.van-stepper__minus--disabled::before,.van-stepper__plus--disabled::after,.van-stepper__plus--disabled::before{background-color:#c9c9c9}.van-stepper__minus--disabled:active,.van-stepper__plus--disabled:active{background-color:#f8f8f8}.van-stepper__minus{border-radius:2px 0 0 2px}.van-stepper__minus::after{display:none}.van-stepper__plus{border-radius:0 2px 2px 0}.van-stepper__input-wrapper{position:relative;width:35px;height:30px;padding:1px;font-size:14px;color:#7d7e80;text-align:center;border:1px solid #eee;border-width:1px 0;border-radius:0;box-sizing:border-box}.van-stepper__input-wrapper--disabled{color:#c9c9c9;background-color:#f8f8f8}.van-stepper__input{position:absolute;top:50%;left:50%;width:100%;min-height:0;-webkit-transform:translate3d(-50%,-50%,0);transform:translate3d(-50%,-50%,0);-webkit-appearance:none;appearance:none}
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/steps/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | import { GREEN } from '../common/color';
3 | VantComponent({
4 | props: {
5 | icon: String,
6 | steps: Array,
7 | active: Number,
8 | direction: {
9 | type: String,
10 | value: 'horizontal'
11 | },
12 | activeColor: {
13 | type: String,
14 | value: GREEN
15 | }
16 | },
17 | watch: {
18 | steps: 'formatSteps',
19 | active: 'formatSteps'
20 | },
21 | created: function created() {
22 | this.formatSteps();
23 | },
24 | methods: {
25 | formatSteps: function formatSteps() {
26 | var _this = this;
27 |
28 | var steps = this.data.steps;
29 | steps.forEach(function (step, index) {
30 | step.status = _this.getStatus(index);
31 | });
32 | this.set({
33 | steps: steps
34 | });
35 | },
36 | getStatus: function getStatus(index) {
37 | var active = this.data.active;
38 |
39 | if (index < active) {
40 | return 'finish';
41 | } else if (index === active) {
42 | return 'process';
43 | }
44 |
45 | return '';
46 | }
47 | }
48 | });
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/steps/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-icon": "../icon/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/steps/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 | {{ item.text }}
11 | {{ item.desc }}
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/submit-bar/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | import { iphonex } from '../mixins/iphonex';
3 | VantComponent({
4 | mixins: [iphonex],
5 | classes: ['bar-class', 'price-class', 'button-class'],
6 | props: {
7 | tip: null,
8 | type: Number,
9 | price: null,
10 | label: String,
11 | loading: Boolean,
12 | disabled: Boolean,
13 | buttonText: String,
14 | currency: {
15 | type: String,
16 | value: '¥'
17 | },
18 | buttonType: {
19 | type: String,
20 | value: 'danger'
21 | }
22 | },
23 | computed: {
24 | hasPrice: function hasPrice() {
25 | return typeof this.data.price === 'number';
26 | },
27 | priceStr: function priceStr() {
28 | return (this.data.price / 100).toFixed(2);
29 | },
30 | tipStr: function tipStr() {
31 | var tip = this.data.tip;
32 | return typeof tip === 'string' ? tip : '';
33 | }
34 | },
35 | methods: {
36 | onSubmit: function onSubmit(event) {
37 | this.$emit('submit', event.detail);
38 | }
39 | }
40 | });
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/submit-bar/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-button": "../button/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/submit-bar/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | {{ tipStr }}
8 |
9 |
10 |
11 |
12 |
13 |
14 | {{ label || '合计:' }}
15 |
16 | {{ currency }} {{ priceStr }}
17 |
18 |
19 |
20 |
30 | {{ loading ? '' : buttonText }}
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/submit-bar/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-submit-bar{z-index:100;position:fixed;bottom:0;left:0;width:100%;-webkit-user-select:none;user-select:none}.van-submit-bar__tip{padding:10px;color:#f56723;font-size:12px;line-height:18px;background-color:#fff7cc}.van-submit-bar__bar{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;height:50px;background-color:#fff;font-size:14px}.van-submit-bar__bar--safe{padding-bottom:34px}.van-submit-bar__text{-webkit-flex:1;flex:1;color:#333;font-weight:500;text-align:right}.van-submit-bar__price{color:#f44;font-size:18px;padding-right:12px}.van-submit-bar__currency{font-size:14px}.van-submit-bar__button button{width:110px}
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/swipe-cell/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/swipe-cell/index.wxml:
--------------------------------------------------------------------------------
1 |
10 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/swipe-cell/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-swipe-cell{position:relative;overflow:hidden}.van-swipe-cell__left,.van-swipe-cell__right{position:absolute;top:0;height:100%}.van-swipe-cell__left{left:0;-webkit-transform:translate3d(-100%,0,0);transform:translate3d(-100%,0,0)}.van-swipe-cell__right{right:0;-webkit-transform:translate3d(100%,0,0);transform:translate3d(100%,0,0)}
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/switch-cell/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | VantComponent({
3 | field: true,
4 | props: {
5 | title: String,
6 | border: Boolean,
7 | checked: Boolean,
8 | loading: Boolean,
9 | disabled: Boolean,
10 | activeColor: String,
11 | inactiveColor: String,
12 | size: {
13 | type: String,
14 | value: '24px'
15 | }
16 | },
17 | watch: {
18 | checked: function checked(value) {
19 | this.set({
20 | value: value
21 | });
22 | }
23 | },
24 | created: function created() {
25 | this.set({
26 | value: this.data.checked
27 | });
28 | },
29 | methods: {
30 | onChange: function onChange(event) {
31 | this.$emit('change', event.detail);
32 | }
33 | }
34 | });
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/switch-cell/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-cell": "../cell/index",
5 | "van-switch": "../switch/index"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/switch-cell/index.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
49 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/switch-cell/index.wxml:
--------------------------------------------------------------------------------
1 |
7 |
17 |
18 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/switch-cell/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-switch-cell{padding-top:9px;padding-bottom:9px}.van-switch-cell__switch{vertical-align:middle}
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/switch/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | VantComponent({
3 | field: true,
4 | classes: ['node-class'],
5 | props: {
6 | checked: Boolean,
7 | loading: Boolean,
8 | disabled: Boolean,
9 | activeColor: String,
10 | inactiveColor: String,
11 | size: {
12 | type: String,
13 | value: '30px'
14 | }
15 | },
16 | watch: {
17 | checked: function checked(value) {
18 | this.set({
19 | value: value
20 | });
21 | }
22 | },
23 | created: function created() {
24 | this.set({
25 | value: this.data.checked
26 | });
27 | },
28 | methods: {
29 | onClick: function onClick() {
30 | if (!this.data.disabled && !this.data.loading) {
31 |
32 | var checked = !this.data.checked;
33 | this.$emit('input', checked);
34 | this.$emit('change', checked);
35 | }
36 | }
37 | }
38 | });
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/switch/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-loading": "../loading/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/switch/index.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
54 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/switch/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/switch/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-switch{display:inline-block;position:relative;width:2em;height:1em;border:1px solid rgba(0,0,0,.1);border-radius:1em;box-sizing:content-box;background-color:#fff;transition:background-color .3s}.van-switch__node{top:0;left:0;position:absolute;border-radius:100%;width:1em;height:1em;z-index:1;transition:.3s;box-shadow:0 3px 1px 0 rgba(0,0,0,.05),0 2px 2px 0 rgba(0,0,0,.1),0 3px 3px 0 rgba(0,0,0,.05);background-color:#fff}.van-switch__loading{top:25%;left:25%;position:absolute!important}.van-switch--on{background-color:#1989fa}.van-switch--on .van-switch__node{-webkit-transform:translateX(1em);transform:translateX(1em)}.van-switch--disabled{opacity:.4}
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/tab/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | VantComponent({
3 | relation: {
4 | name: 'tabs',
5 | type: 'ancestor'
6 | },
7 | props: {
8 | title: String,
9 | disabled: Boolean,
10 | dot: Boolean,
11 | info: null,
12 | titleStyle: String
13 | },
14 | data: {
15 | inited: false,
16 | active: false,
17 | animated: false,
18 | width: null
19 | },
20 | watch: {
21 | title: 'update',
22 | disabled: 'update',
23 | dot: 'update',
24 | info: 'update',
25 | titleStyle: 'update'
26 | },
27 | methods: {
28 | update: function update() {
29 | var parent = this.getRelationNodes('../tabs/index')[0];
30 |
31 | if (parent) {
32 | parent.updateTabs();
33 | }
34 | }
35 | }
36 | });
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/tab/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/tab/index.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
48 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/tab/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/tab/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-tab__pane{box-sizing:border-box;overflow-y:auto}.van-tab__pane--active{height:auto}.van-tab__pane--inactive{height:0;overflow:visible}
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/tabbar-item/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | VantComponent({
3 | props: {
4 | info: null,
5 | icon: String,
6 | dot: Boolean
7 | },
8 | relation: {
9 | name: 'tabbar',
10 | type: 'ancestor'
11 | },
12 | data: {
13 | active: false
14 | },
15 | methods: {
16 | onClick: function onClick() {
17 | var parent = this.getRelationNodes('../tabbar/index')[0];
18 |
19 | if (parent) {
20 | parent.onChange(this);
21 | }
22 |
23 | this.$emit('click');
24 | },
25 | setActive: function setActive(_ref) {
26 | var active = _ref.active,
27 | color = _ref.color;
28 |
29 | if (this.data.active !== active) {
30 | this.set({
31 | active: active,
32 | color: color
33 | });
34 | }
35 | }
36 | }
37 | });
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/tabbar-item/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-icon": "../icon/index",
5 | "van-info": "../info/index"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/tabbar-item/index.wxml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
12 |
13 |
17 |
18 |
19 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/tabbar-item/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';:host{-webkit-flex:1;flex:1}.van-tabbar-item{color:#7d7e80;height:100%;display:-webkit-flex;display:flex;line-height:1;font-size:12px;-webkit-align-items:center;align-items:center;-webkit-flex-direction:column;flex-direction:column;-webkit-justify-content:center;justify-content:center}.van-tabbar-item__icon{font-size:18px;margin-bottom:5px;position:relative}.van-tabbar-item__icon--dot::after{top:0;right:-8px;width:8px;height:8px;content:' ';position:absolute;border-radius:100%;background-color:#f44}.van-tabbar-item__icon image{width:30px;height:18px;display:block}.van-tabbar-item--active{color:#1989fa}
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/tabbar/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | import { iphonex } from '../mixins/iphonex';
3 | VantComponent({
4 | mixins: [iphonex],
5 | relation: {
6 | name: 'tabbar-item',
7 | type: 'descendant',
8 | linked: function linked(target) {
9 | var _this = this;
10 |
11 | this.data.items.push(target);
12 | setTimeout(function () {
13 | _this.setActiveItem();
14 | });
15 | },
16 | unlinked: function unlinked(target) {
17 | var _this2 = this;
18 |
19 | this.data.items = this.data.items.filter(function (item) {
20 | return item !== target;
21 | });
22 | setTimeout(function () {
23 | _this2.setActiveItem();
24 | });
25 | }
26 | },
27 | props: {
28 | active: Number,
29 | activeColor: String,
30 | fixed: {
31 | type: Boolean,
32 | value: true
33 | },
34 | zIndex: {
35 | type: Number,
36 | value: 1
37 | }
38 | },
39 | data: {
40 | items: [],
41 | currentActive: -1
42 | },
43 | watch: {
44 | active: function active(_active) {
45 | this.set({
46 | currentActive: _active
47 | });
48 | this.setActiveItem();
49 | }
50 | },
51 | created: function created() {
52 | this.set({
53 | currentActive: this.data.active
54 | });
55 | },
56 | methods: {
57 | setActiveItem: function setActiveItem() {
58 | var _this3 = this;
59 |
60 | this.data.items.forEach(function (item, index) {
61 | item.setActive({
62 | active: index === _this3.data.currentActive,
63 | color: _this3.data.activeColor
64 | });
65 | });
66 | },
67 | onChange: function onChange(child) {
68 | var active = this.data.items.indexOf(child);
69 |
70 | if (active !== this.data.currentActive && active !== -1) {
71 | this.$emit('change', active);
72 | this.set({
73 | currentActive: active
74 | });
75 | this.setActiveItem();
76 | }
77 | }
78 | }
79 | });
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/tabbar/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/tabbar/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/tabbar/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-tabbar{display:-webkit-flex;display:flex;width:100%;height:50px;background-color:#fff}.van-tabbar--fixed{position:fixed;bottom:0;left:0}.van-tabbar--safe{padding-bottom:34px}
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/tabs/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-info": "../info/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/tabs/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
12 |
13 |
14 |
22 |
23 | {{ item.title }}
24 |
29 |
30 |
31 |
32 |
33 |
34 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/tabs/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-tabs{position:relative;-webkit-tap-highlight-color:transparent}.van-tabs__wrap{position:absolute;top:0;right:0;left:0}.van-tabs__wrap--page-top{position:fixed}.van-tabs__wrap--content-bottom{top:auto;bottom:0}.van-tabs__wrap--scrollable .van-tab{-webkit-flex:0 0 22%;flex:0 0 22%}.van-tabs__scroll--card{border:1px solid #f44;border-radius:2px}.van-tabs__nav{position:relative;display:-webkit-flex;display:flex;background-color:#fff;-webkit-user-select:none;user-select:none}.van-tabs__nav--line{height:100%}.van-tabs__nav--card{height:30px}.van-tabs__nav--card .van-tab{line-height:30px;color:#f44;border-right:1px solid #f44}.van-tabs__nav--card .van-tab:last-child{border-right:none}.van-tabs__nav--card .van-tab.van-tab--active{color:#fff;background-color:#f44}.van-tabs__line{position:absolute;bottom:0;left:0;z-index:1;height:2px;background-color:#f44;border-radius:2px}.van-tabs--line{padding-top:44px}.van-tabs--line .van-tabs__wrap{height:44px}.van-tabs--card{padding-top:30px;margin:0 15px}.van-tabs--card .van-tabs__wrap{height:30px}.van-tabs__content{overflow:hidden}.van-tabs__track{position:relative}.van-tab{position:relative;min-width:0;padding:0 5px;font-size:14px;line-height:44px;color:#7d7e80;text-align:center;cursor:pointer;background-color:#fff;box-sizing:border-box;-webkit-flex:1;flex:1}.van-tab--active{font-weight:500;color:#333}.van-tab--disabled{color:#c9c9c9}.van-tab__title--dot::after{display:inline-block;width:8px;height:8px;vertical-align:middle;background-color:#f44;border-radius:100%;content:''}.van-tab__title__info{position:relative!important;top:-1px!important;display:inline-block;-webkit-transform:translateX(0)!important;transform:translateX(0)!important}
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/tag/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | import { RED, BLUE, GREEN } from '../common/color';
3 | var DEFAULT_COLOR = '#999';
4 | var COLOR_MAP = {
5 | danger: RED,
6 | primary: BLUE,
7 | success: GREEN
8 | };
9 | VantComponent({
10 | props: {
11 | size: String,
12 | type: String,
13 | mark: Boolean,
14 | color: String,
15 | plain: Boolean,
16 | round: Boolean,
17 | textColor: String
18 | },
19 | computed: {
20 | style: function style() {
21 | var color = this.data.color || COLOR_MAP[this.data.type] || DEFAULT_COLOR;
22 | var key = this.data.plain ? 'color' : 'background-color';
23 | var style = {
24 | [key]: color
25 | };
26 |
27 | if (this.data.textColor) {
28 | style.color = this.data.textColor;
29 | }
30 |
31 | return Object.keys(style).map(function (key) {
32 | return key + ": " + style[key];
33 | }).join(';');
34 | }
35 | }
36 | });
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/tag/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/tag/index.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
48 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/tag/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/tag/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-tag{color:#fff;font-size:10px;padding:.2em .5em;line-height:normal;border-radius:.2em;display:inline-block}.van-tag::after{border-color:currentColor;border-radius:.4em}.van-tag--mark{padding-right:.6em;border-radius:0 .8em .8em 0}.van-tag--mark::after{border-radius:0 1.6em 1.6em 0}.van-tag--round{border-radius:.8em}.van-tag--round::after{border-radius:1.6em}.van-tag--medium{font-size:12px}.van-tag--large{font-size:14px}
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/toast/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | VantComponent({
3 | props: {
4 | show: Boolean,
5 | mask: Boolean,
6 | message: String,
7 | forbidClick: Boolean,
8 | zIndex: {
9 | type: Number,
10 | value: 1000
11 | },
12 | type: {
13 | type: String,
14 | value: 'text'
15 | },
16 | loadingType: {
17 | type: String,
18 | value: 'circular'
19 | },
20 | position: {
21 | type: String,
22 | value: 'middle'
23 | }
24 | },
25 | methods: {
26 | clear: function clear() {
27 | this.set({
28 | show: false
29 | });
30 | },
31 | // for prevent touchmove
32 | noop: function noop() {}
33 | }
34 | });
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/toast/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-icon": "../icon/index",
5 | "van-loading": "../loading/index",
6 | "van-overlay": "../overlay/index",
7 | "van-transition": "../transition/index"
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/toast/index.wxml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
16 |
17 | {{ message }}
18 |
19 |
20 |
21 |
27 |
28 | {{ message }}
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/toast/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-toast{display:-webkit-flex;display:flex;color:#fff;font-size:14px;line-height:20px;border-radius:4px;word-break:break-all;-webkit-align-items:center;align-items:center;-webkit-flex-direction:column;flex-direction:column;-webkit-justify-content:center;justify-content:center;box-sizing:content-box;background-color:rgba(51,51,51,.88)}.van-toast__container{position:fixed;top:50%;left:50%;max-width:70%;width:-webkit-fit-content;width:fit-content;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}.van-toast--text{padding:8px 12px;min-width:96px}.van-toast--icon{width:90px;padding:15px;min-height:90px}.van-toast--icon .van-toast__icon{font-size:48px}.van-toast--icon .van-toast__text{padding-top:5px}.van-toast__loading{margin:10px 0}.van-toast--top{-webkit-transform:translate(0,-30vh);transform:translate(0,-30vh)}.van-toast--bottom{-webkit-transform:translate(0,30vh);transform:translate(0,30vh)}
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/transition/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | import { transition } from '../mixins/transition';
3 | VantComponent({
4 | mixins: [transition(true)],
5 | props: {
6 | name: {
7 | type: String,
8 | value: 'fade'
9 | }
10 | }
11 | });
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/transition/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/transition/index.wxml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/tree-select/index.js:
--------------------------------------------------------------------------------
1 | import { VantComponent } from '../common/component';
2 | var ITEM_HEIGHT = 44;
3 | VantComponent({
4 | classes: ['main-item-class', 'content-item-class', 'main-active-class', 'content-active-class', 'main-disabled-class', 'content-disabled-class'],
5 | props: {
6 | items: Array,
7 | mainActiveIndex: {
8 | type: Number,
9 | value: 0
10 | },
11 | activeId: {
12 | type: [Number, String]
13 | },
14 | maxHeight: {
15 | type: Number,
16 | value: 300
17 | }
18 | },
19 | data: {
20 | subItems: [],
21 | mainHeight: 0,
22 | itemHeight: 0
23 | },
24 | watch: {
25 | items: function items() {
26 | this.updateSubItems();
27 | this.updateMainHeight();
28 | },
29 | maxHeight: function maxHeight() {
30 | this.updateItemHeight();
31 | this.updateMainHeight();
32 | },
33 | mainActiveIndex: 'updateSubItems'
34 | },
35 | methods: {
36 | // 当一个子项被选择时
37 | onSelectItem: function onSelectItem(event) {
38 | var item = event.currentTarget.dataset.item;
39 |
40 | if (!item.disabled) {
41 | this.$emit('click-item', item);
42 | }
43 | },
44 | // 当一个导航被点击时
45 | onClickNav: function onClickNav(event) {
46 | var index = event.currentTarget.dataset.index;
47 | var item = this.data.items[index];
48 |
49 | if (!item.disabled) {
50 | this.$emit('click-nav', {
51 | index: index
52 | });
53 | }
54 | },
55 | // 更新子项列表
56 | updateSubItems: function updateSubItems() {
57 | var selectedItem = this.data.items[this.data.mainActiveIndex] || {};
58 | this.set({
59 | subItems: selectedItem.children || []
60 | });
61 | this.updateItemHeight();
62 | },
63 | // 更新组件整体高度,根据最大高度和当前组件需要展示的高度来决定
64 | updateMainHeight: function updateMainHeight() {
65 | var maxHeight = Math.max(this.data.items.length * ITEM_HEIGHT, this.data.subItems.length * ITEM_HEIGHT);
66 | this.set({
67 | mainHeight: Math.min(maxHeight, this.data.maxHeight)
68 | });
69 | },
70 | // 更新子项列表高度,根据可展示的最大高度和当前子项列表的高度决定
71 | updateItemHeight: function updateItemHeight() {
72 | this.set({
73 | itemHeight: Math.min(this.data.subItems.length * ITEM_HEIGHT, this.data.maxHeight)
74 | });
75 | }
76 | }
77 | });
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/tree-select/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "van-icon": "../icon/index",
5 | "van-cell": "../cell/index"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/tree-select/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
15 | {{ item.text }}
16 |
17 |
18 |
23 |
30 | {{ item.text }}
31 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/tree-select/index.wxss:
--------------------------------------------------------------------------------
1 | @import '../common/index.wxss';.van-tree-select{position:relative;font-size:14px;-webkit-user-select:none;user-select:none}.van-tree-select__nav{position:absolute;top:0;bottom:0;left:0;width:35%;min-width:120px;background-color:#fafafa}.van-tree-select__nitem{position:relative;padding:0 9px 0 15px;line-height:44px}.van-tree-select__nitem--active::after,.van-tree-select__nitem:active::after{position:absolute;top:0;bottom:0;left:0;width:3.6px;background-color:#f44;content:''}.van-tree-select__nitem--active{font-weight:700;background-color:#fff}.van-tree-select__nitem--disabled{color:#999}.van-tree-select__nitem--disabled:active::after{display:none}.van-tree-select__content{width:65%;padding-left:15px;margin-left:35%;background-color:#fff;box-sizing:border-box}.van-tree-select__item{position:relative;font-weight:700;line-height:44px}.van-tree-select__item--active,.van-tree-select__item:active{color:#f44}.van-tree-select__item--disabled,.van-tree-select__item--disabled:active{color:#999}.van-tree-select__selected{position:absolute;top:0;right:15px;bottom:0;height:24px;margin:auto 0;line-height:24px}
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/wxs/array.wxs:
--------------------------------------------------------------------------------
1 | function isArray(array) {
2 | return array && (array.constructor === 'Array' || (typeof Array !== 'undefined' && Array.isArray(array)));
3 | }
4 |
5 | module.exports.isArray = isArray;
6 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/wxs/bem.wxs:
--------------------------------------------------------------------------------
1 | var array = require('./array.wxs');
2 | var object = require('./object.wxs');
3 | var PREFIX = 'van-';
4 |
5 | function join(name, mods) {
6 | name = PREFIX + name;
7 | mods = mods.map(function(mod) {
8 | return name + '--' + mod;
9 | });
10 | mods.unshift(name);
11 | return mods.join(' ');
12 | }
13 |
14 | function traversing(mods, conf) {
15 | if (!conf) {
16 | return;
17 | }
18 |
19 | if (typeof conf === 'string' || typeof conf === 'number') {
20 | mods.push(conf);
21 | } else if (array.isArray(conf)) {
22 | conf.forEach(function(item) {
23 | traversing(mods, item);
24 | });
25 | } else if (typeof conf === 'object') {
26 | object.keys(conf).forEach(function(key) {
27 | conf[key] && mods.push(key);
28 | });
29 | }
30 | }
31 |
32 | function bem(name, conf) {
33 | var mods = [];
34 | traversing(mods, conf);
35 | return join(name, mods);
36 | }
37 |
38 | module.exports.bem = bem;
39 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/wxs/memoize.wxs:
--------------------------------------------------------------------------------
1 | /**
2 | * Simple memoize
3 | * wxs doesn't support fn.apply, so this memoize only support up to 2 args
4 | */
5 |
6 | function isPrimitive(value) {
7 | var type = typeof value;
8 | return (
9 | type === 'boolean' ||
10 | type === 'number' ||
11 | type === 'string' ||
12 | type === 'undefined' ||
13 | value === null
14 | );
15 | }
16 |
17 | // mock simple fn.call in wxs
18 | function call(fn, args) {
19 | if (args.length === 2) {
20 | return fn(args[0], args[1]);
21 | }
22 |
23 | if (args.length === 1) {
24 | return fn(args[0]);
25 | }
26 |
27 | return fn();
28 | }
29 |
30 | function serializer(args) {
31 | if (args.length === 1 && isPrimitive(args[0])) {
32 | return args[0];
33 | }
34 | var obj = {};
35 | for (var i = 0; i < args.length; i++) {
36 | obj['key' + i] = args[i];
37 | }
38 | return JSON.stringify(obj);
39 | }
40 |
41 | function memoize(fn) {
42 | var cache = {};
43 |
44 | return function() {
45 | var key = serializer(arguments);
46 | if (cache[key] === undefined) {
47 | cache[key] = call(fn, arguments);
48 | }
49 |
50 | return cache[key];
51 | };
52 | }
53 |
54 | module.exports.memoize = memoize;
55 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/wxs/object.wxs:
--------------------------------------------------------------------------------
1 | /* eslint-disable */
2 | var REGEXP = getRegExp('{|}|"', 'g');
3 |
4 | function keys(obj) {
5 | return JSON.stringify(obj)
6 | .replace(REGEXP, '')
7 | .split(',')
8 | .map(function(item) {
9 | return item.split(':')[0];
10 | });
11 | }
12 |
13 | module.exports.keys = keys;
14 |
--------------------------------------------------------------------------------
/src/wxcomponents/vant-weapp/wxs/utils.wxs:
--------------------------------------------------------------------------------
1 | var bem = require('./bem.wxs').bem;
2 | var memoize = require('./memoize.wxs').memoize;
3 |
4 | function isSrc(url) {
5 | return url.indexOf('http') === 0 || url.indexOf('data:image') === 0 || url.indexOf('//') === 0;
6 | }
7 |
8 | module.exports = {
9 | bem: memoize(bem),
10 | isSrc: isSrc,
11 | memoize: memoize
12 | };
13 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "types": [
4 | "uni-app",
5 | "html5plus",
6 | "miniprogram-api-typings/types/lib.wx.api.d.ts",
7 | "mini-types/types/api"
8 | ]
9 | }
10 | }
11 |
--------------------------------------------------------------------------------