Skip to content

Commit 41d0f8a

Browse files
committed
update format
1 parent a1379c0 commit 41d0f8a

File tree

10 files changed

+100
-103
lines changed

10 files changed

+100
-103
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
2525
"start": "npm run dev",
2626
"lint": "eslint --ext .js,.vue src",
27+
"lint:fix": "npm run lint -- --fix",
2728
"build": "node build/build.js"
2829
},
2930
"dependencies": {

src/App.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default {
99
name: 'app',
1010
data () {
1111
return {};
12-
},
12+
}
1313
};
1414
</script>
1515

src/components/fabric/fabric.vue

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@
44
</div>
55
</template>
66

7-
<script type='text/ecmascript-6'>
7+
<script type="text/ecmascript-6">
88
import Utils from '../../utils';
99
const dotCircleImg = require('../../assets/dot-circle.png');
1010
const rotateMdrImg = require('../../assets/rotate-mdr.png');
1111
export default {
1212
name: 'VueFabric',
1313
props: {
1414
id: {
15-
type: String,
16-
required: false,
17-
default: 'fabricCanvas',
15+
type: String,
16+
required: false,
17+
default: 'fabricCanvas'
1818
},
1919
width: {
2020
type: Number,
@@ -225,7 +225,7 @@ export default {
225225
return path;
226226
},
227227
freeDrawConfig (options) {
228-
options = Object.assign({color:'#b2b2b2',drawWidth:2},options);
228+
options = Object.assign({color: '#b2b2b2', drawWidth: 2}, options);
229229
230230
this.canvas.isDrawingMode = options.isDrawingMode;
231231
this.canvas.freeDrawingBrush.color = options.color; // 设置自由绘颜色
@@ -571,15 +571,15 @@ export default {
571571
// 设置mirror
572572
toggleMirror (options) {
573573
options = options || {};
574-
options = Object.assign({ flip : 'X' },options);
574+
options = Object.assign({ flip: 'X' }, options);
575575
let img = this.canvas.getActiveObject();
576576
// if (img && img.type == 'image') {
577-
if (options.flip === 'X') {
578-
img.toggle('flipX');
579-
} else {
580-
img.toggle('flipY');
581-
}
582-
this.renderAll();
577+
if (options.flip === 'X') {
578+
img.toggle('flipX');
579+
} else {
580+
img.toggle('flipY');
581+
}
582+
this.renderAll();
583583
// }
584584
},
585585
// 设置层级
@@ -637,5 +637,4 @@ export default {
637637
};
638638
</script>
639639

640-
<style lang='scss' scoped>
641-
</style>
640+
<style lang="scss" scoped></style>

src/components/fabric/index.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
import FabricComponent from './fabric.vue'
1+
import FabricComponent from './fabric.vue';
22

3-
  const Fabric={
4-
    install:function(Vue){ //核心部分,在我们使用Vue.use()时,自动调用的是install,而install导出的必须是的组件
5-
    Vue.component(FabricComponent.name,FabricComponent);
6-
  }
3+
const Fabric = {
4+
install: function (Vue) {
5+
// 核心部分,在我们使用Vue.use()时,自动调用的是install,而install导出的必须是的组件
6+
Vue.component(FabricComponent.name, FabricComponent);
7+
}
78
};
8-
export default Fabric;
9+
export default Fabric;

src/examples/image-list.vue

Lines changed: 30 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -9,47 +9,47 @@
99

1010
<script type='text/ecmascript-6'>
1111
export default {
12-
props:{
13-
handleAdd:Function,
12+
props: {
13+
handleAdd: Function
1414
},
1515
data () {
1616
return {
17-
list:[
18-
{
19-
id:1,
20-
url:"/static/images/sticker1.png"
21-
},
22-
{
23-
id:2,
24-
url:"/static/images/sticker2.png"
25-
},
26-
{
27-
id:3,
28-
url:"/static/images/sticker3.png"
29-
},
30-
{
31-
id:4,
32-
url:"/static/images/sticker4.png"
33-
},
34-
{
35-
id:5,
36-
url:"/static/images/sticker5.png"
37-
},{
38-
id:6,
39-
url:"/static/images/sticker1.png"
40-
},
41-
],
42-
}
17+
list: [
18+
{
19+
id: 1,
20+
url: '/static/images/sticker1.png'
21+
},
22+
{
23+
id: 2,
24+
url: '/static/images/sticker2.png'
25+
},
26+
{
27+
id: 3,
28+
url: '/static/images/sticker3.png'
29+
},
30+
{
31+
id: 4,
32+
url: '/static/images/sticker4.png'
33+
},
34+
{
35+
id: 5,
36+
url: '/static/images/sticker5.png'
37+
}, {
38+
id: 6,
39+
url: '/static/images/sticker1.png'
40+
}
41+
]
42+
};
4343
},
4444
created () {
4545
},
4646
mounted () {
4747
4848
},
49-
methods:{
49+
methods: {
5050
5151
}
52-
}
52+
};
5353
</script>
5454

5555
<style lang='scss' scoped>
@@ -65,8 +65,6 @@
6565
6666
display: flex;
6767
-webkit-overflow-scrolling: touch;
68-
69-
7068
flex-wrap:nowrap;
7169
border-top: 1px solid #e4e4e4;
7270

src/examples/index-pc.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ export default {
8383
this.$refs.canvas.drawByPath([[50, 50], [120, 120], [80, 160]], {});
8484
},
8585
methods: {
86-
toggleMirror() {
87-
this.$refs.canvas.toggleMirror({flip:"Y"});
86+
toggleMirror () {
87+
this.$refs.canvas.toggleMirror({flip: 'Y'});
8888
},
8989
discardActive () {
9090
this.$refs.canvas.discardActive();

src/examples/index.vue

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,45 +8,45 @@
88
</template>
99

1010
<script>
11-
import toolbar from "./toolbar";
12-
import ImageList from "./image-list";
11+
import toolbar from './toolbar';
12+
import ImageList from './image-list';
1313
1414
export default {
1515
name: 'el-index',
16-
components:{
16+
components: {
1717
toolbar,
1818
ImageList
1919
},
20-
data(){
21-
return{
22-
imgUrl:"http://data618.oss-cn-qingdao.aliyuncs.com/ys/3524/img/b.jpg",
23-
width:300,
24-
height:500
25-
}
20+
data () {
21+
return {
22+
imgUrl: 'http://data618.oss-cn-qingdao.aliyuncs.com/ys/3524/img/b.jpg',
23+
width: 300,
24+
height: 500
25+
};
2626
},
27-
created(){
28-
this.width=document.body.offsetWidth;
29-
this.height=document.body.offsetHeight;
27+
created () {
28+
this.width = document.body.offsetWidth;
29+
this.height = document.body.offsetHeight;
3030
},
31-
mounted(){
32-
this.$refs.canvas.createTriangle(40,40,'yellow');
31+
mounted () {
32+
this.$refs.canvas.createTriangle(40, 40, 'yellow');
3333
this.$refs.canvas.createImage('/static/images/sticker1.png');
3434
this.$refs.canvas.createImage('/static/images/sticker2.png');
3535
this.$refs.canvas.createImage('/static/images/sticker3.png');
3636
},
37-
methods:{
38-
handleDelete(){
39-
console.log("handleDelete");
40-
37+
methods: {
38+
handleDelete () {
39+
console.log('handleDelete');
40+
4141
this.$refs.canvas.removeCurrentObj();
4242
},
43-
handleRotate(){
44-
this.$refs.canvas.setRotate();
43+
handleRotate () {
44+
this.$refs.canvas.setRotate();
4545
// this.$refs.canvas.moveTo();
4646
},
47-
handleAdd(url){
47+
handleAdd (url) {
4848
this.$refs.canvas.createImage(url);
49-
},
49+
}
5050
}
5151
};
5252
</script>

src/examples/toolbar.vue

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,23 @@
77

88
<script type='text/ecmascript-6'>
99
export default {
10-
props:{
11-
handleDelete:Function,
12-
rotate:Function,
13-
},
10+
props: {
11+
handleDelete: Function,
12+
rotate: Function
13+
},
1414
data () {
1515
return {
16-
}
16+
};
1717
},
1818
created () {
1919
},
2020
mounted () {
2121
2222
},
23-
methods:{
23+
methods: {
2424
2525
}
26-
}
26+
};
2727
</script>
2828

2929
<style lang='scss' scoped>

src/main.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import Vue from 'vue';
22
import App from './App';
33
import router from './router';
44

5-
import {Fabric } from '@/components';
5+
import { Fabric } from '@/components';
66
// import '../dist/hg-vcomponents.min.css';
77

88
Vue.use(Fabric);
@@ -15,4 +15,4 @@ new Vue({
1515
router,
1616
template: '<App/>',
1717
components: { App }
18-
});
18+
});

src/router/index.js

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,27 @@
11
import Vue from 'vue';
22
import Router from 'vue-router';
33
const Index = () => import('@/examples/index.vue');
4-
const PCIndex=()=> import('@/examples/index-pc.vue');
4+
const PCIndex = () => import('@/examples/index-pc.vue');
55

6-
function isMobile() {
7-
if( navigator.userAgent.match(/Android/i)
8-
|| navigator.userAgent.match(/webOS/i)
9-
|| navigator.userAgent.match(/iPhone/i)
10-
|| navigator.userAgent.match(/iPad/i)
11-
|| navigator.userAgent.match(/iPod/i)
12-
|| navigator.userAgent.match(/BlackBerry/i)
13-
|| navigator.userAgent.match(/Windows Phone/i)
14-
){
15-
return true;
16-
}
17-
else {
18-
return false;
6+
function isMobile () {
7+
if (navigator.userAgent.match(/Android/i) ||
8+
navigator.userAgent.match(/webOS/i) ||
9+
navigator.userAgent.match(/iPhone/i) ||
10+
navigator.userAgent.match(/iPad/i) ||
11+
navigator.userAgent.match(/iPod/i) ||
12+
navigator.userAgent.match(/BlackBerry/i) ||
13+
navigator.userAgent.match(/Windows Phone/i)
14+
) {
15+
return true;
16+
} else {
17+
return false;
1918
}
2019
}
2120

22-
2321
Vue.use(Router);
2422

25-
const router= new Router({
26-
mode:'history',
23+
const router = new Router({
24+
mode: 'history',
2725
routes: [
2826
{
2927
path: '/home',

0 commit comments

Comments
 (0)