native-view.uvue 1.6 KB
Newer Older
shutao-dc's avatar
shutao-dc 已提交
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插件-标准模式组件 -->
shutao-dc's avatar
shutao-dc 已提交
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 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
    <native-time-picker class="native-time-picker" :hour=2 :minute=3 @changed="onChanged"></native-time-picker>
  </view>
</template>

<script>
  export default {
    data() {
      return {
        title: 'Hello',
        buttonText: "native-button",
        isLoad: false,
        clickCount: 0
      }
    },
    onLoad() {

    },
    methods: {
      ontap(e : UniNativeViewEvent) {
        uni.showToast({
          title: "按钮被点击了"
        })
        this.clickCount ++
        this.buttonText = "native-button"+this.clickCount
      },
      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;
  }

shutao-dc's avatar
shutao-dc 已提交
53 54 55 56 57 58 59 60 61 62 63
  .native-button {
    height: 100px;
    width: 100px;
    margin: 25px auto 25px auto;
  }

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