Git Product home page Git Product logo

vue-reconstruct's Introduction

github stats

vue-reconstruct's People

Contributors

murongg avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

vue-reconstruct's Issues

Discussion on the problem of Vue3 `reactive` being reassigned!

If i declare an object for reactive, this object will lose reactivity when i change this object direct.
e.g. :

let obj = reactive({}) 
obj =  reactive({a: 1}) 

watch(obj , (newVal, oldVal) => {
  // do nothing...
})

I thought of two plans.

  1. Abandon reactive, use Ref
    e.g. :
let obj = ref({})
obj.value =  {a: 1}

watch(obj , (newVal, oldVal) => {
  // changing
})
  1. Wrap all reactive object in one reactive object
    e.g. :
let state = reactive({
  obj1: {}
  obj2: {}
})
state.obj1 = {a: 1}
// You won't be able to use `watch`
// Because this will monitor to entire object
// Cause unnecessary trouble when you change object
watch(state , (newVal, oldVal) => {
  // changing
})

This plan is only applicable when the wrapped reactive object is used in the template.
I prefer the first plan. But it doesn't look elegant.
What about you? Or do you have a better plan?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.