Vue 转 TS
2020-11-24 本文已影响0人
高磊_IT
element
<script>
export default {
data() {
const item = {
date: '2016-05-02',
name: '王小虎',
address: '上海市普陀区金沙江路 1518 弄'
};
return {
tableData: Array(20).fill(item)
}
}
};
</script>
ts写法
<script lang="ts">
import { Vue, Component, Prop } from "vue-property-decorator";
import request from "@/utils/request";
@Component({
name: "Home",
})
export default class Home extends Vue {
private data: any = {
date: "2016-05-02",
name: "王小虎",
address: "上海市普陀区金沙江路 1518 弄",
};
get tableData() {
return Array(20).fill(this.data);
}
async created() {
this.tableData
}
}
</script>