zoukankan      html  css  js  c++  java
  • 有关taro的路由的问题

    1、我们在全局的文件中定义路由

      pages: ["pages/index/index", "pages/ceping/index1"],

    2、我们在文件中使用这些路由

    Taro.navigateTo({ url: "pages/ceping/index1" });

    编译以后说会报错,因为会按照相对路径处理。

    3、怎么办呢,我们这样改就行了。

    Taro.navigateTo({ url: "/pages/ceping/index1" });

     网上说的这些貌似都不怎么好使,现在的社会人云亦云的人也太多。

    1.配置

    config/index.js

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    const path = require('path')
    ...
     
    const config = {
      alias: {
        '@actions': path.resolve(__dirname, '..''src/actions'),
        '@assets': path.resolve(__dirname, '..''src/assets'),
        '@components': path.resolve(__dirname, '..''src/components'),
        '@constants': path.resolve(__dirname, '..''src/constants'),
        '@reducers': path.resolve(__dirname, '..''src/reducers'),
        '@styles': path.resolve(__dirname, '..''src/styles'),
        '@utils': path.resolve(__dirname, '..''src/utils')
      },
    }

    感谢京东公司,给予的最宝贵的职业经验。

  • 相关阅读:
    linux poll 和 select
    linux测试 scullpipe 驱动
    linux进程唤醒的细节
    linux进程互斥等待
    linux 手动睡眠
    linux一个进程如何睡眠
    [POJ 2431]Expedition
    【MongoDB数据库】MongoDB 命令入门初探
    高速排序为什么快?
    [050] 微信公众平台开发入门视频教程已公布
  • 原文地址:https://www.cnblogs.com/sexintercourse/p/13495061.html
Copyright © 2011-2022 走看看