代码拉取完成,页面将自动刷新
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>Configuration & API</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<link rel="stylesheet" href="docs.css">
</head>
<body>
<div class="container-fluid">
<script src="menu.js"></script>
<div class="content p-3">
<div class="container-fluid">
<h2>Vue Integration</h2>
<hr>
<h3>Dependencies</h3>
<pre><code>"dependencies": {
"vue": "^2.5.2",
"vue-router": "^3.0.1",
"zeu": "^1.3.1"
},</code></pre>
<h3 class="mt-3">TextMeter.vue</h3>
<pre><code><template>
<canvas :id="id" :width="width" :height="height"></canvas>
</template>
<script>
import * as zeu from 'zeu';
export default {
name: 'TextMeter',
props: {
id: String,
width: Number,
height: Number,
options: Object,
displayValue: String,
value: Number
},
mounted() {
if (!this.chart) {
this.init();
}
},
watch: {
displayValue(val) {
this.chart.displayValue = val;
},
value(val) {
this.chart.value = val;
}
},
beforeDestroy() {
this.destory();
},
methods: {
init() {
let textMeter = new zeu.TextMeter(this.$el.id, this.options);
textMeter.displayValue = this.displayValue;
textMeter.value = this.value;
this.chart = textMeter;
},
destory() {
this.chart.destroy();
this.chart = null;
}
}
}
</script>
</code></pre>
<h3 class="mt-3">TestPage.vue</h3>
<pre><code><template>
<div>
<button @click="update">Update</button>
<TextMeter :id="textMeter.id" :width="textMeter.width" :height="textMeter.height"
:displayValue="displayValue" :value="value" :options="textMeter.options"></TextMeter>
</div>
</template>
<script>
import TextMeter from './TextMeter';
export default {
name: 'TestPage',
components: {
TextMeter
},
data () {
return {
textMeter: {
id: 'test',
width: 200,
height: 100,
options: {}
},
displayValue: 'ZEU',
value: 80
}
},
methods: {
update() {
this.displayValue = 'NEW';
this.value = 30;
}
}
}
</script></code></pre>
</div>
</div>
</div>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.4.0/styles/github.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.4.0/highlight.min.js"></script>
<script src="docs.js"></script>
</body>
</html>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。