क्या Vue.js के साथ jQuery का उपयोग करना संभव है? मेरे पास इस फ़ंक्शन का एक फ़ंक्शन है जिसे मैं अपने वू घटक में उपयोग करना चाहता हूं। फ़ंक्शन मूल रूप से आइटम को अंदर और बाहर स्लाइड करता है, लेकिन जब मैंने <script>
टैग का उपयोग करके कार्यान्वित किया, तो मुझे jQuery कोड काम करने की बजाय सभी आइटमों के साथ एक सूची मिली।Vue.js और jQuery?
$("#slideshow > div:gt(0)").hide();
setInterval(function() {
$('#slideshow > div:first')
.fadeOut(0)
.next()
.fadeIn(1000)
.end()
.appendTo('#slideshow');
}, 5000);
मैं अपने कोड में उस फ़ंक्शन का उपयोग कैसे करूं?
<template>
<div class="timer">
<div class="title-block">
<p class="title">MG de Jong</p>
<p class="description">Sprint 1</p>
</div>
<div class="column">
<div class="block">
<p class="digit">{{ days | two_digits }}</p>
<p class="text">Days</p>
</div>
<div class="block">
<p class="digit">{{ hours | two_digits }}</p>
<p class="text">Hours</p>
</div>
<div class="block">
<p class="digit">{{ minutes | two_digits }}</p>
<p class="text">Minutes</p>
</div>
</div>
</div>
</template>
<script>
export default {
props: {
date: {
type: Number
},
},
data() {
return {
now: Math.trunc((new Date()).getTime()/1000)
}
},
mounted() {
window.setInterval(() => {
this.now = Math.trunc((new Date()).getTime()/1000);
},1000);
},
computed: {
seconds() {
return (this.modifiedDate - this.now) % 60;
},
minutes() {
return Math.trunc((this.modifiedDate - this.now)/60) % 60;
},
hours() {
return Math.trunc((this.modifiedDate - this.now)/60/60) % 24;
},
days() {
return Math.trunc((this.modifiedDate - this.now)/60/60/24);
},
modifiedDate: function(){
return Math.trunc(Date.parse(this.date)/1000)
}
},
}
</script>
घुड़सवार समारोह – thanksd
में jQuery कोड डाल @ धन्यवाद जब मैं ऐसा करता हूं कि मैं दोनों परियोजनाओं को देखता हूं और मुझे त्रुटि मिलती है: संदर्भ त्रुटि: $ परिभाषित नहीं किया गया है – Lucafraser
आप इसका उपयोग कर सकते हैं, लेकिन इससे बचने की कोशिश करें जब तक कि आपको वास्तव में इसकी आवश्यकता न हो। ध्यान से उन दोनों अलग हैं। जो काम आपने किया jQuery के साथ implemnte हो सकता है शुद्ध VueJS आसानी से डी। –