init
This commit is contained in:
15
xhs-mini-demos/common/component/example/index.css
Normal file
15
xhs-mini-demos/common/component/example/index.css
Normal file
@@ -0,0 +1,15 @@
|
||||
.container {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.container view{
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
._ui-space > * {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
._ui-space > *:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
24
xhs-mini-demos/common/component/example/index.js
Normal file
24
xhs-mini-demos/common/component/example/index.js
Normal file
@@ -0,0 +1,24 @@
|
||||
Component({
|
||||
properties: {
|
||||
value: Number
|
||||
},
|
||||
|
||||
data: {
|
||||
value2: ''
|
||||
},
|
||||
|
||||
methods: {
|
||||
onClick() {
|
||||
this.triggerEvent('myevent');
|
||||
}
|
||||
},
|
||||
|
||||
observers: {
|
||||
value: function(value) {
|
||||
// 在 numberA 或者 numberB 被设置时,执行这个函数
|
||||
this.setData({
|
||||
value2: value && '[' + value + ']'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
3
xhs-mini-demos/common/component/example/index.json
Normal file
3
xhs-mini-demos/common/component/example/index.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"component": true
|
||||
}
|
||||
5
xhs-mini-demos/common/component/example/index.xhsml
Normal file
5
xhs-mini-demos/common/component/example/index.xhsml
Normal file
@@ -0,0 +1,5 @@
|
||||
<view class="container _ui-space">
|
||||
<view>组件内部的value值: {{value}}</view>
|
||||
<view>监听组件value值的变化: {{value2}}</view>
|
||||
<button bindtap="onClick" class="_ui-button" hover-class="_ui-button-hover">组件内重置value值</button>
|
||||
</view>
|
||||
Reference in New Issue
Block a user