zengh
2022-05-09 52c39f5e2711e5535b689b66dfa5e100c7882b7f
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
<!DOCTYPE html>
<html>
 
<head>
    <meta charset="utf-8" />
    <title>popup</title>
    <!-- Vue -->
    <script src="https://cdn.jsdelivr.net/npm/vue@2.6.12"></script>
</head>
 
<body>
    <div id="popup">
        <!-- 从layui传值给iframe 的占位input -->
        <input type="text" id="user" ref="user" style="display:none">
        46476978--
        -{{ourData.title}}
    </div>
    <script>
        var me = new Vue({
            el: '#popup',
            data: {
                ourData: '',
                oldtime: '',
            },
            mounted() {
                this.oldtime = setTimeout(() => {//需要同步数据处理,input中value在mounted中没有直接传值
                    clearTimeout(this.oldtime);
                    this.ourData = JSON.parse(this.$refs.user.value);//json对象转js对象
                    console.log(this.ourData,2)
                }, 100);
            }
        })
 
    </script>
</body>
 
</html>