init
This commit is contained in:
0
xhs-mini-demos/component-case/template/template.css
Normal file
0
xhs-mini-demos/component-case/template/template.css
Normal file
40
xhs-mini-demos/component-case/template/template.js
Normal file
40
xhs-mini-demos/component-case/template/template.js
Normal file
@@ -0,0 +1,40 @@
|
||||
Page({
|
||||
onShareAppMessage() {
|
||||
return {
|
||||
title: 'template',
|
||||
path: '/component-case/template/template',
|
||||
};
|
||||
},
|
||||
|
||||
data: {
|
||||
value: '',
|
||||
value2: '',
|
||||
},
|
||||
|
||||
onReady() {
|
||||
// debugger
|
||||
// setTimeout(() => {
|
||||
|
||||
// }, 3000)
|
||||
},
|
||||
|
||||
onClick() {
|
||||
this.setData('value', this.data.value2);
|
||||
},
|
||||
|
||||
onClick2() {
|
||||
// const res = this.selectComponent('#child');
|
||||
// res.onClick();
|
||||
this.setData({
|
||||
value: '',
|
||||
});
|
||||
},
|
||||
|
||||
onInput(e) {
|
||||
this.data.value2 = e.detail.value;
|
||||
},
|
||||
|
||||
onMyevent() {
|
||||
this.onClick2();
|
||||
}
|
||||
});
|
||||
8
xhs-mini-demos/component-case/template/template.json
Normal file
8
xhs-mini-demos/component-case/template/template.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"navigationBarTitleText": "模版引用",
|
||||
"usingComponents": {
|
||||
"showbox": "../../common/component/showbox/index",
|
||||
"box": "../../common/component/container/index",
|
||||
"example": "../../common/component/example/index"
|
||||
}
|
||||
}
|
||||
17
xhs-mini-demos/component-case/template/template.xhsml
Normal file
17
xhs-mini-demos/component-case/template/template.xhsml
Normal file
@@ -0,0 +1,17 @@
|
||||
<import src="../../common/template.xhsml" />
|
||||
|
||||
<view class="container">
|
||||
<showbox title="template与组件内外通信">
|
||||
<box pad="10px">
|
||||
<view class="_ui-space">
|
||||
<example id="child" value="{{value}}" bindmyevent="onMyevent"></example>
|
||||
<template is="template" data="{{ value: value }}"></template>
|
||||
<view class="_ui-input">
|
||||
<input placeholder="输入修改的value" placeholder-style="color: #3333334D;" bindinput="onInput"/>
|
||||
</view>
|
||||
<button class="_ui-button" bindtap="onClick" hover-class="_ui-button-hover">点击修改value</button>
|
||||
<button class="_ui-button" bindtap="onClick2" hover-class="_ui-button-hover">组件外重置value</button>
|
||||
</view>
|
||||
</box>
|
||||
</showbox>
|
||||
</view>
|
||||
Reference in New Issue
Block a user