File tree Expand file tree Collapse file tree 4 files changed +43
-5
lines changed
Expand file tree Collapse file tree 4 files changed +43
-5
lines changed Original file line number Diff line number Diff line change 22<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
33# Changelog
44
5+ - [ v2.1.1] ( #v211 )
56- [ v2.1.0] ( #v210 )
67- [ v2.0.0] ( #v200 )
78- [ v1.4.0] ( #v140 )
1112
1213<!-- END doctoc generated TOC please keep comment here to allow auto update -->
1314
15+ ### v2.1.1
16+ * Automatic installation when used in a script tag.
17+
1418### v2.1.0
1519 * Allow object syntax for defining computed properties.
16- * Enable custom default values
20+ * Enable custom default values.
1721
1822### v2.0.0
19- * Now compatible with Vue 2.0
23+ * Now compatible with Vue 2.0.
2024
2125### v1.4.0
22- * Add CommonJS support
26+ * Add CommonJS support.
2327
2428### v1.2.0
2529 * Use the same strategy to merge ` asyncComputed ` objects as regular ` computed ` objects.
Original file line number Diff line number Diff line change 11This software is released under the MIT license:
22
3- Copyright (c) 2016 Benjamin Fox foxbenjaminfox@gmail.com
3+ Copyright (c) 2016 Benjamin Fox < foxbenjaminfox@gmail.com>
44
55Permission is hereby granted, free of charge, to any person obtaining a copy of
66this software and associated documentation files (the "Software"), to deal in
Original file line number Diff line number Diff line change @@ -94,6 +94,28 @@ new Vue({
9494npm install --save vue-async-computed
9595````
9696
97+ Alternately, you can link it directly from a CDN:
98+
99+ ````html
100+ <script src="https://unpkg.com/vue-async-computed"></script>
101+ <!--
102+ That will always point to the latest version of vue-async-computed.
103+ You probably want to instead pin it to a specific version:
104+ -->
105+ <script src="https://unpkg.com/vue-async-computed@2.1.1"></script>
106+ ````
107+
108+ When used with a module system such as `webpack` or `browserify`, you need to explicitly install `vue-async-computed` via `Vue.use()`:
109+
110+ ````js
111+ import Vue from ' vue'
112+ import AsyncComputed from ' vue- async - computed'
113+
114+ Vue.use(AsyncComputed)
115+ ````
116+
117+ You don' t need to do this when using global script tags . So long as you include ` vue-async-computed` in a script tag after Vue itself, it will be installed automatically.
118+
97119## Usage example
98120
99121` ` ` ` js
Original file line number Diff line number Diff line change 11const prefix = '_async_computed$'
22
3- export default {
3+ let installed = false
4+
5+ const AsyncComputed = {
46 install ( Vue , options ) {
57 options = options || { }
68
9+ if ( installed ) return
10+ installed = true
11+
712 Vue . config
813 . optionMergeStrategies
914 . asyncComputed = Vue . config . optionMergeStrategies . computed
@@ -59,3 +64,10 @@ export default {
5964 } )
6065 }
6166}
67+
68+ export default AsyncComputed
69+
70+ // Auto install in dist mode
71+ if ( typeof window !== 'undefined' && window . Vue ) {
72+ window . Vue . use ( AsyncComputed )
73+ }
You can’t perform that action at this time.
0 commit comments