├── README.md ├── src ├── pages │ ├── counter │ │ ├── main.js │ │ ├── store.js │ │ └── index.vue │ ├── index │ │ ├── main.js │ │ └── index.vue │ └── logs │ │ ├── main.js │ │ └── index.vue ├── components │ ├── itemList.vue │ ├── card.vue │ ├── timeLine.vue │ └── canvasBg.vue ├── main.js ├── App.vue └── utils │ └── index.js ├── package.json └── LICENSE /README.md: -------------------------------------------------------------------------------- 1 | # mpvue-component 2 | mpvue 的组件 3 | - timeLine时间轴组件 4 | -------------------------------------------------------------------------------- /src/pages/counter/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './index' 3 | 4 | const app = new Vue(App) 5 | app.$mount() 6 | -------------------------------------------------------------------------------- /src/pages/index/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './index' 3 | 4 | const app = new Vue(App) 5 | app.$mount() 6 | -------------------------------------------------------------------------------- /src/pages/logs/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './index' 3 | 4 | const app = new Vue(App) 5 | app.$mount() 6 | 7 | export default { 8 | config: { 9 | navigationBarTitleText: '查看启动日志' 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/components/itemList.vue: -------------------------------------------------------------------------------- 1 | 11 | 12 | 22 | 23 | 28 | -------------------------------------------------------------------------------- /src/components/card.vue: -------------------------------------------------------------------------------- 1 | 10 | 11 | 21 | 22 | 27 | -------------------------------------------------------------------------------- /src/pages/counter/store.js: -------------------------------------------------------------------------------- 1 | // https://vuex.vuejs.org/zh-cn/intro.html 2 | // make sure to call Vue.use(Vuex) if using a module system 3 | import Vue from 'vue' 4 | import Vuex from 'vuex' 5 | 6 | Vue.use(Vuex) 7 | 8 | const store = new Vuex.Store({ 9 | state: { 10 | count: 0 11 | }, 12 | mutations: { 13 | increment: (state) => { 14 | const obj = state 15 | obj.count += 1 16 | }, 17 | decrement: (state) => { 18 | const obj = state 19 | obj.count -= 1 20 | } 21 | } 22 | }) 23 | 24 | export default store 25 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mpvue-component", 3 | "version": "1.0.0", 4 | "description": "mpvue,component", 5 | "main": "main.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "git+https://github.com/calamus0427/mpvue-component.git" 12 | }, 13 | "author": "calamus0427", 14 | "license": "MIT", 15 | "bugs": { 16 | "url": "https://github.com/calamus0427/mpvue-component/issues" 17 | }, 18 | "homepage": "https://github.com/calamus0427/mpvue-component#readme" 19 | } 20 | -------------------------------------------------------------------------------- /src/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './App' 3 | import './utils/index.js' 4 | 5 | Vue.config.productionTip = false 6 | App.mpType = 'app' 7 | 8 | 9 | const app = new Vue(App) 10 | app.$mount() 11 | 12 | export default { 13 | // 这个字段走 app.json 14 | config: { 15 | // 页面前带有 ^ 符号的,会被编译成首页,其他页面可以选填,我们会自动把 webpack entry 里面的入口页面加进去 16 | pages: ['pages/logs/main', '^pages/index/main'], 17 | window: { 18 | backgroundTextStyle: 'light', 19 | navigationBarBackgroundColor: '#fff', 20 | navigationBarTitleText: 'WeChat', 21 | navigationBarTextStyle: 'black' 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/App.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 32 | -------------------------------------------------------------------------------- /src/pages/logs/index.vue: -------------------------------------------------------------------------------- 1 | 10 | 11 | 32 | 33 | 44 | -------------------------------------------------------------------------------- /src/pages/counter/index.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 36 | 50 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/utils/index.js: -------------------------------------------------------------------------------- 1 | function formatNumber (n) { 2 | const str = n.toString() 3 | return str[1] ? str : `0${str}` 4 | } 5 | 6 | export function formatTime (date) { 7 | const year = date.getFullYear() 8 | const month = date.getMonth() + 1 9 | const day = date.getDate() 10 | 11 | const hour = date.getHours() 12 | const minute = date.getMinutes() 13 | const second = date.getSeconds() 14 | 15 | const t1 = [year, month, day].map(formatNumber).join('/') 16 | const t2 = [hour, minute, second].map(formatNumber).join(':') 17 | 18 | return `${t1} ${t2}` 19 | } 20 | 21 | var comicData = [ 22 | { 23 | 'id': '1', 24 | 'name': '命运石之门', 25 | 'date': '2018-04-11', 26 | 'path': 'http://p3i10hjs7.bkt.clouddn.com/bg.jpg', 27 | 'description': '最爱' 28 | }, { 29 | 'id': '2', 30 | 'name': '命运石之门', 31 | 'date': '2018-04-11', 32 | 'path': 'http://p3i10hjs7.bkt.clouddn.com/bg.jpg', 33 | 'description': '最爱' 34 | }, { 35 | 'id': '3', 36 | 'name': '命运石之门', 37 | 'date': '2018-04-11', 38 | 'path': 'http://p3i10hjs7.bkt.clouddn.com/bg.jpg', 39 | 'description': '最爱' 40 | }, { 41 | 'id': '4', 42 | 'name': '命运石之门', 43 | 'date': '2018-04-11', 44 | 'path': 'http://p3i10hjs7.bkt.clouddn.com/bg.jpg', 45 | 'description': '最爱' 46 | } 47 | ] 48 | 49 | -------------------------------------------------------------------------------- /src/pages/index/index.vue: -------------------------------------------------------------------------------- 1 | 17 | 18 | 100 | 101 | 138 | -------------------------------------------------------------------------------- /src/components/timeLine.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 38 | 39 | 167 | -------------------------------------------------------------------------------- /src/components/canvasBg.vue: -------------------------------------------------------------------------------- 1 | 5 | 187 | 195 | --------------------------------------------------------------------------------