const { ccclass, property } = cc._decorator; /** * 服务协议,隐私协议 * @author 邹勇 */ @ccclass export default class Rule extends cc.Component { @property({ type: cc.ScrollView, displayName: "滚动条" }) scrollView: cc.ScrollView = null; @property({ type: cc.Label, displayName: "内容" }) lbl_content: cc.Label = null; @property({ type: cc.Button, displayName: "关闭" }) btn_close: cc.Button = null; onLoad() { } /** * * @param type 0服务协议 1隐私协议 */ public setContent(type: string = "0") { let arr = type == "0" ? gData.loginData.rule_data : gData.loginData.privacy_data; let str = ""; for (let i = 0; i < arr.length; i++) { str += arr[i] + "\n"; } this.lbl_content.string = str; this.scrollView.scrollToTop(); } private close() { this.node.active = false; } }