├── .gitignore ├── README.md ├── babel.config.js ├── package-lock.json ├── package.json ├── public ├── favicon.ico ├── images │ └── arrow-right.png └── index.html └── src ├── App.vue ├── assets ├── images │ └── arrow-right.png └── logo.png ├── components ├── canvas.vue ├── element.vue ├── image.vue ├── scroll-view.vue ├── text.vue └── view.vue ├── examples ├── Table.vue └── index.vue ├── index.js └── main.js /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /dist 4 | 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 | pnpm-debug.log* 15 | 16 | # Editor directories and files 17 | .idea 18 | .vscode 19 | *.suo 20 | *.ntvs* 21 | *.njsproj 22 | *.sln 23 | *.sw? 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # vue-easy-canvas 2 | 将 easy-canvas 封装成vue组件进行使用 3 | *注意:内部实现是将vue节点转换成目标节点,转换过程中会有性能损失,渲染与转换时间大概4:1* 4 | 5 | - 相关库 [easy-canvas](https://github.com/Gitjinfeiyang/easy-canvas) 6 | 7 | ## Installation 8 | ``` bash 9 | npm install vue-easy-canvas --save 10 | ``` 11 | 12 | ## Usage 13 | ``` javascript 14 | import easyCanvas from 'vue-easy-canvas' 15 | Vue.use(easyCanvas) 16 | ``` 17 | 18 | ``` html 19 | 20 | 21 | 22 | 23 | 24 | 25 | easyCanvas 26 | 27 | 28 | 29 | 37 | 38 | {{item.title}} 39 | 40 | 41 | {{item.desc}} 42 | 43 | 44 | 45 | 46 | 47 | ``` 48 | 49 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | '@vue/cli-plugin-babel/preset' 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vue-easy-canvas", 3 | "version": "0.1.0", 4 | "main": "./src/index.js", 5 | "scripts": { 6 | "serve": "vue-cli-service serve", 7 | "build": "vue-cli-service build", 8 | "lint": "vue-cli-service lint" 9 | }, 10 | "dependencies": { 11 | "core-js": "^3.6.5", 12 | "easy-canvas-layout": "0.0.8", 13 | "vue": "^2.6.11" 14 | }, 15 | "devDependencies": { 16 | "@vue/cli-plugin-babel": "~4.5.0", 17 | "@vue/cli-plugin-eslint": "~4.5.0", 18 | "@vue/cli-service": "~4.5.0", 19 | "babel-eslint": "^10.1.0", 20 | "eslint": "^6.7.2", 21 | "eslint-plugin-vue": "^6.2.2", 22 | "vue-template-compiler": "^2.6.11" 23 | }, 24 | "eslintConfig": { 25 | "root": true, 26 | "env": { 27 | "node": true 28 | }, 29 | "extends": [ 30 | "plugin:vue/essential", 31 | "eslint:recommended" 32 | ], 33 | "parserOptions": { 34 | "parser": "babel-eslint" 35 | }, 36 | "rules": {} 37 | }, 38 | "browserslist": [ 39 | "> 1%", 40 | "last 2 versions", 41 | "not dead" 42 | ] 43 | } 44 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gitjinfeiyang/vue-easy-canvas/99a513076efc4459c3150433caef99384b7c0cef/public/favicon.ico -------------------------------------------------------------------------------- /public/images/arrow-right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gitjinfeiyang/vue-easy-canvas/99a513076efc4459c3150433caef99384b7c0cef/public/images/arrow-right.png -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | <%= htmlWebpackPlugin.options.title %> 9 | 10 | 11 | 14 |
15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/App.vue: -------------------------------------------------------------------------------- 1 | 10 | 11 | 28 | 29 | 50 | -------------------------------------------------------------------------------- /src/assets/images/arrow-right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gitjinfeiyang/vue-easy-canvas/99a513076efc4459c3150433caef99384b7c0cef/src/assets/images/arrow-right.png -------------------------------------------------------------------------------- /src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gitjinfeiyang/vue-easy-canvas/99a513076efc4459c3150433caef99384b7c0cef/src/assets/logo.png -------------------------------------------------------------------------------- /src/components/canvas.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 146 | -------------------------------------------------------------------------------- /src/components/element.vue: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /src/components/image.vue: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /src/components/scroll-view.vue: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /src/components/text.vue: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /src/components/view.vue: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /src/examples/Table.vue: -------------------------------------------------------------------------------- 1 | 25 | 26 | -------------------------------------------------------------------------------- /src/examples/index.vue: -------------------------------------------------------------------------------- 1 | 65 | 66 | 116 | 117 | 123 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import canvas from './components/canvas' 2 | import element from './components/element' 3 | import image from './components/image' 4 | import scrollView from './components/scroll-view' 5 | import text from './components/text' 6 | import view from './components/view' 7 | 8 | export default { 9 | install(vue){ 10 | vue.component('ec-canvas',canvas) 11 | vue.component('ec-element',element) 12 | vue.component('ec-image',image) 13 | vue.component('ec-scroll-view',scrollView) 14 | vue.component('ec-text',text) 15 | vue.component('ec-view',view) 16 | } 17 | } -------------------------------------------------------------------------------- /src/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './App.vue' 3 | import easyCanvas from './index' 4 | 5 | Vue.config.productionTip = false 6 | 7 | Vue.use(easyCanvas) 8 | 9 | new Vue({ 10 | render: h => h(App), 11 | }).$mount('#app') 12 | --------------------------------------------------------------------------------