hiprint 设计
This commit is contained in:
1 parent
209e88a905
commit
1c83bf5672
16 files changed
+943
-111
No files matched your search
@@ -0,0 +1,99 @@
|
||||
<div id="app">
|
||||
<a-button @@click="handleClick">
|
||||
@* <template #icon>
|
||||
<icon-plus />
|
||||
</template> *@
|
||||
{{ message }}
|
||||
</a-button>
|
||||
{{ result }}
|
||||
|
||||
<a-table :columns="columns" :data="datat" />
|
||||
</div>
|
||||
<script src="/front/signalr.min.js"></script>
|
||||
<script>
|
||||
const { createApp, reactive } = Vue
|
||||
|
||||
const app = createApp({
|
||||
data() {
|
||||
return {
|
||||
message: 'Hello Vue!',
|
||||
result: 'Hello Vue!',
|
||||
columns: [
|
||||
{
|
||||
title: '地址',
|
||||
dataIndex: 'Key',
|
||||
},
|
||||
{
|
||||
title: '值',
|
||||
dataIndex: 'Value',
|
||||
}
|
||||
],
|
||||
datat: reactive([])
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
var _this = this;
|
||||
_this.connection = new signalR.HubConnectionBuilder()
|
||||
.withAutomaticReconnect()
|
||||
.withUrl("/stocks")
|
||||
.build();
|
||||
_this.connection.start().then(function () {
|
||||
_this.connection.invoke("GetAllStocks").then(function (stocks) {
|
||||
for (let i = 0; i < stocks.length; i++) {
|
||||
_this.datat.push({
|
||||
Key: stocks[i].dbName,
|
||||
Value: stocks[i].dbValue
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
_this.connection.invoke("OpenMarket").then(() => {
|
||||
_this.startStreaming();
|
||||
});
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
handleClick() {
|
||||
var _this = this;
|
||||
axios.post("/configs/Print/Test", {})
|
||||
.then(function (json) {
|
||||
_this.result = json.data.Data;
|
||||
_this.datat = [];
|
||||
_this.result.forEach((item) => {
|
||||
_this.datat.push(item);
|
||||
})
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
},
|
||||
|
||||
handleSubmit(data) {
|
||||
console.log(data);
|
||||
this.$message.info('This is an info message')
|
||||
},
|
||||
|
||||
startStreaming() {
|
||||
this.connection.stream("StreamStocks").subscribe({
|
||||
close: false,
|
||||
next: this.displayStock,
|
||||
error: function (err) {
|
||||
logger.log(err);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
displayStock(stock) {
|
||||
this.datat.forEach((item, index) => {
|
||||
if (item.Key == stock.dbName) {
|
||||
this.datat[index].Value = stock.dbValue;
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
app.use(ArcoVue)
|
||||
.use(ArcoVueIcon)
|
||||
.mount('#app');
|
||||
|
||||
</script>
|
||||
Reference in new issue
Block a user