Began work on viewers for attacks and actions

This commit is contained in:
Thaum Rystra
2020-04-23 19:32:48 +02:00
parent a6bdfe247c
commit ed35d2e984
10 changed files with 122 additions and 17 deletions

View File

@@ -1,9 +1,15 @@
<template lang="html">
<div v-html="computedValue" class="computed" :class="expectNumber && 'symbols-are-errors'"/>
<div
v-html="computedValue"
class="computed"
:class="expectNumber && 'symbols-are-errors'"
/>
</template>
<script>
import evaluateString from '/imports/api/creature/computation/afterComputation/evaluateString.js';
import numberToSignedString from '/imports/ui/utility/numberToSignedString.js';
import { isFinite } from 'lodash';
export default {
props: {
@@ -16,12 +22,18 @@ export default {
expectNumber: {
type: Boolean,
default: true,
}
},
signed: {
type: Boolean
},
},
computed: {
computedValue(){
if (!this.value) return;
let {result, errors} = evaluateString(this.value, this.scope);
if (this.signed){
result = numberToSignedString(result);
}
return result;
}
}

View File

@@ -1,5 +1,5 @@
<template lang="html">
<computed :value="value" :scope="scope"/>
<computed :value="value" :scope="scope" v-bind="$attrs"/>
</template>
<script>