[improvement] unify mixin name (#2795)

This commit is contained in:
neverland
2019-02-19 16:04:29 +08:00
committed by GitHub
parent 8c6ab91f6d
commit 9d0255d9e1
49 changed files with 112 additions and 122 deletions
+3 -3
View File
@@ -2,10 +2,10 @@
* Common part of Checkbox & Radio
*/
import Icon from '../icon';
import findParent from './find-parent';
import { FindParentMixin } from './find-parent';
export default (parent, bem) => ({
mixins: [findParent],
export const CheckboxMixin = (parent, bem) => ({
mixins: [FindParentMixin],
props: {
name: null,
+1 -1
View File
@@ -1,6 +1,6 @@
import { on, off } from '../utils/event';
export default config => ({
export const ClickOutsideMixin = config => ({
mounted() {
config.handler = event => {
if (!this.$el.contains(event.target)) {
+1 -1
View File
@@ -2,7 +2,7 @@
* find parent component by name
*/
export default {
export const FindParentMixin = {
data() {
return {
parent: null
+1 -1
View File
@@ -2,7 +2,7 @@
* Common Picker Props
*/
export default {
export const PickerMixin = {
props: {
title: String,
loading: Boolean,
+3 -3
View File
@@ -1,11 +1,11 @@
import manager from './manager';
import context from './context';
import Touch from '../touch';
import { TouchMixin } from '../touch';
import { on, off } from '../../utils/event';
import { getScrollEventTarget } from '../../utils/scroll';
export default {
mixins: [Touch],
export const PopupMixin = {
mixins: [TouchMixin],
props: {
// whether to show popup
-37
View File
@@ -1,37 +0,0 @@
/**
* Vue Router support
*/
import { RenderContext } from 'vue/types';
import VueRouter, { RawLocation } from 'vue-router/types';
export type RouteConfig = {
url?: string;
to?: RawLocation;
replace?: boolean;
};
export function route(router: VueRouter, config: RouteConfig) {
const { to, url, replace } = config;
if (to && router) {
router[replace ? 'replace' : 'push'](to);
} else if (url) {
replace ? location.replace(url) : (location.href = url);
}
}
export function functionalRoute(context: RenderContext) {
route(context.parent && context.parent.$router, context.props);
}
export type RouteProps = {
url?: string,
replace?: boolean;
to?: RawLocation;
}
export const routeProps = {
url: String,
replace: Boolean,
to: [String, Object]
};
+1 -1
View File
@@ -3,7 +3,7 @@
* downgrade to slots in lower version
*/
export default {
export const SlotsMixin = {
methods: {
slots(name = 'default', props) {
const { $slots, $scopedSlots } = this;
-25
View File
@@ -1,25 +0,0 @@
/**
* Common Switch Props
*/
export default {
props: {
value: null,
loading: Boolean,
disabled: Boolean,
activeColor: String,
inactiveColor: String,
activeValue: {
type: null,
default: true
},
inactiveValue: {
type: null,
default: false
},
size: {
type: String,
default: '30px'
}
}
};
+1 -1
View File
@@ -9,7 +9,7 @@ function getDirection(x, y) {
return '';
}
export default {
export const TouchMixin = {
data() {
return {
direction: ''