Using Vue js component without webpack
Using Vue js component without webpack
Trying to migrate from jQuery web page to VueJs.
I thought wholly rebuild web page to vue-cli based template code might be difficult.
So 1st Step to migrate jQuery to vuejs without webpack. It means all page keep individual pages not SPA. So every single page include vue.js with <script>
tag.
<script>
I stuck with jQuery slider.
Original code seems like $( ".slider" ).slider({...
.
$( ".slider" ).slider({...
Converting jQuery's slider to vue-slider-component was stuck, cause I don't know how can make static js from vue components.
My expectation is at below.
<head>
<script src="https://unpkg.com/vue"></script>
<script src="vue-slide.js"></script> <-- like this
</head>
<body>
<vue-slider v-ref:slider :value.sync="value"></vue-slider>
...
<script>
new Vue({ ...
</script>
</body>
Is stupid idea?
What is the best practice for converting jQuery to vuejs without heavy cost?
Yes, right. I want the later that only certain sections of the webpage to be Vue components. My naive idea was migrating single page one by one whenever modification required.
– sungyong
Sep 4 '18 at 5:40
This article summarizes well your possibilities, I advise you to use option 3 (x-templates): vuejsdevelopers.com/2017/03/24/vue-js-component-templates . Your code above doesn't work because you need to initialize the Vue instance and templates before using them.
– Máté Wiszt
Sep 4 '18 at 8:23
0
Thanks for contributing an answer to Stack Overflow!
But avoid …
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
But avoid …
To learn more, see our tips on writing great answers.
Required, but never shown
Required, but never shown
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
There isn't a 1-to-1 conversion between jQuery and Vue, they work very differently and do entirely different things. You have to decide if you want to have your entire webpage controlled by one main Vue instance, or do you want only certain sections of the webpage to be Vue components; I'm guessing you want the latter, which is not the typical Vue setup.
– Decade Moon
Sep 4 '18 at 5:29