-
Notifications
You must be signed in to change notification settings - Fork 0
/
vue_test.html
59 lines (51 loc) · 1.56 KB
/
vue_test.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<html>
<head>
<link rel="stylesheet" href="index.css">
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
<div id="example-1">
<button v-on:click="counter += 1">Add 1</button>
<p>The button above has been clicked {{ counter }} times.</p>
</div>
<div id="tweet">
<div class="row">
<div class="btn btn-2084 center"><button v-on:click=send_tweet>Share!</button></div>
</div>
</div>
<script>
var example1 = new Vue({
el: '#example-1',
data: {
counter: 0
}
})
</script>
<script>
var tweet = new Vue({
el: '#tweet',
data: {
s: "",
url: ""
},
methods: {
send_tweet: function (event) {
var s, url;
s = "投稿するテキスト";
url = document.location.href;
if (s != "") {
if (s.length > 140) {
//文字数制限
alert("テキストが140字を超えています");
} else {
//投稿画面を開く
url = "http://twitter.com/share?url=" + escape(url) + "&text=" + s;
window.open(url, "_blank", "width=600,height=300");
}
}
}
}
})
</script>
</body>
</html>