Skip to content

Commit 0f4c9b2

Browse files
committed
param: small component
1 parent 4cd5928 commit 0f4c9b2

File tree

3 files changed

+28
-11979
lines changed

3 files changed

+28
-11979
lines changed

index.html

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,27 +38,18 @@
3838
<span v-show="series">{{series}}</span>
3939
</div>
4040
</details>
41-
<details>
42-
<summary>
43-
坐标
44-
</summary>
45-
<div>
46-
<input type="text" v-model="axis">
47-
<span v-show="axis">{{axis}}</span>
48-
</div>
49-
</details>
5041
<details>
5142
<summary>
5243
参数
5344
</summary>
5445
<div>
55-
<input type="text" v-model="param">
56-
<span v-show="param">{{param}}</span>
46+
<table>
47+
<property chname="标题" propkey="title"></property>
48+
</table>
5749
</div>
5850
</details>
5951
<button v-on="{click: compile}">编译</button><br>
6052
<iframe v-bind:src="curl" id="compilePrev"></iframe>
61-
<footer>Powered by <a href="https://github.com/aslushnikov/latex-online" target="_blank">LatexOnline</a></footer>
6253
</div>
6354
<div class="textext">
6455
<textarea v-model="premable"></textarea>
@@ -68,7 +59,7 @@
6859
<textarea v-model="suffix"></textarea>
6960
</div>
7061
</div>
71-
<script src="web/js/vue.js"></script>
62+
<script src="https://cdn.bootcdn.net/ajax/libs/vue/2.6.11/vue.js"></script>
7263
<script src="web/js/main.js"></script>
7364
</body>
7465
</html>

web/js/main.js

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,31 @@
1+
Vue.component('property',{
2+
template:'<tr><td>{{chname}}</td><td>{{propkey}}</td><td><input :type="type" v-model="value" @keyup="on_change"></td></tr>',
3+
props: ['chname','propkey'],
4+
data: function(){
5+
return {
6+
type: "text", //属性的数据类型
7+
value: "", //属性的值
8+
}
9+
},
10+
computed:{
11+
paramString: function(){
12+
return this.propkey + "={" + this.value + "},";
13+
}
14+
},
15+
methods:{
16+
on_change: function(){
17+
if(this.value!="")
18+
app.param = this.paramString;
19+
else
20+
app.param = "";
21+
}
22+
}
23+
});
24+
125
var app = new Vue({
226
el: '#app',
327
data:{
428
series: "",
5-
axis: null,
629
param: "",
730
premable:"\\documentclass[tikz]{standalone}\n\
831
\\usepackage{pgfplots}\n\

0 commit comments

Comments
 (0)