提交 b5c220a8 编写于 作者: D DCloud_LXH

update: siderbar-link 可折叠

上级 47b965bc
...@@ -55,7 +55,14 @@ export default { ...@@ -55,7 +55,14 @@ export default {
} }
} }
let beforeActiveLinkText = ''
function renderLink (h, to, text, active, level, headers) { function renderLink (h, to, text, active, level, headers) {
let VNode
let firstRender
if(headers && active){
firstRender = beforeActiveLinkText !== text
beforeActiveLinkText = text
}
const component = { const component = {
props: { props: {
to, to,
...@@ -66,6 +73,16 @@ function renderLink (h, to, text, active, level, headers) { ...@@ -66,6 +73,16 @@ function renderLink (h, to, text, active, level, headers) {
active, active,
'sidebar-link': true, 'sidebar-link': true,
'data-no-emphasize': headers && headers.some(item => item.level < 3) 'data-no-emphasize': headers && headers.some(item => item.level < 3)
},
nativeOn: {
click: (e) => {
if (firstRender) { firstRender = false; return; }
if (e.target.className.indexOf('data-no-emphasize') === -1) return;
const child = VNode.componentOptions.children[0].elm.parentElement.nextElementSibling
if(!child) return
const originDisplay = child.style.display
child.style.display = originDisplay === 'none' ? 'block' : 'none'
}
} }
} }
...@@ -74,8 +91,8 @@ function renderLink (h, to, text, active, level, headers) { ...@@ -74,8 +91,8 @@ function renderLink (h, to, text, active, level, headers) {
'padding-left': level + 'rem' 'padding-left': level + 'rem'
} }
} }
VNode = h('RouterLink', component, text)
return h('RouterLink', component, text) return VNode
} }
function renderChildren (h, children, path, route, maxDepth, depth = 1) { function renderChildren (h, children, path, route, maxDepth, depth = 1) {
......
...@@ -2,7 +2,7 @@ App端支付模块封装了市场上主流的三方支付平台SDK,提供JS AP ...@@ -2,7 +2,7 @@ App端支付模块封装了市场上主流的三方支付平台SDK,提供JS AP
|项目类型|API| |项目类型|API|
|:-|:-| |:-|:-|
|uni-app|[uni.requestPayment(OBJECT)](api/plugins/payment?id=requestpayment)| |uni-app|[uni.requestPayment(OBJECT)](/api/plugins/payment?id=requestpayment)|
|5+ App/Wap2App|[plus.payment.*](https://www.html5plus.org/doc/zh_cn/payment.html) |5+ App/Wap2App|[plus.payment.*](https://www.html5plus.org/doc/zh_cn/payment.html)
如果服务端使用[uniCloud](https://uniapp.dcloud.io/uniCloud/README),官方提供了[uniPay](https://uniapp.dcloud.io/uniCloud/unipay)云端统一支付服务,极大提升支付业务的开发效率,强烈推荐给开发者使用,参考示例:[https://ext.dcloud.net.cn/plugin?id=1835](https://ext.dcloud.net.cn/plugin?id=1835) 如果服务端使用[uniCloud](https://uniapp.dcloud.io/uniCloud/README),官方提供了[uniPay](https://uniapp.dcloud.io/uniCloud/unipay)云端统一支付服务,极大提升支付业务的开发效率,强烈推荐给开发者使用,参考示例:[https://ext.dcloud.net.cn/plugin?id=1835](https://ext.dcloud.net.cn/plugin?id=1835)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册