native-view.uvue 1.4 KB
Newer Older
DCloud-WZF's avatar
DCloud-WZF 已提交
1
<template>
DCloud_iOS_XHY's avatar
DCloud_iOS_XHY 已提交
2 3
  <view>
    <text class="tips">说明:如果本地无 uts 插件编译环境请提交打包自定义基座查看效果</text>
DCloud-WZF's avatar
DCloud-WZF 已提交
4 5
    <native-button class="native-button" style="width: 200px; height: 100px;" :text="buttonText" @buttonTap="ontap"
      @load="onload"></native-button>
shutao-dc's avatar
shutao-dc 已提交
6
    <native-time-picker class="native-time-picker" :hour=2 :minute=3 @changed="onChanged"></native-time-picker>
DCloud-WZF's avatar
DCloud-WZF 已提交
7 8 9 10 11 12 13 14 15
  </view>
</template>

<script>
  export default {
    data() {
      return {
        title: 'Hello',
        buttonText: "native-button",
shutao-dc's avatar
shutao-dc 已提交
16 17
        isLoad: false,
        clickCount: 0
DCloud-WZF's avatar
DCloud-WZF 已提交
18 19 20 21 22 23 24 25 26 27
      }
    },
    onLoad() {

    },
    methods: {
      ontap(e : UniNativeViewEvent) {
        uni.showToast({
          title: "按钮被点击了"
        })
shutao-dc's avatar
shutao-dc 已提交
28 29
        this.clickCount ++
        this.buttonText = "native-button"+this.clickCount
DCloud-WZF's avatar
DCloud-WZF 已提交
30 31 32 33 34 35 36 37 38 39 40 41
      },
      onload() {
        //标记已初始化 用于自动化测试
        this.isLoad = true
      },
      onChanged(e : UniNativeViewEvent) {
        console.log("onchanged-----", e.detail)
      }
    }
  }
</script>

DCloud_iOS_XHY's avatar
DCloud_iOS_XHY 已提交
42 43 44 45 46 47 48 49 50
<style>

  .tips {
    font-size: 14px;
    color: #BEBEBE;
    margin: 25px auto 25px auto;
    text-align: center;
  }

DCloud-WZF's avatar
DCloud-WZF 已提交
51 52 53 54 55 56 57 58
  .native-button {
    height: 100px;
    width: 100px;
    margin: 25px auto 25px auto;
  }

  .native-time-picker {
    margin: 10px auto 25px auto;
shutao-dc's avatar
shutao-dc 已提交
59 60
    border-style: solid;
    border-radius: 5px;
DCloud-WZF's avatar
DCloud-WZF 已提交
61
  }
shutao-dc's avatar
shutao-dc 已提交
62
</style>