2.3.0 • Published 3 years ago

@tabianco/vue-inherit-component v2.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

@tabianco/vue-inherit-component

GitHub Actions npm (scoped with tag) npm

Overrides default behavior of pre-defined Vue2 components.

Note: this library works only with Vue2

Usage

  1. Add this package to your dependencies
$ npm i -S @tabianco/vue-inherit-component
# or
$ yarn add @tabianco/vue-inherit-component
  1. Use in your component .vue file
import { inheritComponent } from '@tabianco/vue-inherit-component'

Full example

A full example creating a component inheriting SomeComponent from an awesome-vue-component-library.

import { inheritComponent } from '@tabianco/vue-inherit-component'

import SomeComponent from 'awesome-vue-component-library'

export default inheritComponent(SomeComponent, {
  computedClass (props) {
    return {
      readonly: props.readonly
    }
  },

  computedProps (props) {
    if (props.readonly) {
      return {
        ...props,
        color: 'gray'
      }
    } else {
      return props
    }
  },

  props: {
    color: {
      type: String
    },

    readonly: {
      type: Boolean
    }
  }
})

License

MIT - Tabian Co.

2.3.0

3 years ago

2.2.5

3 years ago

2.2.3

3 years ago

2.2.4

3 years ago

2.2.2

3 years ago

2.2.1

3 years ago

2.2.0

3 years ago

2.1.0

3 years ago

2.0.3

3 years ago

2.0.2

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago