Skip to content

Instantly share code, notes, and snippets.

@movii
movii / index.html
Last active June 27, 2017 16:07
Vue.js Dynamically Compile <router-link />: 4. another demo - 3 html structure
<div id="app">
<router-link to="/bar">Go to Bar</router-link>
<dynamic-link :text="text"></dynamic-link>
<router-view></router-view>
</div>
@movii
movii / 1.index.html
Last active July 11, 2017 12:22
笔记:前端开发中的「居中」,绝对定位,transform 和 flex 布局:1. html structure
<!--
HTML 结构:
1. div.box 作为外层居中容器
2. div.content 作为内部居中对象
-->
<div class="box">
<div class="content">
content
</div>
</div>
@movii
movii / common.css
Created June 24, 2017 05:58
笔记:前端开发中的「居中」,绝对定位,transform 和 flex 布局:4. 相对绝对定位
/* center by traditional relative/absolute position */
/* parent */
.box.box_centerByAbsolute {
position: relative;
}
/* child */
.box.box_centerByAbsolute .content {
position: absolute;
top: 0;
@movii
movii / common.css
Created June 24, 2017 06:04
笔记:前端开发中的「居中」,绝对定位,transform 和 flex 布局:5. CSS 中的 transform 属性
.box.box_centerByFlex {
display: flex;
justify-content: center;
align-items: center;
}
.box.box_centerByFlex .content {
align-self: center;
}
@movii
movii / common.css
Last active July 11, 2017 13:59
笔记:前端开发中的「居中」,绝对定位,transform 和 flex 布局:6. 通过 flex 布局
.box.box_centerByFlex {
display: flex;
}
.box.box_centerByFlex .content {
margin: auto;
}
@movii
movii / ViewController.swift
Last active June 26, 2018 09:47
笔记:iOS 与 JavaScript 的交互(一):UIWebView - 1. 加载在线网页
let urlString = "https://www.apple.com/cn"
let url = URL(string: urlString)!
let requestURL = URLRequest(url: url)
webview.loadRequest(requestURL)
@movii
movii / ViewController.swift
Created June 27, 2017 01:35
笔记:iOS 与 JavaScript 的交互(一):UIWebView - 2. 加载本地网页
let filePathString = "html/index"
let path = Bundle.main.path(forResource: filePathString, ofType: "html")
let url = URL(fileURLWithPath: Path)!
let requestUrl = URLRequest(url: url)
webview.loadRequest(requestURL)
@movii
movii / ViewController.swift
Created June 27, 2017 01:38
笔记:iOS 与 JavaScript 的交互(一):UIWebView - 2.1 直接使用 string​By​Evaluating​Java​Script(from:​)
func webViewDidStartLoad(_ webView: UIWebView) {
let jsString = "alert('UIWebView Start Loading from local file')"
webviewBrowser.stringByEvaluatingJavaScript(from: jsString)
}
@movii
movii / 1.mian.js
Last active June 27, 2018 03:41
笔记:iOS 与 JavaScript 的交互(一):UIWebView - 2.1 native 对 JavaScript 的基本调用和获取返回值
// 直接 alert
function sayHello () { alert('hello') }
// alert with parameter
function sayHelloTo(name) { alert(`Hello ${name}`) }
// alert with parameter & return value
function sayHelloWithRtnValue (name) { return `hello ${name}` }
@movii
movii / ViewController.swift
Created June 27, 2017 02:03
笔记:iOS 与 JavaScript 的交互(一):UIWebView - 2.1 UIWebViewDelegate
extension ViewController: UIWebViewDelegate {
let jsString = "alert('UIWebView Loading from local file')"
webviewBrowser.stringByEvaluatingJavaScript(from: jsString)
}