Began work on viewers for attacks and actions
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template lang="html">
|
||||
<computed :value="value" :scope="scope"/>
|
||||
<computed :value="value" :scope="scope" v-bind="$attrs"/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
Reference in New Issue
Block a user