Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function dealWithPage(evt, window, value) {
const type = evt.type
let url = evt.url
if (value === 'webview') {
// 补全 url
url = mp.$$adapter.tool.completeURL(url, window.location.origin)
const options = {url: `/pages/webview/index?url=${encodeURIComponent(url)}`}
if (type === 'jump') wx.redirectTo(options)
else if (type === 'open') wx.navigateTo(options)
} else if (value === 'error') {
console.error(`page not found: ${evt.url}`)
} else if (value !== 'none') {
const targeturl = `${window.location.origin}/redirect?url=${encodeURIComponent(url)}`
const options = {url: `/pages/${value}/index?type=${type}&targeturl=${encodeURIComponent(targeturl)}`}
if (window.$$miniprogram.isTabBarPage(`/pages/${value}/index`)) wx.switchTab(options)
else if (type === 'jump') wx.redirectTo(options)
else if (type === 'open') wx.navigateTo(options)
}
}
const mp = require('miniprogram-render')
const _ = require('./tool')
const component = require('./component')
const {
Event,
} = mp.$$adapter
const {
WX_COMP_NAME_MAP,
NOT_SUPPORT,
} = _
module.exports = {
/**
* 初始化
*/
init(data) {
const domNode = this.domNode
const tagName = domNode.tagName
if (tagName === 'WX-COMPONENT') {
// 无可替换 html 标签
data.wxCompName = domNode.$$behavior
const mp = require('miniprogram-render')
const _ = require('./util/tool')
const initHandle = require('./util/init-handle')
const component = require('./util/component')
const {
cache,
EventTarget,
tool,
} = mp.$$adapter
const {
NOT_SUPPORT,
} = _
const {
wxCompNameMap,
} = component
// dom 子树作为自定义组件渲染的层级数
const MAX_DOM_SUB_TREE_LEVEL = 10
let DOM_SUB_TREE_LEVEL = 10
Component({
properties: {
inCover: {
type: Boolean,
value: false,
const mp = require('miniprogram-render')
const _ = require('./util/tool')
const initHandle = require('./util/init-handle')
const {
cache,
EventTarget,
tool,
} = mp.$$adapter
const {
WX_COMP_NAME_MAP,
NOT_SUPPORT,
} = _
// dom 子树作为自定义组件渲染的层级数
const MAX_DOM_SUB_TREE_LEVEL = 10
let DOM_SUB_TREE_LEVEL = 10
Component({
properties: {
inCover: {
type: Boolean,
value: false,
},
},
const mp = require('miniprogram-render')
const _ = require('./util/tool')
const initHandle = require('./util/init-handle')
const {
cache,
EventTarget,
tool,
} = mp.$$adapter
const {
WX_COMP_NAME_MAP,
NOT_SUPPORT,
} = _
// dom 子树作为自定义组件渲染的层级数
const MAX_DOM_SUB_TREE_LEVEL = 10
let DOM_SUB_TREE_LEVEL = 10
Component({
properties: {
inCover: {
type: Boolean,
value: false,
},
},
const mp = require('miniprogram-render')
const _ = require('./tool')
const component = require('./component')
const {
Event,
} = mp.$$adapter
const {
NOT_SUPPORT,
} = _
const {
wxCompNameMap,
handles,
} = component
module.exports = {
/**
* 初始化
*/
init(data) {
const domNode = this.domNode
const tagName = domNode.tagName
const mp = require('miniprogram-render')
const {
cache,
} = mp.$$adapter
/**
* https://developers.weixin.qq.com/miniprogram/dev/component/input.html
*/
module.exports = {
properties: [{
name: 'value',
get(domNode) {
return domNode.value || ''
},
}, {
name: 'type',
get(domNode) {
const value = domNode.type || 'text'
return value !== 'password' ? value : 'text'
},
const mp = require('miniprogram-render')
const {
cache,
tool,
} = mp.$$adapter
/**
* https://developers.weixin.qq.com/miniprogram/dev/component/image.html
*/
module.exports = {
properties: [{
name: 'renderingMode',
get(domNode) {
return domNode.getAttribute('rendering-mode') || ''
},
}, {
name: 'src',
get(domNode) {
const window = cache.getWindow(domNode.$$pageId)
return domNode.src ? tool.completeURL(domNode.src, window.location.origin, true) : ''
},
const mp = require('miniprogram-render')
const {
cache,
tool,
} = mp.$$adapter
/**
* https://developers.weixin.qq.com/miniprogram/dev/component/cover-image.html
*/
module.exports = {
properties: [{
name: 'src',
get(domNode) {
const window = cache.getWindow(domNode.$$pageId)
return domNode.src ? tool.completeURL(domNode.src, window.location.origin, true) : ''
},
}],
handles: {
onCoverImageLoad(evt) {
this.callSimpleEvent('load', evt)
},
const mp = require('miniprogram-render');
const {
cache,
tool,
} = mp.$$adapter;
/**
* https://developers.weixin.qq.com/miniprogram/dev/component/image.html
*/
export default {
PROPS: [{
name: 'renderingMode',
get(domNode) {
return domNode.getAttribute('rendering-mode') || '';
},
}, {
name: 'src',
get(domNode) {
const window = cache.getWindow(domNode.$$pageId);
return domNode.src ? tool.completeURL(domNode.src, window.location.origin, true) : '';
},