2019-04-29 09:11:57 +09:00
|
|
|
<template>
|
|
|
|
<div>
|
2020-04-20 21:35:27 +09:00
|
|
|
<mk-button class="kudkigyw" @click="click()" :primary="value.primary">{{ hpml.interpolate(value.text) }}</mk-button>
|
2019-04-29 09:11:57 +09:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
2020-01-30 04:37:25 +09:00
|
|
|
import MkButton from '../ui/button.vue';
|
2019-04-29 09:11:57 +09:00
|
|
|
|
|
|
|
export default Vue.extend({
|
2020-01-30 04:37:25 +09:00
|
|
|
components: {
|
|
|
|
MkButton
|
|
|
|
},
|
2019-04-29 09:11:57 +09:00
|
|
|
props: {
|
|
|
|
value: {
|
|
|
|
required: true
|
|
|
|
},
|
2020-04-20 21:35:27 +09:00
|
|
|
hpml: {
|
2019-04-29 09:11:57 +09:00
|
|
|
required: true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
click() {
|
|
|
|
if (this.value.action === 'dialog') {
|
2020-04-20 21:35:27 +09:00
|
|
|
this.hpml.eval();
|
2019-04-29 09:11:57 +09:00
|
|
|
this.$root.dialog({
|
2020-04-20 21:35:27 +09:00
|
|
|
text: this.hpml.interpolate(this.value.content)
|
2019-04-29 09:11:57 +09:00
|
|
|
});
|
|
|
|
} else if (this.value.action === 'resetRandom') {
|
2020-04-20 21:35:27 +09:00
|
|
|
this.hpml.updateRandomSeed(Math.random());
|
|
|
|
this.hpml.eval();
|
2019-07-06 18:14:50 +09:00
|
|
|
} else if (this.value.action === 'pushEvent') {
|
|
|
|
this.$root.api('page-push', {
|
2020-04-20 21:35:27 +09:00
|
|
|
pageId: this.hpml.page.id,
|
2019-07-07 05:12:31 +09:00
|
|
|
event: this.value.event,
|
|
|
|
...(this.value.var ? {
|
2020-04-20 21:35:27 +09:00
|
|
|
var: this.hpml.vars[this.value.var]
|
2019-07-07 05:12:31 +09:00
|
|
|
} : {})
|
2019-07-06 18:14:50 +09:00
|
|
|
});
|
|
|
|
|
|
|
|
this.$root.dialog({
|
|
|
|
type: 'success',
|
2020-04-20 21:35:27 +09:00
|
|
|
text: this.hpml.interpolate(this.value.message)
|
2019-07-06 18:14:50 +09:00
|
|
|
});
|
2020-04-13 03:23:23 +09:00
|
|
|
} else if (this.value.action === 'callAiScript') {
|
2020-04-20 21:35:27 +09:00
|
|
|
this.hpml.callAiScript(this.value.fn);
|
2019-04-29 09:11:57 +09:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
2020-01-30 04:37:25 +09:00
|
|
|
<style lang="scss" scoped>
|
|
|
|
.kudkigyw {
|
|
|
|
display: inline-block;
|
|
|
|
min-width: 200px;
|
|
|
|
max-width: 450px;
|
|
|
|
margin: 8px 0;
|
|
|
|
}
|
2019-04-29 09:11:57 +09:00
|
|
|
</style>
|