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

vue3 and composition api support is here ! #1

Open
iChenLei opened this issue Sep 11, 2021 · 4 comments
Open

vue3 and composition api support is here ! #1

iChenLei opened this issue Sep 11, 2021 · 4 comments
Labels
enhancement New feature or request

Comments

@iChenLei
Copy link
Member

mobxjs/mobx-vue#60 [RFC] mobx-vue v3

I decided add vue3 support via mobx-vue-lite after consideration. mobx-vue current only support vue2 and mobx( v6 >= 2.1.* , v2|v3|v4|v5 < 2.1.0). @wobsoriano , Robert Soriano Thanks for youre great work for vue3 support, now you are mobxjs/mobx-vue-lite project's maintainer , continue your great work please. 🚀

@wobsoriano
Copy link
Collaborator

Thank you! Happy to be here.

So I imported the files from https://github.com/wobsoriano/mobx-vue-lite. Should we publish a new package?

@iChenLei
Copy link
Member Author

iChenLei commented Sep 11, 2021

No, mobx-vue-lite is ok. mobx-vue support vue2 and mobx-vue-lite support vue3. We don't need publish another new package. Please @ me if you need any help, thanks. ( Hope i am not misunderstanding your meaning

@wobsoriano
Copy link
Collaborator

Okay. All good, thanks!

@EverSeenTOTOTO
Copy link

Very greate efforts! Thanks for everyone here. Really, I believe the future of state management in frontend is Simple Functional Component + Well Designed Domain Models (and the models, stores, services are driven by libs like mobx.

import { useState } from "react"
import { observer, useLocalObservable } from "mobx-react-lite"

export default observer(() => {
    const state = useLocalObservable(() => ({
      count: 0,
      get double() {
        return this.count * 2
      },
      increment() {
        this.count++
      }
    }))

    //...
})
import { defineComponent } from 'vue'
import { useLocalObservable } from 'mobx-vue-lite'

export default defineComponent({
    setup() {
        const state = useLocalObservable(() => ({
            count: 0,
            get double() {
                return this.count * 2
            },
            increment() {
                this.count++
            }
        }))

        return { state }
    }
})

@wobsoriano wobsoriano added the enhancement New feature or request label Nov 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants