mwc-components
Version:
## Project setup ``` yarn install ```
32 lines (23 loc) • 1.05 kB
JavaScript
// Mainjs for local development
import Vue from 'vue'
import VueCustomElement from 'vue-custom-element'
// import "@webcomponents/webcomponentsjs/webcomponents-bundle"
// import '@webcomponents/webcomponentsjs/custom-elements-es5-adapter.js'
import MwcBasePlugin from '../packages/mwc-vue-shared/plugins/the-mwc-base-helper'
import MwcApplicationHelper from 'mwc-application-helper'
import Components from './components/index.custom'
import './assets/styles/global.scss'
MwcApplicationHelper.initializeMwc()
Vue.use(VueCustomElement)
Vue.use(MwcBasePlugin)
// export const eventBus = new Vue() // event bus
Vue.config.productionTip = false
Object.keys(Components).forEach(name => {
Vue.customElement(camelCaseToDash(name), Components[name])
})
// custom Elements should have (-) dash in the their name as global standard we have to meet that
// this function compose generate (myInput) to (my-input)
// eslint-disable-next-line no-unused-vars
function camelCaseToDash (myStr) {
return myStr.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase()
}