Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
WEBVTT
00:01.000 --> 00:05.500
Let's set up some data and methods to get this up working using the options API.
00:05.590 --> 00:12.860
So we need to add a script section and inside that we need to add our export defaults.
00:14.770 --> 00:17.530
Let's set up our data first for this counter.
00:18.370 --> 00:26.080
So we need to add a data method which returns an object and we could pull all of our data properties
00:26.080 --> 00:26.560
in here.
00:26.650 --> 00:30.220
So a lot of property called counts are set up to zero.
00:30.490 --> 00:33.460
Save that and we should be able to use that in our template now.
00:34.000 --> 00:40.150
So we'll get rid of this zero, add double curly braces and we'll just put counter in here and save
00:40.150 --> 00:40.480
that.
00:40.750 --> 00:44.890
And if I change this now, we should see it update in the template which we do.
00:45.520 --> 00:47.110
I'll set that back to zero.
00:48.010 --> 00:52.030
And now let's set up some methods for increasing and decreasing this counter.
00:52.060 --> 00:55.810
So I'm going to click convert to this button, this plus button.
00:56.050 --> 01:01.300
So I'll click because we'll find a method called increase counter.
01:01.990 --> 01:03.070
Let's create this method.
01:03.220 --> 01:09.520
So after our data method, a lot of comma and we need to add our methods object and we'll create this
01:09.520 --> 01:16.810
method increase counter and all we want to do is increase this counter property by one.
01:16.840 --> 01:22.930
So to access our data properties we can just do this dot and then counter and we can just do plus plus
01:22.930 --> 01:24.250
to increase it by one.
01:24.370 --> 01:27.310
I'll save that and let's see if that's working yet.
01:27.310 --> 01:28.480
We can increase the counter.
01:29.260 --> 01:32.020
So now we just need a method to decrease the counter.
01:32.020 --> 01:38.740
So a lot of comma here and I'll duplicate this method, rename it to decrease counter.
01:39.040 --> 01:44.890
Just change the code to this account to minus minus to decrease this counter property.
01:44.890 --> 01:51.220
And then I'll copy this click handler from the plus button and add it to the minus button.
01:51.220 --> 01:57.240
I'll just change the method name to decrease counter and save that we can now increase or decrease our
01:57.280 --> 01:57.850
counter.2479
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.