Skip to content

vue-property-decorator + ts 使用 mixins #70

@hawtim

Description

@hawtim

背景

一个需求,要在一个大模块下的几个子页面里添加相同的筛选项,有一些通用的方法,如果在每个子页面下写会造成冗余代码。在 vue + ts + vpd 的技术选型下,记录下使用方法。

component.vue

<script lang="ts">
import { Component, Mixins } from 'vue-property-decorator';
import filterMixin from '../mixin';

@Component
export default class ExternalPointList extends Mixins(filterMixin) {}

mixin.ts

import { Component, Vue } from 'vue-property-decorator';

@Component
export default class FilterMixin extends Vue {}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions