//
//  GMCommomWebController.swift
//  Gengmei
//
//  Created by Terminator on 2017/11/10.
//  Copyright © 2017年 更美互动信息科技有限公司. All rights reserved.
//

import UIKit

class GMCommomWebController: WMBaseViewController {

    var fullUrl = ""
    var path = ""
    let webComp = GMWebViewComponent()
    
    override func viewDidLoad() {
        super.viewDidLoad()

        setupComponent()
    }
    
    func setupComponent() {
        webComp.webviewLoad(self)
        self.view.addSubview(webComp)
        if fullUrl.isNonEmpty() {
            webComp.fullUrl = fullUrl
        } else if path.isNonEmpty() {
            webComp.path = path
        }
        webComp.snp.makeConstraints { (make) in
            make.top.equalTo(navigationBar.snp.bottom)
            make.left.right.bottom.equalTo(0)
        }
    }
    
    deinit {
        //webCimponet deinit 没有注销，因此写在这里
        webComp.removeWebView()
    }

}

extension GMCommomWebController: WKWebViewDelegate {
    
    func globalPageData(_ data: NSDictionary) {
        //处理h5全局变量
    }
}
