fix #4
This commit is contained in:
parent
dcc114a579
commit
8dbc1dab67
33
public/assets/js/app.js
Normal file
33
public/assets/js/app.js
Normal file
@ -0,0 +1,33 @@
|
||||
$(document).ready(function () {
|
||||
$(document).on('click', '.has-sub', function () {
|
||||
var _this = $(this)
|
||||
if (!$(this).hasClass('expanded')) {
|
||||
setTimeout(function () {
|
||||
_this.find('ul').attr("style", "")
|
||||
}, 300);
|
||||
|
||||
} else {
|
||||
$('.has-sub ul').each(function (id, ele) {
|
||||
var _that = $(this)
|
||||
if (_this.find('ul')[0] != ele) {
|
||||
setTimeout(function () {
|
||||
_that.attr("style", "")
|
||||
}, 300);
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
$('.user-info-menu .hidden-sm').click(function () {
|
||||
if ($('.sidebar-menu').hasClass('collapsed')) {
|
||||
$('.has-sub.expanded > ul').attr("style", "")
|
||||
} else {
|
||||
$('.has-sub.expanded > ul').show()
|
||||
}
|
||||
})
|
||||
$("#main-menu li ul li").click(function () {
|
||||
$(this).siblings('li').removeClass('active'); // 删除其他兄弟元素的样式
|
||||
$(this).addClass('active'); // 添加当前元素的样式
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
@ -1,12 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="author" content="viggo" />
|
||||
<title>WebStack.cc - 设计师网址导航</title>
|
||||
<meta name="keywords" content="UI设计,UI设计素材,设计导航,网址导航,设计资源,创意导航,创意网站导航,设计师网址大全,设计素材大全,设计师导航,UI设计资源,优秀UI设计欣赏,设计师导航,设计师网址大全,设计师网址导航,产品经理网址导航,交互设计师网址导航,www.webstack.cc">
|
||||
<meta name="keywords"
|
||||
content="UI设计,UI设计素材,设计导航,网址导航,设计资源,创意导航,创意网站导航,设计师网址大全,设计素材大全,设计师导航,UI设计资源,优秀UI设计欣赏,设计师导航,设计师网址大全,设计师网址导航,产品经理网址导航,交互设计师网址导航,www.webstack.cc">
|
||||
<meta name="description" content="WebStack - 收集国内外优秀设计网站、UI设计资源网站、灵感创意网站、素材资源网站,定时更新分享优质产品设计书签。www.webstack.cc">
|
||||
<link rel="shortcut icon" href="favicon.png">
|
||||
|
||||
@ -19,21 +21,22 @@
|
||||
<meta property="og:type" content="article">
|
||||
<meta property="og:url" content="http://www.webstack.cc/">
|
||||
<meta property="og:title" content="WebStack - 收集国内外优秀设计网站、UI设计资源网站、灵感创意网站、素材资源网站,定时更新分享优质产品设计书签。www.webstack.cc">
|
||||
<meta property="og:description" content="UI设计,UI设计素材,设计导航,网址导航,设计资源,创意导航,创意网站导航,设计师网址大全,设计素材大全,设计师导航,UI设计资源,优秀UI设计欣赏,设计师导航,设计师网址大全,设计师网址导航,产品经理网址导航,交互设计师网址导航,www.webstack.cc">
|
||||
<meta property="og:description"
|
||||
content="UI设计,UI设计素材,设计导航,网址导航,设计资源,创意导航,创意网站导航,设计师网址大全,设计素材大全,设计师导航,UI设计资源,优秀UI设计欣赏,设计师导航,设计师网址大全,设计师网址导航,产品经理网址导航,交互设计师网址导航,www.webstack.cc">
|
||||
<meta property="og:image" content="http://webstack.cc/assets/images/webstack_banner_cn.png">
|
||||
<meta property="og:site_name" content="WebStack - 收集国内外优秀设计网站、UI设计资源网站、灵感创意网站、素材资源网站,定时更新分享优质产品设计书签。www.webstack.cc">
|
||||
<!-- / Twitter Cards -->
|
||||
<meta name="twitter:card" content="summary_large_image">
|
||||
<meta name="twitter:title" content="WebStack - 收集国内外优秀设计网站、UI设计资源网站、灵感创意网站、素材资源网站,定时更新分享优质产品设计书签。www.webstack.cc">
|
||||
<meta name="twitter:description" content="UI设计,UI设计素材,设计导航,网址导航,设计资源,创意导航,创意网站导航,设计师网址大全,设计素材大全,设计师导航,UI设计资源,优秀UI设计欣赏,设计师导航,设计师网址大全,设计师网址导航,产品经理网址导航,交互设计师网址导航,www.webstack.cc">
|
||||
<meta name="twitter:description"
|
||||
content="UI设计,UI设计素材,设计导航,网址导航,设计资源,创意导航,创意网站导航,设计师网址大全,设计素材大全,设计师导航,UI设计资源,优秀UI设计欣赏,设计师导航,设计师网址大全,设计师网址导航,产品经理网址导航,交互设计师网址导航,www.webstack.cc">
|
||||
<meta name="twitter:image" content="http://www.webstack.cc/assets/images/webstack_banner_cn.png">
|
||||
</head>
|
||||
|
||||
<body class="page-body">
|
||||
<div id="app"></div>
|
||||
<!-- built files will be auto injected -->
|
||||
|
||||
<script src="./assets/js/jquery-1.11.1.min.js"></script>
|
||||
<!-- <script src="./assets/js/jquery-1.11.1.min.js"></script>
|
||||
<script src="./assets/js/bootstrap.min.js"></script>
|
||||
<script src="./assets/js/TweenMax.min.js"></script>
|
||||
<script src="./assets/js/resizeable.js"></script>
|
||||
@ -41,41 +44,7 @@
|
||||
<script src="./assets/js/xenon-api.js"></script>
|
||||
<script src="./assets/js/xenon-toggles.js"></script>
|
||||
<script src="./assets/js/xenon-custom.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
Vue.nextTick(() => {
|
||||
$(document).on('click', '.has-sub', function(){
|
||||
var _this = $(this)
|
||||
if(!$(this).hasClass('expanded')) {
|
||||
setTimeout(function(){
|
||||
_this.find('ul').attr("style","")
|
||||
}, 300);
|
||||
} else {
|
||||
$('.has-sub ul').each(function(id,ele){
|
||||
var _that = $(this)
|
||||
if(_this.find('ul')[0] != ele) {
|
||||
setTimeout(function(){
|
||||
_that.attr("style","")
|
||||
}, 300);
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
$('.user-info-menu .hidden-sm').click(function(){
|
||||
if($('.sidebar-menu').hasClass('collapsed')) {
|
||||
$('.has-sub.expanded > ul').attr("style","")
|
||||
} else {
|
||||
$('.has-sub.expanded > ul').show()
|
||||
}
|
||||
})
|
||||
|
||||
$("#main-menu li ul li").click(function() {
|
||||
$(this).siblings('li').removeClass('active'); // 删除其他兄弟元素的样式
|
||||
$(this).addClass('active'); // 添加当前元素的样式
|
||||
});
|
||||
})
|
||||
</script>
|
||||
<script src="./assets/js/app.js"></script> -->
|
||||
</body>
|
||||
|
||||
</html>
|
32
src/assets/js/app.js
Normal file
32
src/assets/js/app.js
Normal file
@ -0,0 +1,32 @@
|
||||
export function loadJs() {
|
||||
const jsArr = [
|
||||
{ id: "js-1", src: "./assets/js/jquery-1.11.1.min.js" },
|
||||
{ id: "js-2", src: "./assets/js/bootstrap.min.js" },
|
||||
{ id: "js-3", src: "./assets/js/TweenMax.min.js" },
|
||||
{ id: "js-4", src: "./assets/js/resizeable.js" },
|
||||
{ id: "js-5", src: "./assets/js/joinable.js" },
|
||||
{ id: "js-6", src: "./assets/js/xenon-api.js" },
|
||||
{ id: "js-7", src: "./assets/js/xenon-toggles.js" },
|
||||
{ id: "js-8", src: "./assets/js/xenon-custom.js" },
|
||||
{ id: "js-9", src: "./assets/js/app.js" },
|
||||
];
|
||||
const srcArr = document.getElementsByTagName("script");
|
||||
for (let i = 0; i < srcArr.length; i++) {
|
||||
for (let j = 0; j < jsArr.length; j++) {
|
||||
// console.log(`srcArr[${i}]`, srcArr[i]);
|
||||
// console.log(`jsArr[${j}]`, jsArr[j]);
|
||||
if (srcArr[i].id == jsArr[j].id) {
|
||||
srcArr[i].remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const body = document.getElementsByTagName('body')[0];
|
||||
for (let i = 0; i < jsArr.length; i++) {
|
||||
const script = document.createElement("script");
|
||||
script.src = jsArr[i].src;
|
||||
script.id = jsArr[i].id;
|
||||
script.defer = true;
|
||||
body.append(script);
|
||||
}
|
||||
}
|
@ -11,6 +11,7 @@ import './assets/css/xenon-core.css'
|
||||
import './assets/css/xenon-components.css'
|
||||
import './assets/css/xenon-skins.css'
|
||||
import './assets/css/nav.css'
|
||||
import { loadJs } from './assets/js/app.js'
|
||||
|
||||
Vue.config.productionTip = false
|
||||
Vue.use(VueRouter)
|
||||
@ -25,6 +26,13 @@ const router = new VueRouter({
|
||||
mode: 'history'
|
||||
})
|
||||
|
||||
router.afterEach((to, from, next) => {
|
||||
console.log("to => ", to, "from => ", from, "next => ", next);
|
||||
if (to.path == '/' && to.hash == '') {
|
||||
loadJs();
|
||||
}
|
||||
})
|
||||
|
||||
new Vue({
|
||||
render: h => h(App),
|
||||
router
|
||||
|
@ -9,7 +9,11 @@
|
||||
<img src="../assets/images/logo@2x.png" width="100%" alt="" />
|
||||
</a>
|
||||
<a href="#" class="logo-collapsed">
|
||||
<img src="../assets/images/logo-collapsed@2x.png" width="40" alt="" />
|
||||
<img
|
||||
src="../assets/images/logo-collapsed@2x.png"
|
||||
width="40"
|
||||
alt=""
|
||||
/>
|
||||
</a>
|
||||
</div>
|
||||
<div class="mobile-menu-toggle visible-xs">
|
||||
@ -24,15 +28,19 @@
|
||||
<!-- 侧边栏 -->
|
||||
<ul id="main-menu" class="main-menu">
|
||||
<li v-for="(menu, idx) in items" :key="idx">
|
||||
<a :href="'#'+transName(menu)" class="smooth" @click="moveSlow">
|
||||
<a :href="'#' + transName(menu)" class="smooth">
|
||||
<i :class="menu.icon"></i>
|
||||
<span class="title">{{ transName(menu) }}</span>
|
||||
</a>
|
||||
<ul v-if="menu.children">
|
||||
<li v-for="(submenu, idx) in menu.children" :key="idx">
|
||||
<a :href="'#'+transName(submenu)" class="smooth" @click="moveSlow">
|
||||
<a :href="'#' + transName(submenu)" class="smooth">
|
||||
<span class="title">{{ transName(submenu) }}</span>
|
||||
<span v-show="submenu.is_hot" class="label label-pink pull-right hidden-collapsed">Hot</span>
|
||||
<span
|
||||
v-show="submenu.is_hot"
|
||||
class="label label-pink pull-right hidden-collapsed"
|
||||
>Hot</span
|
||||
>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
@ -42,7 +50,9 @@
|
||||
<router-link to="/about">
|
||||
<i class="linecons-heart"></i>
|
||||
<span class="tooltip-blue">关于本站</span>
|
||||
<span class="label label-Primary pull-right hidden-collapsed">♥︎</span>
|
||||
<span class="label label-Primary pull-right hidden-collapsed"
|
||||
>♥︎</span
|
||||
>
|
||||
</router-link>
|
||||
</li>
|
||||
</ul>
|
||||
@ -60,7 +70,11 @@
|
||||
<img :src="lang.flag" /> {{ lang.name }}
|
||||
</a>
|
||||
<ul class="dropdown-menu languages">
|
||||
<li :class="{active: langItem.key === lang.key}" v-for="langItem in langList" :key="langItem.key">
|
||||
<li
|
||||
:class="{ active: langItem.key === lang.key }"
|
||||
v-for="langItem in langList"
|
||||
:key="langItem.key"
|
||||
>
|
||||
<a href="#" @click="lang = langItem">
|
||||
<img :src="langItem.flag" /> {{ langItem.name }}
|
||||
</a>
|
||||
@ -92,38 +106,45 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import WebItem from '../components/WebItem.vue'
|
||||
import Footer from '../components/Footer.vue'
|
||||
import itemsData from '../assets/data.json'
|
||||
import WebItem from "../components/WebItem.vue";
|
||||
import Footer from "../components/Footer.vue";
|
||||
import itemsData from "../assets/data.json";
|
||||
// import { loadJs } from '../assets/js/app.js'
|
||||
|
||||
export default {
|
||||
name: 'Index',
|
||||
name: "Index",
|
||||
components: {
|
||||
WebItem,
|
||||
Footer
|
||||
Footer,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
items: itemsData,
|
||||
lang: {},
|
||||
langList: [
|
||||
{key: 'zh', name: '简体中文', flag: './assets/images/flags/flag-cn.png'},
|
||||
{key: 'en', name: 'English', flag: './assets/images/flags/flag-us.png'}
|
||||
]
|
||||
}
|
||||
{
|
||||
key: "zh",
|
||||
name: "简体中文",
|
||||
flag: "./assets/images/flags/flag-cn.png",
|
||||
},
|
||||
{
|
||||
key: "en",
|
||||
name: "English",
|
||||
flag: "./assets/images/flags/flag-us.png",
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.lang = this.langList[0]
|
||||
this.lang = this.langList[0];
|
||||
// loadJs();
|
||||
},
|
||||
methods: {
|
||||
transName(webItem) {
|
||||
return this.lang.key === 'en' ? webItem.en_name : webItem.name;
|
||||
return this.lang.key === "en" ? webItem.en_name : webItem.name;
|
||||
},
|
||||
moveSlow() {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
Loading…
Reference in New Issue
Block a user