Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add API for overwriting default components #850

Merged
merged 7 commits into from
Apr 25, 2019
Merged

Conversation

sagalbot
Copy link
Owner

@sagalbot sagalbot commented Apr 22, 2019

New

Adds a components function prop that allows user to implement their own components and override the defaults.

example

<template>
  <div>
    <v-select
        :options="['Canada', 'United States']"
        :components="defaults => ({...defaults, Deselect})"
    />
  </div>
</template>

<script>
import Vue from 'vue';

export default {
  name: 'ChildComponentExample',
  computed: {
    Deselect () {
      return Vue.component('Deselect', {
        render (createElement) {
          return createElement('button', 'Clear');
        },
      });
    },
  },
};
</script>

Result
image

Todos

  • create dedicated templating docs
  • add page for child components
  • add page for SCSS variables
  • implement higher level API to set child components when registering vSelect
  • test coverage

@sagalbot sagalbot added minor Indicates a change resulting in a minor release in progress labels Apr 22, 2019
@sagalbot sagalbot self-assigned this Apr 22, 2019
@coveralls
Copy link

coveralls commented Apr 22, 2019

Coverage Status

Coverage increased (+2.09%) to 96.392% when pulling 330ce44 on add-components-prop into d522aca on master.

@sagalbot sagalbot merged commit efc5093 into master Apr 25, 2019
@sagalbot sagalbot deleted the add-components-prop branch April 25, 2019 22:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in progress minor Indicates a change resulting in a minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants