This commit is contained in:
Šimon Jan Šustek 2021-01-23 01:10:51 +01:00
parent c63b2dd6f0
commit 6e8cb3c8b6
4 changed files with 27 additions and 31 deletions

View File

@ -11725,6 +11725,11 @@
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
"dev": true "dev": true
}, },
"v-click-outside": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/v-click-outside/-/v-click-outside-3.1.2.tgz",
"integrity": "sha512-gMdRqfRE6m6XU6SiFi3dyBlFB2MWogiXpof8Aa3LQysrl9pzTndqp/iEaAphLoadaQUFnQ0ec6fLLaxr7LiY6A=="
},
"v8-compile-cache": { "v8-compile-cache": {
"version": "2.2.0", "version": "2.2.0",
"resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.2.0.tgz", "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.2.0.tgz",

View File

@ -11,6 +11,7 @@
"buefy": "^0.9.0", "buefy": "^0.9.0",
"core-js": "^3.6.5", "core-js": "^3.6.5",
"jspdf": "^2.3.0", "jspdf": "^2.3.0",
"v-click-outside": "^3.1.2",
"vue": "^2.6.11", "vue": "^2.6.11",
"vue-router": "^3.2.0" "vue-router": "^3.2.0"
}, },

View File

@ -2,18 +2,18 @@
<div id="hlava"> <div id="hlava">
<div v-on:click="makeactive" v-if="!isactive"> <div v-on:click="makeactive" v-if="!isactive">
<p class="mx-6 mt-4 has-text-weight-bold has-text-centered"> <p class="mx-6 mt-4 has-text-weight-bold has-text-centered">
{{ title }} {{ displaytitle }}
</p> </p>
<p> <p>
{{ text }} {{ displaytext }}
</p> </p>
</div> </div>
<div v-if="isactive"> <div v-click-outside="makeinactive" v-if="isactive">
<p class="mx-6 mt-4 has-text-weight-bold has-text-centered"> <p class="mx-6 mt-4 has-text-weight-bold has-text-centered">
<b-input style="text-align:right;" v-on:blur="makeinactive" v-model="title"></b-input> <b-input placeholder="Název hlavy" style="text-align:right;" v-model="title"></b-input>
</p> </p>
<p> <p>
<b-input v-on:blur="makeinactive" v-model="text" type="textarea"></b-input> <b-input placeholder="Text hlavy" v-model="text" type="textarea"></b-input>
</p> </p>
</div> </div>
</div> </div>
@ -29,9 +29,7 @@ export default {
props: ['title', 'text'], props: ['title', 'text'],
data: () => { data: () => {
return { return {
isactive: false, isactive: false
istitlefocused: false,
istextfocused: false,
} }
}, },
methods: { methods: {
@ -40,31 +38,21 @@ export default {
}, },
makeinactive: function () { makeinactive: function () {
this.isactive = false; this.isactive = false;
}, }
changeFocus: function (how, what) { },
if (how=="focus") { computed: {
switch (what) { displaytitle: function () {
case "title": if (!this.title) {
this.istitlefocused = true return "Název hlavy"
break;
case "text":
this.istextfocused = true
break;
}
} else { } else {
switch (what) { return this.title
case "title":
this.istitlefocused = false
break;
case "text":
this.istextfocused = false
break;
}
} }
if (this.istitlefocused||this.istextfocused==true) { },
this.makeactive() displaytext: function () {
if (!this.text) {
return "Text hlavy"
} else { } else {
this.makeinactive() return this.text
} }
} }
} }

View File

@ -3,7 +3,9 @@ import App from './App.vue'
import router from './router' import router from './router'
import Buefy from 'buefy' import Buefy from 'buefy'
import './assets/scss/app.scss' import './assets/scss/app.scss'
import vClickOutside from 'v-click-outside'
Vue.use(vClickOutside)
Vue.use(Buefy) Vue.use(Buefy)
Vue.config.productionTip = false Vue.config.productionTip = false