How to use the vue-property-decorator.Model function in vue-property-decorator

To help you get started, we’ve selected a few vue-property-decorator examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github fe6 / water / src / components / cascader / src / Cascader.vue View on Github external
// 如果没指定 v-model ,就存到这里,以便使用数组引用进行更新
    // 解决不传 v-model , 点击选中三级 , 再显示,不选再关上,删除之后的问题
    defValue: string[] = [];

    chooseResult: any[] = []; // 点击下拉选项,最后一级之后所得到的值

    chooseAllItem: any[] = []; // 点击下拉选项每一级选择的数据

    chooseItemResult: any[] = []; // 点击下拉选项每一级选择的数据

    currentOption: any = {};

    resizeEvent: any = null;

    @Model('model', { type: Array }) readonly value!: string[];

    @Prop({
      type: Array,
      default: noop,
    })
    private options!: any[];

    @Prop({
      type: String,
      default: '未匹配到结果',
    })
    private emptyText!: string;

    @Prop({
      type: String,
      default: '',
github fe6 / water / src / components / checkbox / Checkbox.vue View on Github external
interface ColorStyleEntity {
  [style: string]: string;
}

@Component
export default class Checkbox extends Vue {
  name: string = 'Checkbox';

  preName: string = 'w-checkbox-';

  status: string | number | boolean = false;

  hoverStatus: boolean = false;

  @Model('model', { type: [Boolean, Number, String], default: undefined }) readonly value!: boolean | number | string;

  @Prop({
    type: [Boolean, Number, String],
    default: undefined,
  }) private label!: string | number | boolean;

  @Prop(Boolean) private disabled!: boolean;

  @Prop(Boolean) private indeterminate!: boolean;

  @Prop(String) private textColor!: string;

  @Prop(String) private hoverColor!: string;

  @Prop(String) private checkColor!: string;
github ulaval / modul-components / src / components / integerfield / integerfield.ts View on Github external
const ALLOWED_KEYCODE: number[] = [8, 9, 33, 34, 35, 36, 37, 39, 46];

@WithRender
@Component({
    mixins: [
        InputState,
        InputWidth,
        InputLabel,
        InputManagement
    ]
})
export class MIntegerfield extends ModulVue {

    @Prop()
    @Model('input')
    public value: number;

    @Prop()
    public placeholder: string;

    @Prop()
    public readonly: boolean;

    @Prop({ default: 0 })
    public maxLength: number;

    public internalValue: number;

    private id: string = `mIntegerfield-${uuid.generate()}`;

    private onPasteIntegerfield(event: Event): void {
github ulaval / modul-components / src / components / radio-group / radio-group.ts View on Github external
import Component from 'vue-class-component';
import { Emit, Model, Prop, Watch } from 'vue-property-decorator';
import { InputState } from '../../mixins/input-state/input-state';
import uuid from '../../utils/uuid/uuid';
import { RADIO_GROUP_NAME } from '../component-names';
import InputGroupPlugin from '../input-group/input-group';
import RadioPlugin, { BaseRadioGroup, MRadioPosition, MRadioVerticalAlignement, RadioGroup } from '../radio/radio';
import WithRender from './radio-group.html?style=./radio-group.scss';

@WithRender
@Component({
    mixins: [InputState]
})
export class MRadioGroup extends BaseRadioGroup implements RadioGroup {

    @Model('change')
    @Prop()
    public value: any;
    @Prop({
        default: MRadioPosition.Left,
        validator: value =>
            value === MRadioPosition.Left ||
            value === MRadioPosition.Right
    })
    public radiosPosition: MRadioPosition;
    @Prop()
    public inline: boolean;
    @Prop()
    public label: string;
    @Prop()
    public requiredMarker: boolean;
    @Prop({
github fe6 / water / src / components / switch / src / Switch.vue View on Github external
Emit,
    Watch,
    Vue,
  } from 'vue-property-decorator';

  export interface ReturnParamsEntity {
    ev: MouseEvent;
    [propName: string]: any;
  }
  @Component
  export default class WSwitch extends Vue {
    name: string = 'WSwitch';

    status: boolean = false;

    @Model('model', { type: Boolean }) readonly value!: boolean;

    @Prop(Boolean) private disabled!: boolean;

    @Prop(Boolean) private loading!: boolean;

    @Prop(Boolean) private stop!: boolean;

    @Prop(String) private size!: string;

    @Prop(Function) private before!: Function;

    @Prop({
      type: Function,
      default: () => {},
    })
    private change!: Function;
github fe6 / water / src / components / select / src / Select.vue View on Github external
newTags: any[] = [];

    fieldValue: string = '';

    fieldWidth: string = '0';

    fieldCanDelate: number = 0;

    optHoverIndex: number = -1;

    hideTimer: any = null;

    resizeEvent: any = null;

    @Model('model', { type: [String, Number, Array] }) readonly value!: [
      string,
      number,
      string[]
    ];

    @Prop({
      type: Array,
      default: () => [],
    })
    private options!: OptionsEntity[];

    @Prop({
      type: Object,
      default: (): FieldNamesEntity => fieldNamesDefault,
    })
    private fieldNames!: FieldNamesEntity;
github ulaval / modul-components / src / components / switch / switch.ts View on Github external
import { SWITCH_NAME } from '../component-names';
import ValidationMessagePlugin from '../validation-message/validation-message';
import WithRender from './switch.html?style=./switch.scss';

export enum MSwitchPosition {
    Left = 'left',
    Right = 'right'
}

@WithRender
@Component({
    mixins: [InputState]
})
export class MSwitch extends ModulVue {

    @Model('change')
    @Prop()
    public value: boolean;
    @Prop({
        default: MSwitchPosition.Left,
        validator: value =>
            value === MSwitchPosition.Left ||
            value === MSwitchPosition.Right
    })
    public position: string;
    @Prop({ default: true })
    public stateText: boolean;

    private internalValue: boolean = false;
    private isFocus = false;
    private id: string = `switch${uuid.generate()}`;
github fe6 / water / src / components / tag / src / NewTag.vue View on Github external
@Component({
    components: {
      WInput,
      WIcon,
    },
  })
  export default class NewTag extends Vue {
    clicked = false;

    inputWidth = 0;

    inputStatus = false;

    inputValue = '';

    @Model('model', { type: String }) readonly value!: string;

    @Prop(Boolean) private disabled!: boolean;

    @Prop(Boolean) private loading!: boolean;

    @Prop(Boolean) private stop!: boolean;

    @Prop(String) private size!: string;

    @Prop(String) private placeholder!: string;

    @Prop({
      type: Function,
      default: (): boolean => false,
    })
    private error!: Function;
github fe6 / water / src / components / radio / src / Radio.vue View on Github external
label: string | number | boolean;
  }

  export interface ReturnParamsEntity extends ChangeParamsEntity {
    status: boolean;
  }

  @Component
  export default class Radio extends Vue {
    name = 'WRadio';

    preName = 'w-radio-';

    hoverStatus = false;

    @Model('model', {
      type: [String, Number, Boolean],
      default: '',
    })
    readonly value!: string | number | boolean;

    @Prop([String, Number, Boolean]) private label!: string | number | boolean;

    @Prop(Boolean) private disabled!: boolean;

    @Prop(Boolean) private loading!: boolean;

    @Prop(String) private textColor!: string;

    @Prop(String) private hoverColor!: string;

    @Prop(String) private checkColor!: string;