Socket
Socket
Sign inDemoInstall

miniprogram-loader

Package Overview
Dependencies
5
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    miniprogram-loader

Mini Program single-file component loader for Webpack


Version published
Maintainers
1
Install size
269 kB
Created

Readme

Source

miniprogram-loader

Mini Program single-file component loader for Webpack

Install

npm install miniprogram-loader --save-dev

Usage (e.g wechat)

webpack.config.js

module.exports = {
  module: {
    rules: [
      {
        test: /\.kico$/,
        loader: 'miniprogram-loader',
        options: {
          htmlExt: 'wxml',
          cssExt: 'wxss',
          jsExt: 'js'
        }
      }
    ]
  }
}

single-file component

<template lang="pug">
  view.container
    view.userinfo
      button(wx:if="{{!hasUserInfo}}" open-type="getUserInfo") 获取头像昵称
      block(wx:else)
        text.userinfo-nickname {{userInfo.nickName}}
    view.usermotto
      text.user-motto {{motto}}
</template>

<script>
const app = getApp()

Page({
  data: {
    motto: 'Hello World',
    userInfo: {},
    hasUserInfo: false,
    canIUse: wx.canIUse('button.open-type.getUserInfo')
  },
})

</script>
<style lang="scss">
.userinfo {
  display: flex;
  flex-direction: column;
  align-items: center;
  h2 {
    background: red;
  }
}
</style>

Keywords

FAQs

Last updated on 23 Feb 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc