Skip to content
This repository has been archived by the owner on Sep 19, 2023. It is now read-only.

Add config class #94

Merged
merged 3 commits into from Jan 27, 2020
Merged

Add config class #94

merged 3 commits into from Jan 27, 2020

Conversation

phillbaker
Copy link
Contributor

@phillbaker phillbaker commented Sep 10, 2019

Redo of #90. ea55634 fixes the build bug in #90 (comment) - sorry about that!

Also closes #83

@phillbaker
Copy link
Contributor Author

@akxcv any thoughts here? Happy to investigate the failing tests if this makes sense.

@phillbaker
Copy link
Contributor Author

cc @fanyer since it seems like you're helping out on this repo now (based on #97 )

@timsayshey
Copy link

@phillbaker Is this pull-request dead?

@phillbaker
Copy link
Contributor Author

phillbaker commented Jan 18, 2020 via email

@akxcv
Copy link
Owner

akxcv commented Jan 19, 2020

Hey, I thought I commented on this, but apparently not. I thought that making config a JS class would be more readable/maintainable, but an object will do for now. Could you please describe in a few words how to actually use this feature in code? Could you provide a minimal sample?

@phillbaker
Copy link
Contributor Author

Thanks @akxcv for taking another look.

Could you please describe in a few words how to actually use this feature in code?

The key problem this is solving is that instance options set at the top level Vue instances are not passed down to Vue instances within react components. So, for example an i18n instance option configured at the top level is not available in the children Vue components wrapped in React components.

Could you provide a minimal sample?

Sure - very similar to the example, in #83 (comment):

import Vue from "vue";
import { config } from "vuera";
import VueI18n from "vue-i18n";
import React from "react";
import { render } from "react-dom";
import { VsTable } from "example-vue-component-library";

Vue.use(VueI18n);
const i18n = new VueI18n({
  locale: "en",
  messages: {
    en: {
      no_data: "No data"
    }
  }
});

config.vueInstanceOptions = { i18n };

render(
  <div>
    <VsTable data={[]} />
  </div>,
  document.querySelector("#app")
);

@akxcv
Copy link
Owner

akxcv commented Jan 21, 2020

Yeah, this will work for now. Could you please describe this functionality in the README? Then we can merge this.

@phillbaker
Copy link
Contributor Author

Done!

@akxcv akxcv merged commit 5946fb2 into akxcv:master Jan 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants