native-view.uvue 1.6 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>
shutao-dc's avatar
shutao-dc 已提交
4
    <!-- native-button 通过 native-view 绑定原生button 实现的UTS插件-标准模式组件 -->
DCloud-WZF's avatar
DCloud-WZF 已提交
5 6
    <native-button class="native-button" style="width: 200px; height: 100px;" :text="buttonText" @buttonTap="ontap"
      @load="onload"></native-button>
shutao-dc's avatar
shutao-dc 已提交
7
    <!-- native-time-picker 通过 native-view 绑定原生time-picker 实现的UTS插件-标准模式组件 -->
shutao-dc's avatar
shutao-dc 已提交
8
    <native-time-picker class="native-time-picker" :hour=2 :minute=3 @changed="onChanged"></native-time-picker>
DCloud-WZF's avatar
DCloud-WZF 已提交
9 10 11 12 13 14 15 16 17
  </view>
</template>

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

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

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

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

DCloud-WZF's avatar
DCloud-WZF 已提交
53 54 55 56 57 58 59 60
  .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 已提交
61 62
    border-style: solid;
    border-radius: 5px;
DCloud-WZF's avatar
DCloud-WZF 已提交
63
  }
shutao-dc's avatar
shutao-dc 已提交
64
</style>