1

I have a layout:

<?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="admin-1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<update handle="editor"/>
<body>
 <referenceContainer name="content">
 <uiComponent name="name_name2_form"/>
 </referenceContainer>
</body> </page>

and want to add custom JS file, so that it only works here (this UI component) How I can do this? Ty for answer

asked Jul 16, 2020 at 10:00

1 Answer 1

-1

you can try this

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
 <!-- Add local resources -->
 <css src="css/my-styles.css"/>
 <!-- The following two ways to add local JavaScript files are equal -->
 <script src="Magento_Catalog::js/sample1.js"/>
 <link src="js/sample.js"/>
 <!-- Add external resources -->
<css src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap-theme.min.css" src_type="url" />
 <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js" src_type="url" />
 <link src="http://fonts.googleapis.com/css?family=Montserrat" src_type="url" /> 
</head>
answered Jul 16, 2020 at 10:06

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.