Skip to content

Commit 7cd9f30

Browse files
authored
Merge pull request #1 from lucafabbian/main
2 parents 2feafa6 + 8fbf6da commit 7cd9f30

File tree

2 files changed

+25
-8
lines changed

2 files changed

+25
-8
lines changed

README.md

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99

1010
## Status
1111

12-
- `petite-vue` is a great and kinda stable library, but it's development inactive for now, so I decided make this fork to continue development. feel free to open issue or PR.
12+
- `petite-vue` it's not mantained anymore, hence we will provide bug fixes and handle feature requests. Feel free to open issue or PR.
13+
- this fork is focused on web components, but we will provide new generic features too
1314

14-
- my focus is support plugins, and better support fo web components
1515

1616
## Usage
1717

@@ -315,6 +315,22 @@ You can use the `reactive` method (re-exported from `@vue/reactivity`) to create
315315
</div>
316316
```
317317

318+
Use `watchEffect` to re-run a function every time its dependencies changes.
319+
320+
```js
321+
322+
import { watchEffect, reactive } from 'https://unpkg.com/pico-vue?module'
323+
324+
const store = reactive({
325+
count: 0,
326+
})
327+
328+
watchEffect( () => console.log(store.count))
329+
330+
store.count++
331+
332+
```
333+
318334
### Custom Directives
319335

320336
Custom directives are also supported but with a different interface:
@@ -372,7 +388,7 @@ createApp({
372388

373389
### Use Plugins
374390

375-
You can write custome directive then distrbute it as a pacage, then add it to create vue, like:
391+
You can write custome directive then distrbute it as a package, then add it to create vue, like:
376392

377393
```html
378394
<div v-scope="{counter: 0}" v-log="inside pico-vue scope">
@@ -381,7 +397,7 @@ You can write custome directive then distrbute it as a pacage, then add it to cr
381397

382398
<script type="module">
383399
import log from './log'
384-
import { createApp } from 'peteite-vue'
400+
import { createApp } from 'pico-vue'
385401
createApp().use(log).mount()
386402
</script>
387403
```
@@ -405,19 +421,20 @@ Check out the [examples directory](https://github.com/ws-rush/pico-vue/tree/main
405421

406422
## Features
407423

408-
### `pico-vue` only
424+
### `pico-vue`/`petite-vue` only
409425

410426
- `v-scope`
411427
- `v-effect`
412428
- `@vue:mounted` & `@vue:unmounted` events
413-
- `$root` refer to component root element
429+
- `$root` refers to the component root element
414430

415-
### Has Different Behavior
431+
### Different Behavior from `petite-vue`
416432

417433
- In expressions, `$el` points to the current element the directive is bound to (instead of component root element which accessed by `$root`)
418434
- `createApp()` accepts global state instead of a component
419435
- Components are simplified into object-returning functions
420436
- Custom directives have a different interface
437+
- exported `watchEffect`
421438

422439
### Vue Compatible
423440

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export { createApp } from './app'
22
export { nextTick } from './scheduler'
3-
export { reactive } from '@vue/reactivity'
3+
export { reactive, effect as watchEffect } from '@vue/reactivity'
44

55
import { createApp } from './app'
66

0 commit comments

Comments
 (0)