GithubHelp home page GithubHelp logo

vue-reactivity-polyfill's Introduction

vue-reactivity-polyfill CircleCI

@vue/reactivity can not support no Proxy envs, this pkg ployfill it.

If you want to use with Vue3 to be compatible with IE9+, you need to use vue3-plugin-polyfill too.

Here is a demo, vue-next-demo.

Usage

// add polyfill
// vue-reactivity-polyfill-getownpropertynames is used to
// fix IE Obejct.getOwnPropertyNames(fn) error.
// for bundle, must imported before @vue/reactivity or vue
import 'vue-reactivity-polyfill-getownpropertynames'
import 'vue-reactivity-polyfill'
// use
import { ref } from '@vue/reactivity'
// or
import { ref } from 'vue'

New API

  • get(target, path, defaultValue)
  • set(target, key, val)
  • del(target, key)
  • getLength(target: ArrayLike)

Unsupported Cases

  • Symbol key
  • Array length
  • Dynamic prop, object[key] or array[index]
  • delete
  • objectSpread

More, see proxy-polyfill

vue-reactivity-polyfill's People

Contributors

dolymood avatar

Stargazers

 avatar ArBing Xie avatar Leapond avatar Xinz Tian avatar Season Chen avatar Greg Holguin avatar kallsave avatar Shirmy avatar  avatar

Watchers

James Cloos avatar  avatar  avatar

Forkers

colonelbundy

vue-reactivity-polyfill's Issues

既然是 polyfill,为什么还需要指定导入

import { get, set, del } from 'vue-reactivity-polyfill'

按理来说,单是这么导入不就可以了吗,应该在 polyfill 文件里面根据 Proxy 进行判断是否应该应用补丁吧

import 'vue-reactivity-polyfill'

关于不支持的用例的问题

我看到 Readme.md 里的 Unsupported Cases 有写到不支持 objectSpread,请问这是指哪一种写法?

我测试了

const value = reactive({ ...obj });
const { ...rest } = value;
const x = { ...value };

几种写法对于 obj 中本身就有的 key 貌似都是正常的?

想问一下,这个不支持的场景是指什么写法呢?

谢谢

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.