开发过程中,不同页面中往往会有一些公共的模块部分,为了优化我们的代码量,因此我们最好将公共部分单独作为一个目录模块比较好。
在wxml中引入:
<import src ="公共模块的路径"/>
<template is="模块名" data="{{公共模块中的变量}}" />
在wxss中:
@import "公共样式路径";
<import src ="公共模块的路径"/>
<template is="模块名" data="{{公共模块中的变量}}" />
@import "公共样式路径";