├── .eslintrc.js ├── .gitignore ├── .prettierrc.js ├── .travis.yml ├── LICENSE ├── README.md ├── babel.config.js ├── package.json ├── public ├── favicon.ico └── index.html ├── src ├── App.vue ├── assets │ └── style.scss ├── components │ ├── animate │ │ └── newsMarquee.vue │ ├── clickToUrl.vue │ ├── common │ │ ├── floorTitle.vue │ │ ├── form.vue │ │ ├── image.vue │ │ ├── pageFaq.vue │ │ ├── pageIntro.vue │ │ ├── pageParagraph.vue │ │ ├── pageTitle.vue │ │ ├── text.vue │ │ └── timeout.vue │ ├── formItem.vue │ ├── index.ts │ ├── itemOption │ │ ├── bannerItem.vue │ │ ├── bottomMenuItem.vue │ │ ├── couponItem.vue │ │ ├── floorMenuItem.vue │ │ ├── goodsItem.vue │ │ ├── gridMenuItem.vue │ │ ├── horizontalItem.vue │ │ ├── imageClick.vue │ │ ├── inputItem.vue │ │ ├── layoutLeftItem.vue │ │ ├── layoutRepeatItem.vue │ │ ├── layoutRightItem.vue │ │ ├── marqueeItem.vue │ │ ├── pageFaqItem.vue │ │ ├── pageParagraphItem.vue │ │ ├── scrollItem.vue │ │ ├── timeoutItem.vue │ │ └── verticalItem.vue │ ├── lay │ │ ├── layoutLeft.vue │ │ ├── layoutRepeat.vue │ │ └── layoutRight.vue │ ├── list │ │ ├── horizontalList.vue │ │ └── verticalList.vue │ ├── navLink │ │ ├── bottomMenu.vue │ │ ├── floorMenu.vue │ │ └── gridMenu.vue │ ├── option.vue │ ├── pageOption.vue │ ├── preview.vue │ ├── shopping │ │ ├── coupon.vue │ │ ├── goods.vue │ │ └── goodsSearch.vue │ ├── slidebar.vue │ ├── svgIcon.vue │ ├── swiper │ │ ├── scrollLeft.vue │ │ └── swiperBanner.vue │ ├── toolbar.vue │ └── upload.vue ├── config │ ├── appPageConfig.ts │ ├── componentConfig.ts │ └── slideMenuConfig.ts ├── icons │ ├── index.ts │ ├── svg │ │ ├── blod.svg │ │ ├── carousel.svg │ │ ├── clipboard.svg │ │ ├── countDown.svg │ │ ├── coupon.svg │ │ ├── directionList.svg │ │ ├── document.svg │ │ ├── floorNav.svg │ │ ├── floorTitle.svg │ │ ├── form.svg │ │ ├── grid.svg │ │ ├── image.svg │ │ ├── introduction.svg │ │ ├── italic.svg │ │ ├── layoutLeft.svg │ │ ├── layoutRepeat.svg │ │ ├── layoutRight.svg │ │ ├── paragraph.svg │ │ ├── picTxtList.svg │ │ ├── roll.svg │ │ ├── rowScroll.svg │ │ ├── search.svg │ │ ├── shopping.svg │ │ ├── tabbar.svg │ │ ├── textCenter.svg │ │ ├── textLeft.svg │ │ ├── textRight.svg │ │ ├── title.svg │ │ ├── transverseList.svg │ │ └── underline.svg │ └── svgo.yml ├── main.ts ├── shims-tsx.d.ts ├── shims-vue.d.ts └── utils │ ├── dragarea.ts │ ├── newsMarquee.ts │ └── tools.ts ├── tests └── unit │ └── example.spec.ts ├── tsconfig.json └── vue.config.js /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { 4 | node: true 5 | }, 6 | extends: ["plugin:vue/essential", "@vue/prettier", "@vue/typescript"], 7 | rules: { 8 | "no-console": process.env.NODE_ENV === "production" ? "error" : "off", 9 | "no-debugger": process.env.NODE_ENV === "production" ? "error" : "off", 10 | "prettier/prettier": "off" 11 | }, 12 | parserOptions: { 13 | parser: "@typescript-eslint/parser" 14 | } 15 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /dist 4 | 5 | # local env files 6 | .env.local 7 | .env.*.local 8 | 9 | yarn.lock 10 | 11 | package-lock.json 12 | 13 | # Log files 14 | npm-debug.log* 15 | yarn-debug.log* 16 | yarn-error.log* 17 | 18 | # Editor directories and files 19 | .idea 20 | .vscode 21 | *.suo 22 | *.ntvs* 23 | *.njsproj 24 | *.sln 25 | *.sw? 26 | -------------------------------------------------------------------------------- /.prettierrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | singleQuote: true, 3 | semi: false 4 | } -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "8" 4 | 5 | install: 6 | - npm install 7 | 8 | script: 9 | - npm run build 10 | 11 | after_success: 12 | - cd ./dist 13 | - git init 14 | - git config --global user.name "${U_NAME}" 15 | - git config --global user.email "${U_EMAIL}" 16 | - git add . 17 | - git commit -m "Automatically update from travis-ci" 18 | - git push --quiet --force "https://${GH_TOKEN}@${GH_REF}" master:${P_BRANCH} 19 | 20 | branches: 21 | only: 22 | - master 23 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 typeofNaN 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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # visual editing 2 | 3 | :factory: Mobile page visual editor, using Vue and typescript to build. 4 | 5 | ## Demo 6 | 7 | [在线预览/Online preview](https://typeofnan.github.io/visual-editing) 8 | 9 | ## Project setup 10 | 11 | ### Install 12 | 13 | ``` bash 14 | yarn 15 | ``` 16 | 17 | ### Compiles and hot-reloads for development 18 | 19 | ``` bash 20 | yarn serve 21 | ``` 22 | 23 | ### Compiles and minifies for production 24 | 25 | ``` bash 26 | yarn build 27 | ``` 28 | 29 | ### Run your unit tests 30 | 31 | ``` bash 32 | yarn test:unit 33 | ``` 34 | 35 | ### Analyze 36 | 37 | ``` bash 38 | yarn preview 39 | ``` 40 | 41 | ### Lints and fixes files 42 | 43 | ``` bash 44 | yarn lint 45 | ``` 46 | 47 | ## Continuous integration 48 | 49 | 通过 Travis 持续集成,自动部署。Automatic deployment through **Travis** continuous integration. 50 | 51 | ## Customize configuration 52 | See [Configuration Reference](https://cli.vuejs.org/config/). 53 | 54 | ## License 55 | 56 | [MIT](https://opensource.org/licenses/MIT) 57 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: ["@vue/cli-plugin-babel/preset"] 3 | }; 4 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "visual-editing", 3 | "version": "0.1.0", 4 | "private": true, 5 | "homepage": "https://typeofNaN.github.io/visual-editing", 6 | "scripts": { 7 | "serve": "vue-cli-service serve", 8 | "build": "vue-cli-service build", 9 | "preview": "vue-cli-service build --report", 10 | "test:unit": "vue-cli-service test:unit", 11 | "lint": "vue-cli-service lint" 12 | }, 13 | "dependencies": { 14 | "core-js": "^3.6.4", 15 | "element-ui": "^2.13.2", 16 | "vue": "^2.6.11", 17 | "vue-class-component": "^7.2.3", 18 | "vue-property-decorator": "^8.4.1" 19 | }, 20 | "devDependencies": { 21 | "@types/jest": "^24.0.19", 22 | "@typescript-eslint/eslint-plugin": "^2.26.0", 23 | "@typescript-eslint/parser": "^2.26.0", 24 | "@vue/cli-plugin-babel": "~4.3.0", 25 | "@vue/cli-plugin-eslint": "~4.3.0", 26 | "@vue/cli-plugin-typescript": "~4.3.0", 27 | "@vue/cli-plugin-unit-jest": "~4.3.0", 28 | "@vue/cli-service": "~4.3.0", 29 | "@vue/eslint-config-prettier": "^6.0.0", 30 | "@vue/eslint-config-typescript": "^5.0.2", 31 | "@vue/test-utils": "1.0.0-beta.31", 32 | "eslint": "^6.7.2", 33 | "eslint-plugin-prettier": "^3.1.1", 34 | "eslint-plugin-vue": "^6.2.2", 35 | "iscroll": "^5.2.0", 36 | "node-sass": "^4.12.0", 37 | "prettier": "^1.19.1", 38 | "sass-loader": "^8.0.2", 39 | "svg-sprite-loader": "^5.0.0", 40 | "typescript": "~3.8.3", 41 | "vue-template-compiler": "^2.6.11" 42 | }, 43 | "eslintConfig": { 44 | "root": true, 45 | "env": { 46 | "node": true 47 | }, 48 | "extends": [ 49 | "plugin:vue/essential", 50 | "eslint:recommended", 51 | "@vue/typescript/recommended", 52 | "@vue/prettier", 53 | "@vue/prettier/@typescript-eslint" 54 | ], 55 | "parserOptions": { 56 | "ecmaVersion": 2020 57 | }, 58 | "rules": {}, 59 | "overrides": [ 60 | { 61 | "files": [ 62 | "**/__tests__/*.{j,t}s?(x)", 63 | "**/tests/unit/**/*.spec.{j,t}s?(x)" 64 | ], 65 | "env": { 66 | "jest": true 67 | } 68 | } 69 | ] 70 | }, 71 | "browserslist": [ 72 | "> 1%", 73 | "last 2 versions", 74 | "not dead" 75 | ], 76 | "jest": { 77 | "preset": "@vue/cli-plugin-unit-jest/presets/typescript-and-babel" 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/typeofNaN/visual-editing/d60e1b620a98655e2fd9cc4ec3e305e19d8b80c8/public/favicon.ico -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | <%= htmlWebpackPlugin.options.title %> 9 | 10 | 11 | 14 |
15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/assets/style.scss: -------------------------------------------------------------------------------- 1 | * { 2 | margin: 0; 3 | padding: 0; 4 | box-sizing: border-box; 5 | } 6 | 7 | ::-webkit-scrollbar { 8 | width: 0.25rem; 9 | height: 0.25rem; 10 | background-color: #ccc; 11 | } 12 | 13 | ::-webkit-scrollbar-track { 14 | border-radius: 0; 15 | } 16 | 17 | ::-webkit-scrollbar-thumb { 18 | border-radius: 0; 19 | background-color: #666; 20 | transition: all .2s; 21 | border-radius: 0.25rem; 22 | } 23 | 24 | ::-webkit-scrollbar-thumb:hover { 25 | background-color: rgba(95, 95, 95, 0.7); 26 | } -------------------------------------------------------------------------------- /src/components/animate/newsMarquee.vue: -------------------------------------------------------------------------------- 1 | 19 | 20 | 82 | 83 | 102 | -------------------------------------------------------------------------------- /src/components/clickToUrl.vue: -------------------------------------------------------------------------------- 1 | 143 | 144 | 249 | 250 | 261 | -------------------------------------------------------------------------------- /src/components/common/floorTitle.vue: -------------------------------------------------------------------------------- 1 | 20 | 21 | 72 | 73 | 90 | -------------------------------------------------------------------------------- /src/components/common/form.vue: -------------------------------------------------------------------------------- 1 | 43 | 44 | 122 | 123 | 163 | -------------------------------------------------------------------------------- /src/components/common/image.vue: -------------------------------------------------------------------------------- 1 | 20 | 21 | 48 | 49 | 76 | -------------------------------------------------------------------------------- /src/components/common/pageFaq.vue: -------------------------------------------------------------------------------- 1 | 17 | 18 | 46 | 47 | 52 | -------------------------------------------------------------------------------- /src/components/common/pageIntro.vue: -------------------------------------------------------------------------------- 1 | 17 | 18 | 54 | 55 | 76 | -------------------------------------------------------------------------------- /src/components/common/pageParagraph.vue: -------------------------------------------------------------------------------- 1 | 27 | 28 | 54 | 55 | 105 | -------------------------------------------------------------------------------- /src/components/common/pageTitle.vue: -------------------------------------------------------------------------------- 1 | 15 | 16 | 76 | 77 | 100 | -------------------------------------------------------------------------------- /src/components/common/text.vue: -------------------------------------------------------------------------------- 1 | 12 | 13 | 51 | 52 | 60 | -------------------------------------------------------------------------------- /src/components/common/timeout.vue: -------------------------------------------------------------------------------- 1 | 32 | 33 | 135 | 136 | 162 | -------------------------------------------------------------------------------- /src/components/formItem.vue: -------------------------------------------------------------------------------- 1 | 164 | 165 | 213 | 214 | 221 | 222 | 235 | -------------------------------------------------------------------------------- /src/components/index.ts: -------------------------------------------------------------------------------- 1 | import BaseText from '@/components/common/text.vue' 2 | import BaseImage from '@/components/common/image.vue' 3 | import BaseForm from '@/components/common/form.vue' 4 | import PageTitle from '@/components/common/pageTitle.vue' 5 | import PageParagraph from '@/components/common/pageParagraph.vue' 6 | import PageIntro from '@/components/common/pageIntro.vue' 7 | import Timeout from '@/components/common/timeout.vue' 8 | import FloorTitle from '@/components/common/floorTitle.vue' 9 | import PageFaq from '@/components/common/pageFaq.vue' 10 | 11 | import BottomMenu from '@/components/navLink/bottomMenu.vue' 12 | import GridMenu from '@/components/navLink/gridMenu.vue' 13 | import FloorMenu from '@/components/navLink/floorMenu.vue' 14 | 15 | import LayoutRepeat from '@/components/lay/layoutRepeat.vue' 16 | import LayoutLeft from '@/components/lay/layoutLeft.vue' 17 | import LayoutRight from '@/components/lay/layoutRight.vue' 18 | 19 | import GoodsSearch from '@/components/shopping/goodsSearch.vue' 20 | import Coupon from '@/components/shopping/coupon.vue' 21 | import Goods from '@/components/shopping/goods.vue' 22 | 23 | import SwiperBanner from '@/components/swiper/swiperBanner.vue' 24 | import ScrollLeft from '@/components/swiper/scrollLeft.vue' 25 | 26 | import HorizontalList from '@/components/list/horizontalList.vue' 27 | import VerticalList from '@/components/list/verticalList.vue' 28 | 29 | import NewsMarquee from '@/components/animate/newsMarquee.vue' 30 | 31 | export default { 32 | install (Vue: any) { 33 | Vue.component('BaseText', BaseText) 34 | Vue.component('BaseImage', BaseImage) 35 | Vue.component('BaseForm', BaseForm) 36 | Vue.component('PageTitle', PageTitle) 37 | Vue.component('PageParagraph', PageParagraph) 38 | Vue.component('PageIntro', PageIntro) 39 | Vue.component('Timeout', Timeout) 40 | Vue.component('FloorTitle', FloorTitle) 41 | Vue.component('PageFaq', PageFaq) 42 | 43 | Vue.component('BottomMenu', BottomMenu) 44 | Vue.component('GridMenu', GridMenu) 45 | Vue.component('FloorMenu', FloorMenu) 46 | 47 | Vue.component('LayoutRepeat', LayoutRepeat) 48 | Vue.component('LayoutLeft', LayoutLeft) 49 | Vue.component('LayoutRight', LayoutRight) 50 | 51 | Vue.component('GoodsSearch', GoodsSearch) 52 | Vue.component('Coupon', Coupon) 53 | Vue.component('Goods', Goods) 54 | 55 | Vue.component('SwiperBanner', SwiperBanner) 56 | Vue.component('ScrollLeft', ScrollLeft) 57 | 58 | Vue.component('HorizontalList', HorizontalList) 59 | Vue.component('VerticalList', VerticalList) 60 | 61 | Vue.component('NewsMarquee', NewsMarquee) 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/components/itemOption/bannerItem.vue: -------------------------------------------------------------------------------- 1 | 64 | 65 | 124 | -------------------------------------------------------------------------------- /src/components/itemOption/bottomMenuItem.vue: -------------------------------------------------------------------------------- 1 | 75 | 76 | 135 | -------------------------------------------------------------------------------- /src/components/itemOption/couponItem.vue: -------------------------------------------------------------------------------- 1 | 65 | 66 | 121 | -------------------------------------------------------------------------------- /src/components/itemOption/floorMenuItem.vue: -------------------------------------------------------------------------------- 1 | 70 | 71 | 122 | -------------------------------------------------------------------------------- /src/components/itemOption/goodsItem.vue: -------------------------------------------------------------------------------- 1 | 67 | 68 | 113 | -------------------------------------------------------------------------------- /src/components/itemOption/gridMenuItem.vue: -------------------------------------------------------------------------------- 1 | 75 | 76 | 131 | -------------------------------------------------------------------------------- /src/components/itemOption/horizontalItem.vue: -------------------------------------------------------------------------------- 1 | 66 | 67 | 112 | -------------------------------------------------------------------------------- /src/components/itemOption/inputItem.vue: -------------------------------------------------------------------------------- 1 | 101 | 102 | 169 | -------------------------------------------------------------------------------- /src/components/itemOption/layoutLeftItem.vue: -------------------------------------------------------------------------------- 1 | 42 | 43 | 74 | -------------------------------------------------------------------------------- /src/components/itemOption/layoutRepeatItem.vue: -------------------------------------------------------------------------------- 1 | 65 | 66 | 117 | -------------------------------------------------------------------------------- /src/components/itemOption/layoutRightItem.vue: -------------------------------------------------------------------------------- 1 | 42 | 43 | 74 | -------------------------------------------------------------------------------- /src/components/itemOption/marqueeItem.vue: -------------------------------------------------------------------------------- 1 | 70 | 71 | 122 | -------------------------------------------------------------------------------- /src/components/itemOption/pageFaqItem.vue: -------------------------------------------------------------------------------- 1 | 81 | 82 | 127 | -------------------------------------------------------------------------------- /src/components/itemOption/pageParagraphItem.vue: -------------------------------------------------------------------------------- 1 | 63 | 64 | 105 | -------------------------------------------------------------------------------- /src/components/itemOption/scrollItem.vue: -------------------------------------------------------------------------------- 1 | 65 | 66 | 121 | -------------------------------------------------------------------------------- /src/components/itemOption/verticalItem.vue: -------------------------------------------------------------------------------- 1 | 67 | 68 | 113 | -------------------------------------------------------------------------------- /src/components/lay/layoutLeft.vue: -------------------------------------------------------------------------------- 1 | 48 | 49 | 77 | 78 | 118 | -------------------------------------------------------------------------------- /src/components/lay/layoutRepeat.vue: -------------------------------------------------------------------------------- 1 | 27 | 28 | 60 | 61 | 99 | -------------------------------------------------------------------------------- /src/components/lay/layoutRight.vue: -------------------------------------------------------------------------------- 1 | 48 | 49 | 77 | 78 | 118 | -------------------------------------------------------------------------------- /src/components/list/horizontalList.vue: -------------------------------------------------------------------------------- 1 | 36 | 37 | 80 | 81 | 155 | -------------------------------------------------------------------------------- /src/components/list/verticalList.vue: -------------------------------------------------------------------------------- 1 | 36 | 37 | 79 | 80 | 158 | -------------------------------------------------------------------------------- /src/components/navLink/bottomMenu.vue: -------------------------------------------------------------------------------- 1 | 23 | 24 | 53 | 54 | 99 | -------------------------------------------------------------------------------- /src/components/navLink/floorMenu.vue: -------------------------------------------------------------------------------- 1 | 24 | 25 | 78 | 79 | 117 | -------------------------------------------------------------------------------- /src/components/navLink/gridMenu.vue: -------------------------------------------------------------------------------- 1 | 28 | 29 | 62 | 63 | 109 | -------------------------------------------------------------------------------- /src/components/option.vue: -------------------------------------------------------------------------------- 1 | 138 | 139 | 202 | 203 | 282 | -------------------------------------------------------------------------------- /src/components/pageOption.vue: -------------------------------------------------------------------------------- 1 | 38 | 39 | 55 | 56 | 114 | -------------------------------------------------------------------------------- /src/components/preview.vue: -------------------------------------------------------------------------------- 1 | 158 | 159 | 208 | 209 | 214 | 215 | 247 | -------------------------------------------------------------------------------- /src/components/shopping/coupon.vue: -------------------------------------------------------------------------------- 1 | 28 | 29 | 63 | 64 | 103 | -------------------------------------------------------------------------------- /src/components/shopping/goods.vue: -------------------------------------------------------------------------------- 1 | 37 | 38 | 79 | 80 | 155 | -------------------------------------------------------------------------------- /src/components/shopping/goodsSearch.vue: -------------------------------------------------------------------------------- 1 | 27 | 28 | 72 | 73 | 97 | -------------------------------------------------------------------------------- /src/components/slidebar.vue: -------------------------------------------------------------------------------- 1 | 42 | 43 | 71 | 72 | 139 | -------------------------------------------------------------------------------- /src/components/svgIcon.vue: -------------------------------------------------------------------------------- 1 | 10 | 11 | 37 | 38 | 53 | -------------------------------------------------------------------------------- /src/components/swiper/scrollLeft.vue: -------------------------------------------------------------------------------- 1 | 31 | 32 | 80 | 81 | 143 | -------------------------------------------------------------------------------- /src/components/swiper/swiperBanner.vue: -------------------------------------------------------------------------------- 1 | 29 | 30 | 83 | 84 | 102 | -------------------------------------------------------------------------------- /src/components/toolbar.vue: -------------------------------------------------------------------------------- 1 | 40 | 41 | 65 | 66 | 95 | -------------------------------------------------------------------------------- /src/config/appPageConfig.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | title: '页面配置', 3 | base: [ 4 | { 5 | type: 'text', 6 | label: '页面名称', 7 | attr: 'page-name', 8 | placeholder: '页面名称', 9 | val: '', 10 | isNecessary: true 11 | } 12 | ], 13 | style: [ 14 | { 15 | type: 'color-picker', 16 | label: '背景颜色', 17 | attr: 'background-color', 18 | val: '#ffffff' 19 | }, { 20 | type: 'upload', 21 | label: '背景图片', 22 | attr: 'background-image', 23 | val: '' 24 | }, { 25 | type: 'select', 26 | label: '背景效果', 27 | attr: 'background-repeat', 28 | val: '', 29 | options: [ 30 | { 31 | name: '无', 32 | val: 'no-repeat' 33 | }, { 34 | name: '水平重复', 35 | val: 'repeat-x' 36 | }, { 37 | name: '垂直重复', 38 | val: 'repeat-y' 39 | }, { 40 | name: '水平+垂直重复', 41 | val: 'repeat' 42 | } 43 | ] 44 | } 45 | ], 46 | weixin: [ 47 | { 48 | type: 'text', 49 | label: 'jssdk api', 50 | attr: 'page-share-api', 51 | placeholder: '微信分享接口地址', 52 | val: '', 53 | isNecessary: true 54 | }, { 55 | type: 'text', 56 | label: '跳转地址', 57 | attr: 'page-share-url', 58 | placeholder: '跳转地址,不填则代表当前页', 59 | val: '', 60 | isNecessary: false 61 | }, { 62 | type: 'text', 63 | label: '分享标题', 64 | attr: 'page-share-title', 65 | placeholder: '微信分享的标题', 66 | val: '', 67 | isNecessary: true 68 | }, { 69 | type: 'textarea', 70 | label: '分享描述', 71 | attr: 'page-share-desc', 72 | placeholder: '微信分享的描述文字', 73 | val: '', 74 | isNecessary: true 75 | }, { 76 | type: 'upload', 77 | label: '分享图标', 78 | attr: 'page-share-icon', 79 | val: '', 80 | isNecessary: true 81 | }, { 82 | type: 'desc', 83 | label: '使用说明', 84 | val: `获取微信签名的接口请使用get(application/json)方式,跨域需接口支持,返回格式如下:
85 | { 86 | data: { 87 | appId: 'appId', 88 | timestamp: 15888888, 89 | nonceStr: 'nonceStr', 90 | signature: 'signature', 91 | }, 92 | msg: '不为空则提示该消息' 93 | }` 94 | } 95 | ] 96 | } 97 | -------------------------------------------------------------------------------- /src/config/slideMenuConfig.ts: -------------------------------------------------------------------------------- 1 | export default [ 2 | { 3 | title: '通用组件', 4 | collapse: false, 5 | items: [ 6 | { 7 | key: 'text', 8 | text: '文本', 9 | icon: 'document' 10 | }, { 11 | key: 'img', 12 | text: '图片', 13 | icon: 'image' 14 | }, { 15 | key: 'form', 16 | text: '表单', 17 | icon: 'form' 18 | }, { 19 | key: 'page-title', 20 | text: '标题', 21 | icon: 'title' 22 | }, { 23 | key: 'page-paragraph', 24 | text: '段落', 25 | icon: 'paragraph' 26 | }, { 27 | key: 'page-intro', 28 | text: '引言', 29 | icon: 'introduction' 30 | }, { 31 | key: 'timeout', 32 | text: '倒计时', 33 | icon: 'countDown' 34 | }, { 35 | key: 'floor-title', 36 | text: '楼层标题', 37 | icon: 'floorTitle' 38 | } 39 | ] 40 | }, { 41 | title: '导航组件', 42 | collapse: false, 43 | items: [ 44 | { 45 | key: 'bottom-menu', 46 | text: '底部导航', 47 | icon: 'tabbar' 48 | }, { 49 | key: 'grid-menu', 50 | text: '网格导航', 51 | icon: 'grid' 52 | }, { 53 | key: 'floor-menu', 54 | text: '楼层导航', 55 | icon: 'floorNav' 56 | } 57 | ] 58 | }, { 59 | title: '布局组件', 60 | collapse: false, 61 | items: [ 62 | { 63 | key: 'layout-repeat', 64 | text: '平铺布局', 65 | icon: 'layoutRepeat' 66 | }, { 67 | key: 'layout-left', 68 | text: '两栏布局左', 69 | icon: 'layoutLeft' 70 | }, { 71 | key: 'layout-right', 72 | text: '两栏布局右', 73 | icon: 'layoutRight' 74 | } 75 | ] 76 | // }, { 77 | // title: '公共组件', 78 | // collapse: false, 79 | // items: [ 80 | // { 81 | // key: 'page-faq', 82 | // text: 'FAQ', 83 | // icon: 'faq' 84 | // }, { 85 | // key: 'page-guide', 86 | // text: '步骤', 87 | // icon: 'step' 88 | // }, { 89 | // key: 'page-footer', 90 | // text: '页脚', 91 | // icon: 'copyright' 92 | // } 93 | // ] 94 | }, { 95 | title: '商城组件', 96 | collapse: false, 97 | items: [ 98 | { 99 | key: 'goods-search', 100 | text: '商品搜索', 101 | icon: 'search' 102 | }, { 103 | key: 'coupon', 104 | text: '优惠券', 105 | icon: 'coupon' 106 | }, { 107 | key: 'goods', 108 | text: '自定义商品', 109 | icon: 'shopping' 110 | } 111 | ] 112 | }, { 113 | title: '轮播组件', 114 | collapse: false, 115 | items: [ 116 | { 117 | key: 'swiper-banner', 118 | text: '轮播图', 119 | icon: 'carousel' 120 | }, { 121 | key: 'scroll-left', 122 | text: '横向滚动', 123 | icon: 'rowScroll' 124 | } 125 | ] 126 | }, { 127 | title: '图文列表', 128 | collapse: false, 129 | items: [ 130 | { 131 | key: 'horizontal-list', 132 | text: '横向列表', 133 | icon: 'directionList' 134 | }, { 135 | key: 'vertical-list', 136 | text: '纵向列表', 137 | icon: 'transverseList' 138 | } 139 | ] 140 | }, { 141 | title: '动画组件', 142 | collapse: false, 143 | items: [ 144 | { 145 | key: 'news-marquee', 146 | text: '滚动新闻', 147 | icon: 'roll' 148 | } 149 | ] 150 | } 151 | ] 152 | -------------------------------------------------------------------------------- /src/icons/index.ts: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import SvgIcon from '@/components/svgIcon.vue' 3 | 4 | Vue.component('svg-icon', SvgIcon) 5 | 6 | const req = require.context('./svg', false, /\.svg$/) 7 | const requireAll = (requireContext: any) => requireContext.keys().map(requireContext) 8 | requireAll(req) 9 | -------------------------------------------------------------------------------- /src/icons/svg/blod.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/icons/svg/carousel.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/icons/svg/clipboard.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/icons/svg/countDown.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/icons/svg/coupon.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/icons/svg/directionList.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/icons/svg/document.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/icons/svg/floorNav.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/icons/svg/floorTitle.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/icons/svg/form.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/icons/svg/grid.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/icons/svg/image.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/icons/svg/introduction.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/icons/svg/italic.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/icons/svg/layoutLeft.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/icons/svg/layoutRepeat.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/icons/svg/layoutRight.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/icons/svg/paragraph.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/icons/svg/picTxtList.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/icons/svg/roll.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/icons/svg/rowScroll.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/icons/svg/search.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/icons/svg/shopping.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/icons/svg/tabbar.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/icons/svg/textCenter.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/icons/svg/textLeft.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/icons/svg/textRight.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/icons/svg/title.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/icons/svg/transverseList.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/icons/svg/underline.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/icons/svgo.yml: -------------------------------------------------------------------------------- 1 | # replace default config 2 | 3 | # multipass: true 4 | # full: true 5 | 6 | plugins: 7 | 8 | # - name 9 | # 10 | # or: 11 | # - name: false 12 | # - name: true 13 | # 14 | # or: 15 | # - name: 16 | # param1: 1 17 | # param2: 2 18 | 19 | - removeAttrs: 20 | attrs: 21 | - 'fill' 22 | - 'fill-rule' 23 | -------------------------------------------------------------------------------- /src/main.ts: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './App.vue' 3 | import ElementUI from 'element-ui' 4 | import 'element-ui/lib/theme-chalk/index.css' 5 | 6 | import H5Components from './components/index' 7 | import './icons/index' 8 | 9 | import './assets/style.scss' 10 | 11 | Vue.use(H5Components) 12 | Vue.use(ElementUI) 13 | 14 | Vue.config.productionTip = false 15 | Vue.prototype.$evt = new Vue() 16 | 17 | new Vue({ 18 | el: '#app', 19 | components: { App }, 20 | template: '' 21 | }) -------------------------------------------------------------------------------- /src/shims-tsx.d.ts: -------------------------------------------------------------------------------- 1 | import Vue, { VNode } from "vue"; 2 | 3 | declare global { 4 | namespace JSX { 5 | // tslint:disable no-empty-interface 6 | interface Element extends VNode {} 7 | // tslint:disable no-empty-interface 8 | interface ElementClass extends Vue {} 9 | interface IntrinsicElements { 10 | [elem: string]: any; 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/shims-vue.d.ts: -------------------------------------------------------------------------------- 1 | declare module "*.vue" { 2 | import Vue from "vue"; 3 | export default Vue; 4 | } 5 | 6 | declare module '*.js' 7 | 8 | declare module 'iscroll' 9 | -------------------------------------------------------------------------------- /src/utils/newsMarquee.ts: -------------------------------------------------------------------------------- 1 | (function (root: any, factory: Function) { 2 | if (typeof module !== 'undefined' && module.exports) { 3 | module.exports = factory() 4 | } else { 5 | root['newsMarquee'] = factory() 6 | } 7 | }(this, function () { 8 | 'use strict' 9 | 10 | function Marquee (this: any, el: string | HTMLElement, opt: any) { 11 | var _self = this 12 | this.oMarquee = typeof el === 'string' ? document.querySelector(el) : el 13 | if (!this.oMarquee) return 14 | 15 | this.copyNode = _self.oMarquee.children[0].cloneNode(true) 16 | this.iLineHeight = this.oMarquee.children[0].offsetHeight 17 | this.iLineCount = this.oMarquee.children.length 18 | this.timer1 = null 19 | this.timer2 = null 20 | 21 | this.options = { 22 | successive: false, 23 | speed: 1000 / 60, 24 | pause: 3500 25 | } 26 | 27 | for (var i in opt) { 28 | this.options[i] = opt[i] 29 | } 30 | 31 | appendChild() 32 | 33 | function run () { 34 | _self.oMarquee.scrollTop += 1 35 | if (_self.oMarquee.scrollTop >= _self.iLineCount * _self.iLineHeight) { 36 | _self.oMarquee.scrollTop = 0 37 | } 38 | if (_self.options.successive) { 39 | _self.timer1 && clearTimeout(_self.timer1) 40 | _self.timer1 = setTimeout(run, _self.options.speed) 41 | } else { 42 | if (_self.oMarquee.scrollTop % _self.iLineHeight === 0) { 43 | _self.timer2 && clearTimeout(_self.timer2) 44 | _self.timer2 = setTimeout(run, _self.options.pause) 45 | } else { 46 | _self.timer1 && clearTimeout(_self.timer1) 47 | _self.timer1 = setTimeout(run, _self.options.speed) 48 | } 49 | } 50 | } 51 | 52 | function appendChild () { 53 | _self.oMarquee.appendChild(_self.copyNode) 54 | } 55 | 56 | run() 57 | 58 | this.destroy = function () { 59 | _self.timer1 && clearTimeout(_self.timer1) 60 | _self.timer2 && clearTimeout(_self.timer2) 61 | _self.copyNode.parentNode.removeChild(_self.copyNode) 62 | } 63 | } 64 | 65 | return Marquee 66 | })) 67 | -------------------------------------------------------------------------------- /src/utils/tools.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | createDomID (len?: number) { 3 | return Number(Math.random().toString().substr(3, len)).toString(36) 4 | }, 5 | copyObj (obj: any) { 6 | return JSON.parse(JSON.stringify(obj)) 7 | }, 8 | parseTime (time: any, cFormat?: string) { 9 | if (arguments.length === 0) { 10 | return null 11 | } 12 | const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}' 13 | let date 14 | if (typeof time === 'object') { 15 | date = time 16 | } else { 17 | if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) { 18 | time = parseInt(time) 19 | } 20 | if ((typeof time === 'number') && (time.toString().length === 10)) { 21 | time = time * 1000 22 | } 23 | date = new Date(time) 24 | } 25 | const formatObj: any = { 26 | y: date.getFullYear(), 27 | m: date.getMonth() + 1, 28 | d: date.getDate(), 29 | h: date.getHours(), 30 | i: date.getMinutes(), 31 | s: date.getSeconds(), 32 | a: date.getDay() 33 | } 34 | const timeStr = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key: string) => { 35 | let value = formatObj[key] 36 | // Note: getDay() returns 0 on Sunday 37 | if (key === 'a') { 38 | return ['日', '一', '二', '三', '四', '五', '六'][value] 39 | } 40 | if (result.length > 0 && value < 10) { 41 | value = '0' + value 42 | } 43 | return value || 0 44 | }) 45 | return timeStr 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /tests/unit/example.spec.ts: -------------------------------------------------------------------------------- 1 | import { shallowMount } from "@vue/test-utils"; 2 | import HelloWorld from "@/components/HelloWorld.vue"; 3 | 4 | describe("HelloWorld.vue", () => { 5 | it("renders props.msg when passed", () => { 6 | const msg = "new message"; 7 | const wrapper = shallowMount(HelloWorld, { 8 | propsData: { msg } 9 | }); 10 | expect(wrapper.text()).toMatch(msg); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "esnext", 4 | "module": "esnext", 5 | "strict": true, 6 | "jsx": "preserve", 7 | "importHelpers": true, 8 | "moduleResolution": "node", 9 | "experimentalDecorators": true, 10 | "esModuleInterop": true, 11 | "allowSyntheticDefaultImports": true, 12 | "sourceMap": true, 13 | "baseUrl": ".", 14 | "types": [ 15 | "webpack-env", 16 | "jest" 17 | ], 18 | "paths": { 19 | "@/*": [ 20 | "src/*" 21 | ] 22 | }, 23 | "lib": [ 24 | "esnext", 25 | "dom", 26 | "dom.iterable", 27 | "scripthost" 28 | ] 29 | }, 30 | "include": [ 31 | "src/**/*.ts", 32 | "src/**/*.tsx", 33 | "src/**/*.vue", 34 | "tests/**/*.ts", 35 | "tests/**/*.tsx", 36 | "src/**/*.js" 37 | ], 38 | "exclude": [ 39 | "node_modules" 40 | ] 41 | } 42 | -------------------------------------------------------------------------------- /vue.config.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const path = require('path') 3 | 4 | function resolve(dir) { 5 | return path.join(__dirname, dir) 6 | } 7 | 8 | module.exports = { 9 | //开发服务配置 10 | devServer: { 11 | port: 3000, // 端口号 12 | host: 'localhost', // 主机 13 | https: false, // 是否启用https 14 | open: false // 配置是否自动启动浏览器 15 | }, 16 | configureWebpack: { 17 | resolve: { 18 | extensions: ['.js', '.vue', '.json', '.ts'], 19 | alias: { 20 | '@': resolve('src'), 21 | } 22 | }, 23 | plugins: [], 24 | // webpack-load配置 25 | module: { 26 | rules: [] 27 | } 28 | }, 29 | publicPath: process.env.NODE_ENV === 'production' ? '././' : './', 30 | runtimeCompiler: true, 31 | chainWebpack: config => { 32 | config.module 33 | .rule('svg') 34 | .exclude.add(resolve('src/icons')) 35 | .end() 36 | 37 | config.module 38 | .rule('icons') 39 | .test(/\.svg$/) 40 | .include.add(resolve('src/icons')) 41 | .end() 42 | .use('svg-sprite-loader') 43 | .loader('svg-sprite-loader') 44 | .options({ 45 | symbolId: 'icon-[name]' 46 | }) 47 | } 48 | } --------------------------------------------------------------------------------