<template>
<div>
<input type="text" class="input__field"
:value="value"
:ref="'input'"
@input="onChange($event.target.value)"/>
</div>
</template>
export default {
name: "CInput",
props: {
value: {
type: [String, Number],
required: true
},
},
mounted() {
this.$emit("ref", this.$refs.input)
},
methods: {
onChange(val) {
this.$emit('value', val)
},
}
}
<template>
<div>
<div class="complex-item__content" @keydown.esc="close">
<span v-show="!editTitle"
class="complex-item__title"
@dblclick="showEditTitle">{{ content.title }}</span>
<c-input v-show="editTitle"
class="input complex-item__edit-title"
@ref="input = $event"
:value="edit.title"
@value="edit.title = $event"
@keydown.ctrl.enter="endEdit(content.key, edit.title, null)" />
</div>
</div>
</template>
import CInput from "@/components/CInput";
export default {
name: "Item",
components: {
CInput
},
props: {
content: {
type: Object,
required: true
},
editTitleTodo: {
type: Function,
required: true
},
},
data() {
return {
edit: {
title: this.content.title,
},
editTitle: false,
}
},
methods: {
close() {
this.editTitle = false
},
showEditTitle() {
this.editTitle = true
this.$nextTick(() => {
this.input.focus()
})
},
endEdit(id, title) {
this.editTitleTodo(id, title)
this.editTitle = false
},
}
}
<div class="toolTip">
<p class="toolTip__content">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Consequuntur distinctio dolore ipsam iste nobis pariatur possimus quia, quidem quisquam quos?</p>
<!-- /.toolTip__content -->
</div>
<!-- /.toolTip -->
.toolTip {
width: 400px;
height: 150px;
background-color: #ebebeb;
border-radius: 5px;
margin-left: 50px;
position: relative;
padding: 20px;
&::before {
content: "";
width: 30px;
height: 30px;
transform: rotate(45deg);
position: absolute;
left: -15px;
top: 30%;
background-color: #ebebeb;
}
}
$(document).on('change', '#new_price', function () {
if ($(this).is(':checked')) {
var newPrice = $('.add_item[data-id=1]').attr('data-price') * 1 + $(this).val() * 1;
$('.add_item[data-id=1]').attr('data-price', newPrice);
} else {
var newPrice = $('.add_item[data-id=1]').attr('data-price') * 1 - $(this).val() * 1;
$('.add_item[data-id=1]').attr('data-price', newPrice);
}
})
var pluginName = "defaultPluginName",
defaults = {
show: function() {}
};
init: function() {
var options = this.options;
}
init: function() {
var options = this.options;
elem.on("click", function(event){
if ( option.show(event) != false ) {
// Делаем что хотим при нажатии на на этот элемент
}
})
}
$("elem").pluginName({
show: function(event) {
// Тут все что вы хотите сделать при нажатии на элемент <b>elem</b>
// Если указать return false; То все стандартные действия будут отменены
}
});
function toggleFullScreen(elem) {
if ((document.fullScreenElement !== undefined && document.fullScreenElement === null) || (document.msFullscreenElement !== undefined && document.msFullscreenElement === null) || (document.mozFullScreen !== undefined && !document.mozFullScreen) || (document.webkitIsFullScreen !== undefined && !document.webkitIsFullScreen)) {
if (elem.requestFullScreen) {
elem.requestFullScreen();
} else if (elem.mozRequestFullScreen) {
elem.mozRequestFullScreen();
} else if (elem.webkitRequestFullScreen) {
elem.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);
} else if (elem.msRequestFullscreen) {
elem.msRequestFullscreen();
}
} else {
if (document.cancelFullScreen) {
document.cancelFullScreen();
} else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else if (document.webkitCancelFullScreen) {
document.webkitCancelFullScreen();
} else if (document.msExitFullscreen) {
document.msExitFullscreen();
}
}
}
user-select: none;
pointer-events: none;