w-component-vue
Version:
A simple component for vue(vue2).
324 lines (302 loc) • 9.51 kB
HTML
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh-tw">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, minimal-ui"
/>
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>w-component-vue</title>
<!-- @babel/polyfill -->
<script
nomodule
src="https://cdn.jsdelivr.net/npm/@babel/polyfill/dist/polyfill.min.js"
></script>
<!-- vue -->
<script src="https://cdn.jsdelivr.net/npm/vue@2.x/dist/vue.min.js"></script>
<!-- extractHtml已自動添加@babel/polyfill與vue -->
<!-- vuetify -->
<link
href="https://cdn.jsdelivr.net/npm/vuetify@2.6.14/dist/vuetify.min.css"
rel="stylesheet"
/>
<script
src="https://cdn.jsdelivr.net/npm/vuetify@2.6.14/dist/vuetify.min.js"
></script>
<!-- fontawesome -->
<link
href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.4.2/css/all.min.css"
rel="stylesheet"
/>
<!-- mdi, 各組件使用mdi/js會於轉單頁時改為mdi icon, 故需引用mdi/css -->
<link
href="https://cdn.jsdelivr.net/npm/@mdi/font@7.4.47/css/materialdesignicons.min.css"
rel="stylesheet"
/>
<!-- google, 各組件使用mdi/js故不需引用 -->
<link
_href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900"
rel="stylesheet"
/>
<link
_href="https://fonts.googleapis.com/css?family=Material+Icons"
rel="stylesheet"
/>
<!-- data -->
<script
src="https://cdn.jsdelivr.net/npm/w-demores@1.0.27/res/data/dataAAPL.js"
></script>
<script
src="https://cdn.jsdelivr.net/npm/w-demores@1.0.27/res/data/dataUSD2EUR.js"
></script>
<script
src="https://cdn.jsdelivr.net/npm/w-demores@1.0.27/res/data/dataTemperature.js"
></script>
<script
src="https://cdn.jsdelivr.net/npm/w-demores@1.0.27/res/data/dataHousePriceArea.js"
></script>
<script
src="https://cdn.jsdelivr.net/npm/w-demores@1.0.27/res/data/dataFlare.js"
></script>
<script
src="https://cdn.jsdelivr.net/npm/w-demores@1.0.27/res/data/dataRain.js"
></script>
<script
src="https://cdn.jsdelivr.net/npm/w-demores@1.0.27/res/data/dataRainClip.js"
></script>
<script
src="https://cdn.jsdelivr.net/npm/w-demores@1.0.27/res/data/dataCivilSoilCodeIcon.js"
></script>
<!-- w-component-vue -->
<script src="https://cdn.jsdelivr.net/npm/w-component-vue@2.4.27/dist/w-component-vue.umd.js"></script>
<style>
.v-application--wrap {
/* width與max-width fix for IE11, 其外不能使用padding或margin避免失效 */
width: 100svw;
max-width: 100svw;
font-family: inherit;
background: #fff;
}
/* 組件所須全域樣式 */
.item {
/* 因item位於demolink, 提取各範例html後會刪除demolink, 故得額外補上 */
border-left: 3px solid #ffba75;
margin: 5px 5px 8px 0px;
padding: 3px 3px 5px 10px;
font-size: 0.9rem;
display: flex;
justify-content: flex-start;
align-items: center;
}
.head1 {
padding: 0px 0px 20px 0px;
font-size: 2.5rem;
}
.bkh {
/* 寬 */
padding: 20px;
}
@media screen and (max-width: 800px) {
/* 中 */
.bkh {
padding: 10px;
}
}
@media screen and (max-width: 400px) {
/* 窄 */
.bkh {
padding: 5px;
}
}
.bk {
/* 寬 */
display: inline-block;
vertical-align: top;
padding: 0px 80px 60px 0px;
}
@media screen and (max-width: 1000px) {
/* 中窄 */
.bk {
display: block;
padding: 0px 0px 50px 0px;
}
}
.cpitem {
transition: all 0.3s;
padding: 5px 15px;
cursor: pointer;
}
.cpitem-white {
background: #fff;
}
.cpitem-white:hover {
background: #eee;
}
.cpitem-black {
background: #333;
}
.cpitem-black:hover {
background: #555;
}
</style>
</head>
<body
style="font-family:'Microsoft JhengHei','Avenir','Helvetica'; padding:0px; margin:0px;"
>
<v-app id="app" class="bkh" style="font-family:inherit;">
<div class="head1">
<span
style="cursor:pointer;"
title="open for copy link to view component"
onclick="window.open('//yuda-lyu.github.io/w-component-vue/examples/app.html?cmp='+this.innerText,'_blank')"
>w-dialog</span>
</div>
<div class="bk">
<div class="item">slot content (separate line)</div>
<v-btn
depressed
small
elevation="2"
@click="WDialog.bShow23=!WDialog.bShow23"
>Show({{WDialog.bShow23}})</v-btn>
<w-dialog
:show.sync="WDialog.bShow23"
:title="WDialog.title"
@resize="resizeEvent"
@click-save="clickSave"
@click-close="clickClose"
>
<template v-slot:content>
<div style="padding:20px;">
<div
style="font-size:2rem; margin:20px 0px 30px 0px;"
>{{WDialog.text1}}</div>
<div>{{WDialog.text2}}</div>
</div>
<div style="border-top:1px solid #ddd;"></div>
<div style="padding:20px;">
<div style="margin-bottom:15px;">{{WDialog.text3}}</div>
<div>{{WDialog.text4}}</div>
</div>
</template>
</w-dialog>
</div>
</v-app>
<script>
//install
Vue.use(window["w-component-vue"]);
//initialize
new Vue({
el: "#app",
vuetify: new Vuetify(),
data: function() {
return {
WDialog: {
bShow01: false,
bShow02: false,
bShow03: false,
bShow04a: false,
bShow04b: false, //fullscreen
bShow05: false,
bShow06: false,
bShow07: false,
bShow08: false,
bShow09: false,
bShow10: false,
bShow11: false,
bShow12: false,
bShow13: false,
bShow14: false,
bShow15: false,
bShow16: false,
bShow17: false,
bShow18a: false,
bShow18b: true, //fullscreen
bShow19: false,
bShow20: false,
bShow21: false,
bShow22: false,
bShow23: false,
bShow24: false,
bShow25: false,
iShow24: 0,
bShow26a: false,
bShow26b: false,
bShow26c: false,
bShow27: false,
headerBtns: [
{
icon: "fas fa-book-reader",
tooltip: "測試book-reader",
evName: "bookReader",
iconColor: "#f26",
backgroundColor: "rgba(255,255,255,0.7)"
},
{
icon: "fab fa-codepen",
tooltip: "測試codepen",
evName: "codepen"
},
{
icon: "fab fa-docker",
tooltip: "測試docker",
evName: "docker"
}
],
title: "Popup Dialog",
text1: "Article Title",
text2: "Here is an article content, texts are from Vuetify.",
text3:
"Vuetify is a progressive framework that attempts to push web development to the next level. In order to best accomplish this task, some sacrifices had to be made in terms of support for older versions of Internet Explorer. This is not an exhaustive list of compatible browsers, but the main targeted ones.",
text4:
"There are three ways in which you can install Vuetify. The first (and recommended) way is to utilize the vuetify-loader or what we call automatic A-la-carte. This will ensure that your application only uses the features and styles from Vuetify that are needed, significantly reducing your application's compiled size. Keep in mind, when importing from vuetify/lib, the necessary styles are automatically imported for you.",
text5: "End."
},
actions: []
};
},
mounted: function() {
return {};
},
computed: {},
methods: {
resizeEvent: function(msg) {
console.log("resizeEvent", msg);
},
clickBtns: function(msg) {
console.log("clickBtns", msg);
},
clickSave: function(msg) {
console.log("clickSave", msg);
setTimeout(function() {
console.log("save finish");
msg.pm.resolve();
}, 1000);
},
clickClose: function(msg) {
console.log("clickClose", msg);
},
clickClosePm: function(msg) {
console.log("clickClose", msg);
alert("pm.resolve() for close");
msg.pm.resolve();
//msg.pm.reject()
},
delayClose: function() {
console.log("delayClose");
let vo = this;
vo.WDialog.iShow24 = 5;
let t = setInterval(() => {
vo.WDialog.iShow24 -= 1;
if (vo.WDialog.iShow24 <= 0) {
clearInterval(t);
vo.WDialog.bShow25 = false;
}
}, 1000);
}
}
});
</script>
</body>
</html>