25.06.2018 Views

Full-Stack Vue.js 2 and Laravel 5

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

{ images: [ '/images/1/Image_1.jpg', '/images/1/Image_2.jpg',<br />

'/images/1/Image_3.jpg', '/images/1/Image_4.jpg' ] } } }); var app = new <strong>Vue</strong>({<br />

... });<br />

Before we test this component, let's make an adjustment to our CSS. We<br />

previously had a rule to ensure the image inside the modal window stretched to<br />

full width by using the .modal-content img selector. Let's instead use the .imagecarousel<br />

selector for this rule, as we're decoupling the image from the modal<br />

window.<br />

resources/assets/css/style.css: .image-carousel img { width: 100%; }<br />

After your code has rebuilt, navigate the browser to /listing/1 <strong>and</strong> you should see<br />

no difference, as the component should render in almost exactly the same way as<br />

the previous markup did.<br />

If we check <strong>Vue</strong> Devtools, however, <strong>and</strong> open up to the Components tab, you'll<br />

see that we now have the ImageCarousel component nested below the Root instance.<br />

Selecting ImageCarousel, we can even inspect its state:<br />

Figure 6.2. <strong>Vue</strong> Devtools showing ImageCarousel component

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!