|
123 | 123 | </div>
|
124 | 124 |
|
125 | 125 | <div :class="boxClasses" :style="boxStyle">
|
126 |
| - <div :class="labelClasses">The `id` and `name` passed as props are added onto the generated element</div> |
| 126 | + <div :class="labelClasses">The <code>id</code> and <code>name</code> passed as props are added onto the generated element</div> |
127 | 127 |
|
128 | 128 | <div class="inputAndRawValue">
|
129 | 129 | <vue-autonumeric
|
|
137 | 137 | </div>
|
138 | 138 |
|
139 | 139 | <div :class="boxClasses" :style="boxStyle">
|
140 |
| - <div :class="labelClasses">Non-input element with the `contenteditable` attribute</div> |
| 140 | + <div :class="labelClasses">Non-input element with the <code>contenteditable</code> attribute</div> |
141 | 141 |
|
142 | 142 | <div class="inputAndRawValue">
|
143 | 143 | <vue-autonumeric
|
|
150 | 150 | </div>
|
151 | 151 |
|
152 | 152 | <div :class="boxClasses" :style="boxStyle">
|
153 |
| - <div :class="labelClasses">The `placeholder` attribute is passed as a prop too</div> |
| 153 | + <div :class="labelClasses">The <code>placeholder</code> attribute is passed as a prop too</div> |
154 | 154 |
|
155 | 155 | <div class="inputAndRawValue">
|
156 | 156 | <vue-autonumeric
|
|
163 | 163 | </div>
|
164 | 164 |
|
165 | 165 | <div :class="boxClasses" :style="boxStyle">
|
166 |
| - <div :class="labelClasses">The `options` attribute can be modified <i>on the fly</i>. Click <span class="repoLink" @click="optionsToggle = !optionsToggle">here</span> to toggle it.</div> |
| 166 | + <div :class="labelClasses">The <code>options</code> attribute can be modified <i>on the fly</i>. Click <span class="repoLink" @click="optionsToggle = !optionsToggle">here</span> to toggle it.</div> |
167 | 167 |
|
168 | 168 | <div class="inputAndRawValue">
|
169 | 169 | <vue-autonumeric
|
|
176 | 176 | </div>
|
177 | 177 |
|
178 | 178 | <div :class="boxClasses" :style="boxStyle">
|
179 |
| - <div :class="labelClasses">The `decimalPlaces` option is <strong>NOT</strong> saved between options updates. Click <span class="repoLink" @click="options2Toggle = !options2Toggle">here</span> to toggle between the states.<br>In order to keep the correct precision, you need to specify the `decimalPlacesRawValue` option for both states.</div> |
| 179 | + <div :class="labelClasses">The <code>decimalPlaces</code> option is <strong>NOT</strong> saved between options updates. Click <span class="repoLink" @click="options2Toggle = !options2Toggle">here</span> to toggle between the states.<br>In order to keep the correct precision, you need to specify the <code>decimalPlacesRawValue</code> option for both states.</div> |
180 | 180 |
|
181 | 181 | <div class="inputAndRawValue">
|
182 | 182 | <vue-autonumeric
|
|
189 | 189 | </div>
|
190 | 190 |
|
191 | 191 | <div :class="boxClasses" :style="boxStyle">
|
192 |
| - <div :class="labelClasses">Modify the option to 'percentageEU3dec' then set a small value by clicking <span class="repoLink" @click="setOptionsAndValue">here</span>. This <strong>works</strong> even though we do not use a single object to update both options and value at the same time, because the v-model is <strong>not</strong> shared with components having different options.</div> |
| 192 | + <div :class="labelClasses">Modify the option to <code>'percentageEU3dec'</code> then set a small value by clicking <span class="repoLink" @click="setOptionsAndValue">here</span>. This <strong>works</strong> even though we do not use a single object to update both options and value at the same time, because the v-model is <strong>not</strong> shared with components having different options.</div> |
193 | 193 |
|
194 | 194 | <div class="inputAndRawValue">
|
195 | 195 | <vue-autonumeric
|
|
202 | 202 | </div>
|
203 | 203 |
|
204 | 204 | <div :class="boxClasses" :style="boxStyle">
|
205 |
| - <div :class="labelClasses">Modify the option to 'percentageEU3dec' then set a small value by clicking <span class="repoLink" @click="setOptionsAndValueFail">here</span>. This <strong>fails</strong> since we do not use a single object to update both options and value at the same time, while the v-model is shared with components having different options.</div> |
| 205 | + <div :class="labelClasses">Modify the option to <code>'percentageEU3dec'</code> then set a small value by clicking <span class="repoLink" @click="setOptionsAndValueFail">here</span>. This <strong>fails</strong> since we do not use a single object to update both options and value at the same time, while the v-model is shared with components having different options.</div> |
206 | 206 | <div class="inputAndRawValue">
|
207 | 207 | <vue-autonumeric
|
208 | 208 | :options="options3"
|
|
254 | 254 | />
|
255 | 255 | <div class="rawValue">{{ emptyValue }}</div>
|
256 | 256 | <button class="controls" @click="clearValue">Clear the value with `clear()`</button>
|
257 |
| - <button class="controls" @click="setToEmptyString">Set to the empty string</button> |
| 257 | + <button class="controls" @click="setToEmptyString">Set to the empty string directly</button> |
| 258 | + <button class="controls" @click="setToEmptyStringVModel">Set to the empty string with Vue</button> |
| 259 | + </div> |
| 260 | + </div> |
| 261 | + |
| 262 | + <div :class="boxClasses" :style="boxStyle"> |
| 263 | + <div :class="labelClasses">Vue-autonumeric that tracks external changes.<br>Try using <code>ext.value = 42</code> in the console.</div> |
| 264 | + <div class="inputAndRawValue"> |
| 265 | + <vue-autonumeric id="ext" :options="{ watchExternalChanges: true }" v-model="externalTracker"/> |
| 266 | + <div class="rawValue">{{ externalTracker }}</div> |
258 | 267 | </div>
|
259 | 268 | </div>
|
260 | 269 | </div>
|
|
280 | 289 | autoNumericModel3: 221226.44,
|
281 | 290 | anModel : 42.01,
|
282 | 291 | emptyValue : '',
|
| 292 | + externalTracker : 1222114.66, |
283 | 293 | optionsToggle : true,
|
284 | 294 | options2Toggle : true,
|
285 | 295 | options3 : 'euro',
|
|
381 | 391 | setToEmptyString() {
|
382 | 392 | AutoNumeric.getAutoNumericElement('#inputToEmpty').set('');
|
383 | 393 | },
|
| 394 | +
|
| 395 | + setToEmptyStringVModel() { |
| 396 | + this.emptyValue = ''; |
| 397 | + }, |
384 | 398 | },
|
385 | 399 | };
|
386 | 400 | </script>
|
|
0 commit comments