Chapters
48 Chapters
|
5:05:52
|
Login to bookmark this video
-
Course Code
Subscribe to download the code!
Subscribe to download the code!
-
This Video
Subscribe to download the video!
Subscribe to download the video!
-
Subtitles
Subscribe to download the subtitles!
Subscribe to download the subtitles!
-
Course Script
Subscribe to download the script!
Subscribe to download the script!
26.
Product Listing Components
Scroll down to the script below, click on any sentence (including terminal blocks) to jump to that spot in the video!
Subscribe to jump to this part in the video!
Keep on Learning!
If you liked what you've learned so far, dive in! Subscribe to get access to this tutorial plus video, code and script downloads.
This course is also built to work with Vue 3!
What JavaScript libraries does this tutorial use?
// package.json
{
"devDependencies": {
"@symfony/webpack-encore": "^0.30.0", // 0.30.2
"axios": "^0.19.2", // 0.19.2
"bootstrap": "^4.4.1", // 4.5.0
"core-js": "^3.0.0", // 3.6.5
"eslint": "^6.7.2", // 6.8.0
"eslint-config-airbnb-base": "^14.0.0", // 14.1.0
"eslint-plugin-import": "^2.19.1", // 2.20.2
"eslint-plugin-vue": "^6.0.1", // 6.2.2
"regenerator-runtime": "^0.13.2", // 0.13.5
"sass": "^1.29.0", // 1.29.0
"sass-loader": "^8.0.0", // 8.0.2
"vue": "^2.6.11", // 2.6.11
"vue-loader": "^15.9.1", // 15.9.2
"vue-template-compiler": "^2.6.11", // 2.6.11
"webpack-notifier": "^1.6.0" // 1.8.0
}
}
7 Comments
I'm an old dude who is accustomed to old-fashioned, conventional PHP with old school Javascript (SCRIPT tags, no asset management tooling...). The question I've been wondering about is: say you have a backend admin page for updating products --
/admin/products/update/123.In the old days, in a controller method, you would fetch the product entity and inject it into your template, then render a form already populated with the entity data -- the point being, render your form and entity in one step. With this stuff, it looks like you've got your cool Vue components and they are responsible for fetching data via xhr <i>after</i> the user loads the page that contains the components themselves. Thus, two http(s) requests instead of one. So my gut reaction is, that's inefficient. If your Vue app were contained in the same page as everything else, I guess you could actually inject your entity (in PHP) and output it manually, so to speak, as template variables under the Vue app'sdatakey. But the Vue app lives elsewhere and besides, it's kind of a weird approach. So I am trying to fully wrap my mind around this different, modern approach. Why shouldn't I care about the additional request cycle to fetch the data?I hope this makes sense. btw I am totally loving the tutorial.
Hello great team! question for both, Vue and LiipImagineBundle:
How to apply Liip's filter in vue.js file as we do in twig: " <img src="{{ asset('/relative/path/to/image.jpg') | imagine_filter('my_thumb') }}"/> " ?
Thanks in advance
Hey Alexander,
Good question! :) So, you can't write Twig code in JS files, but you can add a script tag in the Twig where set the final computed path after LiipImagine's filter applied, something like this:
And then you can access that MY_THUMB_URL in your JS scripts on that page. Or, you can put that computed URL on a data attibute of any tag, and then read it from the JS as well.
I hope this helps!
Cheers!
Good approach. It seems shorter than the way i found : in my Vue file I fetch the path of cached file --
$resolvedPath = $imagineCacheManager->getBrowserPath('/my/path/image.jpg', 'filter_name');in my controller. Thank you VictorHey Alexander,
Great, I'm happy to hear it helps! Yeah, this is probably the easiest way :)
Cheers!
I was hoping you would address dynamic dependent drop downs in this tutorial but didn't see it. I feel like this tutorial shows everything one would need to do it, but I can't quite put it together. I've setup my script to console log TODO's each time a drop down is changed, but I'm struggling with putting the AJAX call in the methods. I load the first drop down just as this tutorial shows loading catalogs and it works well asynchronously in a created section. But I don't know how to pass the the selected options library ID to the next AJAX call so the next one populates. If you are planning on touching on this in future tutorials I'll look for it there, if not, any help would be appreciated. Thank you for all your work on these tutorials.
Hi Brandon!
I'm not entirely sure of what you are trying to accomplish, but if I assume correctly: When you have one Drop Down element that depends on weather or not another Drop Down element has been populated (and is selecting some item), you could just base the second Drop Down load upon an @onInput event on the first one. I'd just make sure that the second Drop Down data would be cleared if the first Drop Down data isn't loaded and take it from there. I hope this helps!
"Houston: no signs of life"
Start the conversation!