美文网首页
Vue 转 TS

Vue 转 TS

作者: 高磊_IT | 来源:发表于2020-11-24 18:02 被阅读0次

    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>

    相关文章

      网友评论

          本文标题:Vue 转 TS

          本文链接:https://www.haomeiwen.com/subject/locwiktx.html