├── .gitattributes ├── .gitignore ├── LICENSE ├── README.md ├── babel.config.js ├── debug.log ├── package-lock.json ├── package.json ├── public ├── favicon.ico └── index.html ├── ruler.gif └── src ├── App.vue ├── assets └── logo.png ├── components └── DLRuler.vue ├── main.js ├── router.js └── store.js /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /dist 4 | 5 | # local env files 6 | .env.local 7 | .env.*.local 8 | 9 | # Log files 10 | npm-debug.log* 11 | yarn-debug.log* 12 | yarn-error.log* 13 | 14 | # Editor directories and files 15 | .idea 16 | .vscode 17 | *.suo 18 | *.ntvs* 19 | *.njsproj 20 | *.sln 21 | *.sw* 22 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 tangzhichao 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. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # vue-ruler 2 | > 基于vue 2.x的 刻度尺,只支持移动端 3 | ## 实例代码: 4 | ``` 5 | 体重 6 | 7 | 身高 8 | 9 | 测试 10 | 11 | ``` 12 | 参数描述: 13 | 14 | value 当前值 15 | 16 | min 最小值 17 | 18 | max 最大值 19 | 20 | onChange:数值发生改变后调用, 可选参数 21 | 22 | ## 效果: 23 | ![image](https://github.com/alvin198761/vue-ruler/blob/master/ruler.gif) 24 | ## 问题: 25 | 最小刻度还有bug, 26 | 27 | ## Project setup 28 | ``` 29 | npm install 30 | ``` 31 | 32 | ### Compiles and hot-reloads for development 33 | ``` 34 | npm run start 35 | ``` 36 | 37 | ### Compiles and minifies for production 38 | ``` 39 | npm run build 40 | ``` 41 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | '@vue/app' 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /debug.log: -------------------------------------------------------------------------------- 1 | [1129/122853.491:ERROR:crash_report_database_win.cc(428)] unexpected header 2 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vue-ruler", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "start": "vue-cli-service serve --open", 7 | "build": "vue-cli-service build" 8 | }, 9 | "dependencies": { 10 | "vue": "^2.5.17", 11 | "vue-router": "^3.0.1", 12 | "vuex": "^3.0.1", 13 | "vue-plugin-touch": "^0.1.1" 14 | }, 15 | "devDependencies": { 16 | "@vue/cli-plugin-babel": "^3.2.0", 17 | "@vue/cli-service": "^3.2.0", 18 | "less": "^3.0.4", 19 | "less-loader": "^4.1.0", 20 | "vue-template-compiler": "^2.5.17" 21 | }, 22 | "postcss": { 23 | "plugins": { 24 | "autoprefixer": {} 25 | } 26 | }, 27 | "browserslist": [ 28 | "> 1%", 29 | "last 2 versions", 30 | "not ie <= 8" 31 | ] 32 | } 33 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alvin198761/vue-ruler/d908722cb70c9f0f4324aa9874ec55511585b811/public/favicon.ico -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | vue-ruler 9 | 10 | 11 | 14 |
15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /ruler.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alvin198761/vue-ruler/d908722cb70c9f0f4324aa9874ec55511585b811/ruler.gif -------------------------------------------------------------------------------- /src/App.vue: -------------------------------------------------------------------------------- 1 | 13 | 32 | 35 | -------------------------------------------------------------------------------- /src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alvin198761/vue-ruler/d908722cb70c9f0f4324aa9874ec55511585b811/src/assets/logo.png -------------------------------------------------------------------------------- /src/components/DLRuler.vue: -------------------------------------------------------------------------------- 1 | 18 | 137 | 188 | -------------------------------------------------------------------------------- /src/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './App.vue' 3 | import router from './router' 4 | import store from './store' 5 | import vueTouch from 'vue-plugin-touch'; 6 | Vue.use(vueTouch); 7 | Vue.config.productionTip = false 8 | 9 | new Vue({ 10 | router, 11 | store, 12 | render: h => h(App) 13 | }).$mount('#app') 14 | -------------------------------------------------------------------------------- /src/router.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Router from 'vue-router' 3 | 4 | Vue.use(Router) 5 | 6 | export default new Router({ 7 | routes: [ 8 | 9 | ] 10 | }) 11 | -------------------------------------------------------------------------------- /src/store.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Vuex from 'vuex' 3 | 4 | Vue.use(Vuex) 5 | 6 | export default new Vuex.Store({ 7 | state: { 8 | 9 | }, 10 | mutations: { 11 | 12 | }, 13 | actions: { 14 | 15 | } 16 | }) 17 | --------------------------------------------------------------------------------