Skip to content

Commit

Permalink
mixin 优化
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaotoday committed Nov 24, 2020
1 parent 9d710c3 commit 199a1cd
Show file tree
Hide file tree
Showing 20 changed files with 53 additions and 70 deletions.
8 changes: 3 additions & 5 deletions src/views/ads/list/form/script.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { Component, Vue } from "vue-property-decorator";
import { Component, Mixins } from "vue-property-decorator";
import FormMixin from "view-ui-admin/src/mixins/form";

const module = "ads";

@Component({
mixins: [FormMixin]
})
export default class ListForm extends Vue {
@Component
export default class ListForm extends Mixins(FormMixin) {
data() {
return {
cForm: {
Expand Down
5 changes: 2 additions & 3 deletions src/views/ads/list/script.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Vue } from "vue-property-decorator";
import { Component, Mixins } from "vue-property-decorator";
import { mapState } from "vuex";
import ListForm from "./form";
import RouteParamsMixin from "view-ui-admin/src/mixins/route-params";
Expand All @@ -15,15 +15,14 @@ const initWhere = {
};

@Component({
mixins: [RouteParamsMixin, ListMixin],
components: {
"c-list-form": ListForm
},
computed: mapState({
list: state => state[module].list
})
})
export default class extends Vue {
export default class extends Mixins(RouteParamsMixin, ListMixin) {
data() {
const { ListColumnWidth, OrderAction } = this.$consts;

Expand Down
5 changes: 2 additions & 3 deletions src/views/articles/form/script.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import { Component, Vue } from "vue-property-decorator";
import { Component, Mixins } from "vue-property-decorator";
import RouteParamsMixin from "view-ui-admin/src/mixins/route-params";
import FormMixin from "view-ui-admin/src/mixins/form";
import { mapState } from "vuex";

const module = "articles";

@Component({
mixins: [RouteParamsMixin, FormMixin],
computed: mapState({
detail: state => state[module].detail
})
})
export default class extends Vue {
export default class extends Mixins(RouteParamsMixin, FormMixin) {
data() {
return {
cForm: {
Expand Down
9 changes: 6 additions & 3 deletions src/views/articles/list/script.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Vue } from "vue-property-decorator";
import { Component, Mixins } from "vue-property-decorator";
import { mapState } from "vuex";
import RouteParamsMixin from "view-ui-admin/src/mixins/route-params";
import ListMixin from "view-ui-admin/src/mixins/list";
Expand All @@ -19,12 +19,15 @@ const initWhere = {
};

@Component({
mixins: [RouteParamsMixin, ListMixin, AllCategoriesListMixin],
computed: mapState({
list: state => state[module].list
})
})
export default class extends Vue {
export default class extends Mixins(
RouteParamsMixin,
ListMixin,
AllCategoriesListMixin
) {
data() {
const { ListColumnWidth, OrderAction } = this.$consts;

Expand Down
8 changes: 3 additions & 5 deletions src/views/brands/list/form/script.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { Component, Vue } from "vue-property-decorator";
import { Component, Mixins } from "vue-property-decorator";
import FormMixin from "view-ui-admin/src/mixins/form";

const module = "brands";

@Component({
mixins: [FormMixin]
})
export default class BrandsListForm extends Vue {
@Component
export default class BrandsListForm extends Mixins(FormMixin) {
data() {
return {
cForm: {
Expand Down
5 changes: 2 additions & 3 deletions src/views/brands/list/script.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Vue } from "vue-property-decorator";
import { Component, Mixins } from "vue-property-decorator";
import { mapState } from "vuex";
import BrandsListForm from "./form";
import RouteParamsMixin from "view-ui-admin/src/mixins/route-params";
Expand All @@ -15,15 +15,14 @@ const initWhere = {
};

@Component({
mixins: [RouteParamsMixin, ListMixin],
components: {
"c-brands-list-form": BrandsListForm
},
computed: mapState({
list: state => state[module].list
})
})
export default class extends Vue {
export default class extends Mixins(RouteParamsMixin, ListMixin) {
data() {
const { ListColumnWidth, OrderAction } = this.$consts;

Expand Down
5 changes: 2 additions & 3 deletions src/views/categories/list/script.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Vue } from "vue-property-decorator";
import { Component, Mixins } from "vue-property-decorator";
import { mapState } from "vuex";
import RouteParamsMixin from "view-ui-admin/src/mixins/route-params";
import ListMixin from "view-ui-admin/src/mixins/list";
Expand All @@ -13,7 +13,6 @@ const initWhere = {
};

@Component({
mixins: [RouteParamsMixin, ListMixin, FormMixin],
computed: {
...mapState({
list: state => state[module].list,
Expand All @@ -33,7 +32,7 @@ const initWhere = {
}
}
})
export default class extends Vue {
export default class extends Mixins(RouteParamsMixin, ListMixin, FormMixin) {
data() {
const { ListColumnWidth, OrderAction, CategoryLevel } = this.$consts;

Expand Down
5 changes: 2 additions & 3 deletions src/views/comments/list/script.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Vue } from "vue-property-decorator";
import { Component, Mixins } from "vue-property-decorator";
import { mapState } from "vuex";
import RouteParamsMixin from "view-ui-admin/src/mixins/route-params";
import ListMixin from "view-ui-admin/src/mixins/list";
Expand All @@ -14,12 +14,11 @@ const initWhere = {
};

@Component({
mixins: [RouteParamsMixin, ListMixin],
computed: mapState({
list: state => state[module].list
})
})
export default class extends Vue {
export default class extends Mixins(RouteParamsMixin, ListMixin) {
data() {
const { ListColumnWidth } = this.$consts;

Expand Down
5 changes: 2 additions & 3 deletions src/views/commissions/list/script.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Vue } from "vue-property-decorator";
import { Component, Mixins } from "vue-property-decorator";
import { mapState } from "vuex";
import RouteParamsMixin from "view-ui-admin/src/mixins/route-params";
import ListMixin from "view-ui-admin/src/mixins/list";
Expand All @@ -14,12 +14,11 @@ const initWhere = {
};

@Component({
mixins: [RouteParamsMixin, ListMixin],
computed: mapState({
list: state => state[module].list
})
})
export default class extends Vue {
export default class extends Mixins(RouteParamsMixin, ListMixin) {
data() {
const { ListColumnWidth } = this.$consts;

Expand Down
8 changes: 3 additions & 5 deletions src/views/coupons/list/form/script.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { Component, Vue } from "vue-property-decorator";
import { Component, Mixins } from "vue-property-decorator";
import FormMixin from "view-ui-admin/src/mixins/form";

const module = "coupons";

@Component({
mixins: [FormMixin]
})
export default class CouponsListForm extends Vue {
@Component
export default class CouponsListForm extends Mixins(FormMixin) {
data() {
return {
cForm: {
Expand Down
5 changes: 2 additions & 3 deletions src/views/coupons/list/script.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Vue } from "vue-property-decorator";
import { Component, Mixins } from "vue-property-decorator";
import { mapState } from "vuex";
import CouponsListForm from "./form";
import RouteParamsMixin from "view-ui-admin/src/mixins/route-params";
Expand All @@ -15,15 +15,14 @@ const initWhere = {
};

@Component({
mixins: [RouteParamsMixin, ListMixin],
components: {
"c-coupons-list-form": CouponsListForm
},
computed: mapState({
list: state => state[module].list
})
})
export default class extends Vue {
export default class extends Mixins(RouteParamsMixin, ListMixin) {
data() {
return {
cList: {
Expand Down
8 changes: 3 additions & 5 deletions src/views/merchants/list/form/script.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { Component, Vue } from "vue-property-decorator";
import { Component, Mixins } from "vue-property-decorator";
import FormMixin from "view-ui-admin/src/mixins/form";

const module = "merchants";

@Component({
mixins: [FormMixin]
})
export default class MerchantsListForm extends Vue {
@Component
export default class MerchantsListForm extends Mixins(FormMixin) {
data() {
return {
cForm: {
Expand Down
5 changes: 2 additions & 3 deletions src/views/merchants/list/script.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Vue } from "vue-property-decorator";
import { Component, Mixins } from "vue-property-decorator";
import { mapState } from "vuex";
import MerchantsListForm from "./form";
import RouteParamsMixin from "view-ui-admin/src/mixins/route-params";
Expand All @@ -12,15 +12,14 @@ const initWhere = {
};

@Component({
mixins: [RouteParamsMixin, ListMixin],
components: {
"c-merchants-list-form": MerchantsListForm
},
computed: mapState({
list: state => state[module].list
})
})
export default class extends Vue {
export default class extends Mixins(RouteParamsMixin, ListMixin) {
data() {
const { ListColumnWidth } = this.$consts;

Expand Down
5 changes: 2 additions & 3 deletions src/views/orders/list/script.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Vue } from "vue-property-decorator";
import { Component, Mixins } from "vue-property-decorator";
import { mapState } from "vuex";
import RouteParamsMixin from "view-ui-admin/src/mixins/route-params";
import ListMixin from "view-ui-admin/src/mixins/list";
Expand All @@ -22,12 +22,11 @@ const initWhere = {
};

@Component({
mixins: [RouteParamsMixin, ListMixin],
computed: mapState({
list: state => state[module].list
})
})
export default class extends Vue {
export default class extends Mixins(RouteParamsMixin, ListMixin) {
data() {
return {
cList: {
Expand Down
8 changes: 3 additions & 5 deletions src/views/points/list/form/script.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { Component, Vue } from "vue-property-decorator";
import { Component, Mixins } from "vue-property-decorator";
import FormMixin from "view-ui-admin/src/mixins/form";

const module = "points";

@Component({
mixins: [FormMixin]
})
export default class ListForm extends Vue {
@Component
export default class ListForm extends Mixins(FormMixin) {
data() {
return {
cForm: {
Expand Down
5 changes: 2 additions & 3 deletions src/views/points/list/script.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Vue } from "vue-property-decorator";
import { Component, Mixins } from "vue-property-decorator";
import { mapState } from "vuex";
import RouteParamsMixin from "view-ui-admin/src/mixins/route-params";
import ListMixin from "view-ui-admin/src/mixins/list";
Expand All @@ -18,12 +18,11 @@ const initWhere = {
components: {
"c-list-form": ListForm
},
mixins: [RouteParamsMixin, ListMixin],
computed: mapState({
list: state => state[module].list
})
})
export default class extends Vue {
export default class extends Mixins(RouteParamsMixin, ListMixin) {
data() {
const { ListColumnWidth } = this.$consts;

Expand Down
5 changes: 2 additions & 3 deletions src/views/products/form/script.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import { Component, Vue } from "vue-property-decorator";
import { Component, Mixins } from "vue-property-decorator";
import RouteParamsMixin from "view-ui-admin/src/mixins/route-params";
import FormMixin from "view-ui-admin/src/mixins/form";
import { mapState } from "vuex";

const module = "products";

@Component({
mixins: [RouteParamsMixin, FormMixin],
computed: mapState({
detail: state => state[module].detail
})
})
export default class extends Vue {
export default class extends Mixins(RouteParamsMixin, FormMixin) {
data() {
return {
cForm: {
Expand Down
9 changes: 6 additions & 3 deletions src/views/products/list/script.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Vue } from "vue-property-decorator";
import { Component, Mixins } from "vue-property-decorator";
import { mapState } from "vuex";
import RouteParamsMixin from "view-ui-admin/src/mixins/route-params";
import ListMixin from "view-ui-admin/src/mixins/list";
Expand All @@ -19,12 +19,15 @@ const initWhere = {
};

@Component({
mixins: [RouteParamsMixin, ListMixin, AllCategoriesListMixin],
computed: mapState({
list: state => state[module].list
})
})
export default class extends Vue {
export default class extends Mixins(
RouteParamsMixin,
ListMixin,
AllCategoriesListMixin
) {
data() {
const { ListColumnWidth, OrderAction } = this.$consts;

Expand Down
5 changes: 2 additions & 3 deletions src/views/withdraws/list/script.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Vue } from "vue-property-decorator";
import { Component, Mixins } from "vue-property-decorator";
import { mapState } from "vuex";
import RouteParamsMixin from "view-ui-admin/src/mixins/route-params";
import ListMixin from "view-ui-admin/src/mixins/list";
Expand All @@ -17,12 +17,11 @@ const initWhere = {
};

@Component({
mixins: [RouteParamsMixin, ListMixin],
computed: mapState({
list: state => state[module].list
})
})
export default class extends Vue {
export default class extends Mixins(RouteParamsMixin, ListMixin) {
data() {
const { ListColumnWidth } = this.$consts;

Expand Down
Loading

0 comments on commit 199a1cd

Please sign in to comment.