Skip to content

Commit 9d137b7

Browse files
author
zhongjie
committed
调整filters等js文件为ts格式
1 parent 3c92884 commit 9d137b7

File tree

8 files changed

+51
-22
lines changed

8 files changed

+51
-22
lines changed

src/components/api-table.vue

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<div class="site-api">
3-
<div v-if="dataApiData && dataApiData.length">
3+
<div v-if="dataApiData.length">
44
<div class="site-content-subtitle">
55
DATA-API
66
</div>
@@ -35,7 +35,7 @@
3535
</code></pre>
3636
</div>
3737

38-
<div v-if="attrData && attrData.length">
38+
<div v-if="attrData.length">
3939
<div class="site-content-subtitle">
4040
属性
4141
</div>
@@ -68,7 +68,7 @@
6868
</div>
6969
</div>
7070

71-
<div v-if="eventData && eventData.length">
71+
<div v-if="eventData.length">
7272
<div class="site-content-subtitle">
7373
事件
7474
</div>
@@ -94,7 +94,7 @@
9494
</div>
9595
</div>
9696

97-
<div v-if="hookData && hookData.length">
97+
<div v-if="hookData.length">
9898
<div class="site-content-subtitle">
9999
钩子方法
100100
</div>
@@ -141,16 +141,36 @@ export default class extends Vue {
141141
@Prop()
142142
code: any;
143143
144-
@Prop()
144+
@Prop({
145+
type: Array,
146+
default: () => {
147+
return [];
148+
}
149+
})
145150
dataApiData: any[];
146151
147-
@Prop()
152+
@Prop({
153+
type: Array,
154+
default: () => {
155+
return [];
156+
}
157+
})
148158
attrData: any[];
149159
150-
@Prop()
160+
@Prop({
161+
type: Array,
162+
default: () => {
163+
return [];
164+
}
165+
})
151166
eventData: any[];
152167
153-
@Prop()
168+
@Prop({
169+
type: Array,
170+
default: () => {
171+
return [];
172+
}
173+
})
154174
hookData: any[];
155175
156176
created() {

src/components/color-item.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ export default class extends Vue {
3636
title: string;
3737
3838
get middleIndex():number {
39-
console.log(Math.ceil(this.colorArr.length / 2), 'colorArr')
4039
return Math.ceil(this.colorArr.length / 2);
4140
}
4241
}

src/data/index.js renamed to src/data/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const componentMenu = [
1+
const componentMenu:any[] = [
22
{
33
'text': '基础 Basic',
44
'children': [
@@ -218,7 +218,7 @@ const componentMenu = [
218218
}
219219
];
220220

221-
const navMenu = [
221+
const navMenu:any[] = [
222222
{
223223
'text': '首页',
224224
'name': 'homepage'
@@ -229,9 +229,9 @@ const navMenu = [
229229
}
230230
];
231231

232-
const componentData = [];
232+
const componentData:any[] = [];
233233

234-
componentMenu.map((item) => {
234+
componentMenu.map((item: any):void => {
235235
componentData.push(...item.children);
236236
});
237237

src/filters/index.js renamed to src/filters/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import moment from 'moment';
22

33
export default {
4-
install(Vue) {
4+
install(Vue: any):void {
55
Vue.filter('trim', value => value.replace(/(^\s*)|(\s*$)/g, ''));
66

77
Vue.filter('datetime', value => moment(+new Date(value)).format('YYYY-MM-DD HH:mm'));

src/plugins/index.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/plugins/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export default {
2+
install(Vue) {
3+
Vue.prototype.isDev = (): boolean => process.env.NODE_ENV !== 'production';
4+
5+
Vue.prototype.setTitle = (title: string): string => document.title = title;
6+
},
7+
};

src/views/component/color.vue

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,19 @@ export default class extends Vue {
151151
baseColor: any = baseColor;
152152
colors: any = {};
153153
154+
beforeCreate () {
155+
this.$nextTick().then(() => {
156+
console.log(2122)
157+
})
158+
}
154159
created() {
155160
for (let color in baseColor) {
156161
this.$set(this.colors, color, this.colorMix(baseColor[color].hex));
157162
}
163+
164+
this.$nextTick().then(() => {
165+
console.log(222)
166+
})
158167
}
159168
160169
updateValue(color) {

src/vue-shims.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ declare module 'vue/types/vue' {
1515
}
1616

1717
declare global {
18-
const cd: any
18+
const cd: any,
19+
const process: any
1920
}
2021

0 commit comments

Comments
 (0)