mo home ready!

This commit is contained in:
minimo-io 2022-09-22 15:14:23 -03:00
parent de0bec251b
commit 39ee59df12
2 changed files with 87 additions and 22 deletions

View File

@ -1,13 +1,40 @@
{/* <a href="#"><i class="" aria-hidden="true"></i> Leer más</a> */} jQuery(document).ready(function(){
const app = createApp({
data() {
return {
readMoreText: "Leer más",
readMoreIcon: "fa fa-arrow-right",
}
}
})
app.mount('#mo-home-vue-app') var READMORELANG, READLESSLANG;
const app = Vue.createApp({
data() {
return {
readMoreActive: false,
readMoreText: "Leer más",
readMoreIcon: "fa fa-arrow-right",
}
},
mounted(){
READMORELANG = jQuery(".readMoreBtn").data("readmorelang");
READLESSLANG = jQuery(".readMoreBtn").data("readlesslang");
},
methods:{
readMore(){
if (this.readMoreActive){
this.readMoreText = READMORELANG;
this.readMoreIcon = "fa fa-arrow-right";
}else{
this.readMoreText = READLESSLANG;
this.readMoreIcon = "fa fa-minus";
}
this.readMoreActive = ! this.readMoreActive;
jQuery(".d-none").toggle("fast", function(){
});
}
}
})
app.mount('#mo-home-vue-app')
});

View File

@ -4,28 +4,66 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title> <title>Vue Tests</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css" integrity="sha512-5A8nwdMOWrSz20fDsjczgUidUBR8liPYU+WymTZP1lmY9G6Oc7HlZv156XqnsgNUzTyMefFTcsFH/tnJE/+xBg==" crossorigin="anonymous" referrerpolicy="no-referrer" /> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css" integrity="sha512-5A8nwdMOWrSz20fDsjczgUidUBR8liPYU+WymTZP1lmY9G6Oc7HlZv156XqnsgNUzTyMefFTcsFH/tnJE/+xBg==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<style>
.d-none{
display:none;
}
</style>
</head> </head>
<body> <body>
<div id="mo-home-vue-app"> <div class="d-none">
<a @click.prevent="readMore()"><i :class="readMoreIcon" aria-hidden="true"></i> {{ readMoreText }}</a> This is a hidden text. Named for some obscure action to be active on the web.
<br>
Now it's time to rock & roll!
</div> </div>
<div id="mo-home-vue-app">
<a class="readMoreBtn" data-readlesslang = "Leer menos" data-readmorelang = "Leer más" @click.prevent="readMore()"><i :class="readMoreIcon" aria-hidden="true"></i> {{ readMoreText }}</a>
</div>
<script src="https://unpkg.com/jquery@3.3.1/dist/jquery.min.js"></script>
<script src='https://unpkg.com/vue@3/dist/vue.global.js'></script> <script src='https://unpkg.com/vue@3/dist/vue.global.js'></script>
<script> <script>
jQuery(document).ready(function(){
var READMORELANG, READLESSLANG;
const app = Vue.createApp({ const app = Vue.createApp({
data() { data() {
return { return {
readMoreText: "Leer más", readMoreActive: false,
readMoreIcon: "fa fa-arrow-right", readMoreText: "Leer más",
} readMoreIcon: "fa fa-arrow-right",
}
},
mounted(){
READMORELANG = jQuery(".readMoreBtn").data("readmorelang");
READLESSLANG = jQuery(".readMoreBtn").data("readlesslang");
},
methods:{
readMore(){
if (this.readMoreActive){
this.readMoreText = READMORELANG;
this.readMoreIcon = "fa fa-arrow-right";
}else{
this.readMoreText = READLESSLANG;
this.readMoreIcon = "fa fa-minus";
}
this.readMoreActive = ! this.readMoreActive;
jQuery(".d-none").toggle("fast", function(){
});
}
} }
}) })
app.mount('#mo-home-vue-app') app.mount('#mo-home-vue-app')
});
</script> </script>
</body> </body>
</html> </html>