GithubHelp home page GithubHelp logo

this.$switch在app.js不能调用么?在page下调用的话,如果配置了route是pages/$page/$page,就会报错,后面的$page无法替换 about wxpage HOT 8 OPEN

myjf007 avatar myjf007 commented on June 6, 2024
this.$switch在app.js不能调用么?在page下调用的话,如果配置了route是pages/$page/$page,就会报错,后面的$page无法替换

from wxpage.

Comments (8)

switer avatar switer commented on June 6, 2024

方面给下示例代码?

from wxpage.

myjf007 avatar myjf007 commented on June 6, 2024

比如我在index下,如果这样执行
this.$switch('home');
会报
switchTab:fail page "pages/home/$page" is not found
如果这样
this.$switch('home/home');
会报
switchTab:fail page "pages/index/home/$page" is not found

from wxpage.

switer avatar switer commented on June 6, 2024

路由是怎样配置的?

示例:

App.A({
  config: {
    route: ['/pages/$page/$page'],
})

from wxpage.

myjf007 avatar myjf007 commented on June 6, 2024

路由就是这样配置的
wxpage.A({ config:{ route: '/pages/$page/$page' } })
这是按示例来配置的
`
示例:

const { A } = require('./wxpage')
A({
config: {
route: '/pages/$page' // $page 会被替换成页面名
},
onLaunch: function () {

},
onShow: function () {

}
});`

你给的那个应该是多路由才用数组的啊

from wxpage.

myjf007 avatar myjf007 commented on June 6, 2024

我的项目路径是
pages/index/idnex
按示例的话,应该是
pages/$page/$page
的吧

from wxpage.

myjf007 avatar myjf007 commented on June 6, 2024

同样的配置,就$preLoad没问题

from wxpage.

myjf007 avatar myjf007 commented on June 6, 2024

default
route只能替换一个

from wxpage.

myjf007 avatar myjf007 commented on June 6, 2024

如果强制这样写
default
,那是没有问题

from wxpage.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.