[improvement] unify mixin name (#2795)
This commit is contained in:
@@ -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,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)) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* find parent component by name
|
||||
*/
|
||||
|
||||
export default {
|
||||
export const FindParentMixin = {
|
||||
data() {
|
||||
return {
|
||||
parent: null
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Common Picker Props
|
||||
*/
|
||||
|
||||
export default {
|
||||
export const PickerMixin = {
|
||||
props: {
|
||||
title: String,
|
||||
loading: Boolean,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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]
|
||||
};
|
||||
@@ -3,7 +3,7 @@
|
||||
* downgrade to slots in lower version
|
||||
*/
|
||||
|
||||
export default {
|
||||
export const SlotsMixin = {
|
||||
methods: {
|
||||
slots(name = 'default', props) {
|
||||
const { $slots, $scopedSlots } = this;
|
||||
|
||||
@@ -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'
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -9,7 +9,7 @@ function getDirection(x, y) {
|
||||
return '';
|
||||
}
|
||||
|
||||
export default {
|
||||
export const TouchMixin = {
|
||||
data() {
|
||||
return {
|
||||
direction: ''
|
||||
|
||||
Reference in New Issue
Block a user