Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
WEBVTT
00:00.850 --> 00:04.480
Let's switch this simple app over to using the composition API.
00:04.780 --> 00:09.040
And one important thing to note is that everything in the template stays the same.
00:09.250 --> 00:12.850
We don't need to change anything in the template generally with the composition API.
00:12.880 --> 00:14.950
Everything in the template works exactly the same.
00:14.980 --> 00:19.720
We use data properties, computed properties, methods in exactly the same way.
00:19.780 --> 00:22.960
The only place we do things differently is in the script section.
00:23.200 --> 00:27.400
So I'm going to comment out this options API script section for now.
00:28.180 --> 00:32.800
So a lot of opening comment at the top of it and then a closing comment at the bottom of it.
00:34.420 --> 00:38.230
Let's add a new script section where we'll use the composition API.
00:38.230 --> 00:39.340
So scripts.
00:40.360 --> 00:44.120
Now we can use the composition API with two different patterns.
00:44.150 --> 00:49.150
There's the setup function pattern, which was the original pattern which came when the composition
00:49.150 --> 00:50.440
API first came out.
00:50.440 --> 00:55.870
And then we have the second pattern, which is the script setup pattern which was released later on
00:55.870 --> 00:56.980
and is much better.
00:57.100 --> 01:03.100
But for now, let's just use the original setup function pattern, although we will later use the superior
01:03.100 --> 01:04.480
script setup pattern.
01:04.480 --> 01:11.680
So to use the setup function pattern again, we need to add our export default, but we don't add options
01:11.680 --> 01:18.010
like data methods, etc. Instead, we add a settled function like this and we place all of our code
01:18.010 --> 01:18.550
in here.
01:18.580 --> 01:24.550
Basically all of our data properties, methods, computed properties, watches, etc. will all go inside
01:24.550 --> 01:26.080
this setup function.2053
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.