How to use the @tarojs/shared.Shortcuts.NodeName function in @tarojs/shared

To help you get started, we’ve selected a few @tarojs/shared examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github NervJS / taro / packages / taro-runtime / src / render.ts View on Github external
export function hydrate (node: TaroElement | TaroText): MiniData {
  if (isText(node)) {
    return {
      [Shortcuts.Text]: node.nodeValue,
      [Shortcuts.NodeName]: node.nodeName
    }
  }

  const data: MiniData = {
    ...node.props,
    [Shortcuts.Childnodes]: node.childNodes.map(hydrate),
    [Shortcuts.NodeName]: node.nodeName,
    uid: node.uid
  }

  if (node.className) {
    data[Shortcuts.Class] = node.className
  }

  if (node.cssText) {
    data[Shortcuts.Style] = node.cssText
github NervJS / taro / packages / taro-mini-runner / src / template / index.ts View on Github external
function buildContainerTemplate (level: number, restart = false) {
  let tmpl = ''
  if (restart) {
    tmpl = ''
  } else {
    tmpl = `<template is="">`
  }
  return `
<template name="tmpl_${level}_${Shortcuts.Container}">
  ${tmpl}
</template>
`
}
</template>
github NervJS / taro / packages / taro-runtime / src / dsl / common.ts View on Github external
export function createComponentConfig () {
  return {
    properties: {
      i: {
        type: Object,
        value: {
          [Shortcuts.NodeName]: 'view'
        }
      }
    },
    options: {
      addGlobalClass: true
    },
    methods: {
      eh: eventHandler
    }
  }
}