-
Notifications
You must be signed in to change notification settings - Fork 2
/
index_vueReact.html
146 lines (127 loc) · 4.68 KB
/
index_vueReact.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"/>
<meta name="renderer" content="webkit" />
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="apple-mobile-web-app-status-bar-style" content="black"/>
<meta name="format-detection" content="telephone=no" />
<meta http-equiv="Expires" content="-1"/>
<meta http-equiv="Cache-Control" content="no-cache"/>
<meta http-equiv="Pragma" content="no-cache"/>
<title>前端笔记_jackdizhu</title>
<link rel="shortcut icon" href="/favicon.ico"/>
<style type="text/css" id="style">
pre{
width: 100%;
white-space: pre-wrap;
}
</style>
</head>
<body>
<header>
jackdizhu Vue_React
</header>
<div class="content">
<h5><a name="vue" id="vue"></a><span>vue</span></h5>
<div class="clearfix">
<pre>
<div id="vue">
<span v-for="item in items">
{{ item.name }}
</span>
<span v-show="show2" @click="showHide">
( span v-show 02 ....) --> component01
</span>
<component01 message="hello" :_show="show"></component01>
</div>
<script>
(function () {
'use strict';
Vue.component('component01', {
props: ['message','_show'],
template: '<div v-show="_show">A custom component {{message}}! -> {{_show}}</div>'
});
var app = new Vue({
el: '#vue',
data: {
show: true,
show2: true,
items: [
{name: 'aaa'},
{name: 'bbb'},
],
message: 'ssssssss'
},
methods: {
showHide: function (){
var is = this.show == true;
if(is){
this.show = false;
}else{
this.show = true;
}
}
},
});
}());
</script>
</pre>
</div>
<h5><a name="react" id="react"></a><span>react</span></h5>
<div class="clearfix">
<pre>
<div id="react">
</div>
<script type="text/babel">
(function () {
'use strict';
var _msg = React.createClass({
getInitialState: function (){
return {show: true};
},
_click: function (){
var dom = this.refs.msgP;
var show;
if(this.state.show == true){
show = false;
}else{
show = true;
}
this.setState({
show: show
});
console.log(dom);
},
render: function() {
var style={fontSize:16};
var show = this.state.show ? 'show' : 'hide';
var className = 'asdf '+this.props.name;
return <p ref="msgP" style={{fontSize:16}} data-aa="sadkf" htmlFor={this.props.name} className={'asdf '+this.props.name+' '+this.props.class} p -> {this.props.name} -> {show} )</p>;
}
});
var data = ['name','name1','name2'];
function _click(){
console.log('_click');
}
ReactDOM.render(
<div>
<_msg name="msgnnn" opactiy=".6" class='p01 p02'/>
{
data.map(key => {
return <span >
})
}
</div>,
document.getElementById('react')
);
}());
</script>
</pre>
</div>
</div>
<script type="text/javascript" src="./dist/index.js"></script>
</body>
</html>