jonathanpmartins / v-money3

Vue3 currency input/directive mask
MIT License
103 stars 27 forks source link

[solved] Enhancement of the README file for global component/directive registering. #2

Closed jonathanpmartins closed 3 years ago

jonathanpmartins commented 3 years ago

Old way of doing things:

A. Globally

import Vue from 'vue'
import money from 'v-money'

// register directive v-money and component <money>
Vue.use(money, {precision: 4})
jonathanpmartins commented 3 years ago

New Way of doing things....

Register Globally

import Vue from 'vue'
import money from 'v-money'

const app = Vue.createApp({
    /* options */
})

// register directive v-money3 and component <money3>
app.use(money)

Only Directive

import Vue from 'vue'
import Money3Directive from 'v-money'

const app = Vue.createApp({
    /* options */
})

// register directive v-money3
app.directive('money3', Money3Directive)

Only Component

import Vue from 'vue'
import Money3Component from 'v-money'

const app = Vue.createApp({
    /* options */
})

// register component <money3>
app.component('money3', Money3Component)
jonathanpmartins commented 3 years ago

@joserick take a look at this new release https://github.com/jonathanpmartins/v-money3/releases/tag/3.7.0 Implemented a clear way for importing component and/or directive

jonathanpmartins commented 3 years ago

This issue was originally open by @mesqueeb (https://github.com/vuejs-tips/v-money/issues/59) in the old v-money repository.

@mesqueeb posted a pull request (https://github.com/vuejs-tips/v-money/pull/61) that fixes this issue. But it was never merged.