uniapp 中renderjs的使用

1.cs.vue

1
2
3
4
5
6
7
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
44
45
46
47
48
49
50
<template>
    <view class="demo">
        <!-- text是renderjsmodule名称 -->
        
         
        <view> {{data}}</view>
        <button @click="text.onClick2">
            按钮2
        </button>
         
         
        <button  @click="text.onClick1">
            按钮1
        </button>
          
    </view>
</template>
<!-- 普通的script标签 -->
<script>
    export default {
        data(){
            return {
                data: "hello",
            }
        },
        methods:{
            
        }
    }
</script>
<!-- renderjs的script标签 -->
<script module="text" lang="renderjs">
    export default {
        
        methods:{
            onClick1(event, ownerInstance) {
                console.log('点击了按钮1');
                console.log(event);
                console.log(ownerInstance);
            },
 
            onClick2(event,ownerInstance) {
                console.log('点击了按钮2');
                console.log(event);
                console.log(ownerInstance);
            },
            
        }
    }
</script>

  

posted @   zhang_you_wu  阅读(61)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
点击右上角即可分享
微信分享提示